| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 | 
							- using Comal.Classes;
 
- using InABox.DynamicGrid;
 
- using System.Collections.Generic;
 
- using System.ComponentModel;
 
- using System.Linq;
 
- using System.Runtime.CompilerServices;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows;
 
- using System.Windows.Controls;
 
- using System.Windows.Data;
 
- using System.Windows.Documents;
 
- using System.Windows.Input;
 
- using System.Windows.Media;
 
- using System.Windows.Media.Imaging;
 
- using System.Windows.Navigation;
 
- using System.Windows.Shapes;
 
- namespace PRSDesktop;
 
- /// <summary>
 
- /// Interaction logic for SupplierBillEditLayout.xaml
 
- /// </summary>
 
- public partial class SupplierBillEditDocumentLayout : DynamicEditorGridLayout, INotifyPropertyChanged
 
- {
 
-     public override bool TabStripVisible
 
-     {
 
-         get { return Editors.TabStripVisible; }
 
-         set { Editors.TabStripVisible = value; }
 
-     }
 
-     public override double TotalWidth => 0.0;
 
-     public override double TotalHeight => 0.0;
 
-     public SupplierBillEditDocumentLayout()
 
-     {
 
-         InitializeComponent();
 
-     }
 
-     public override void LoadPages(IEnumerable<IDynamicEditorPage> pages)
 
-     {
 
-         Editors.Items.Clear();
 
-         OtherPages.Items.Clear();
 
-         DocumentControl.Content = null;
 
-         foreach (var page in pages.OrderBy(x => x.PageType).ThenBy(x => x.Order).ThenBy(x => x.Caption()))
 
-         {
 
-             if(page is DynamicDocumentGrid<BillDocument, Bill, BillLink> docs)
 
-             {
 
-                 docs.SimpleTemplate = true;
 
-                 DocumentControl.Content = docs;
 
-             }
 
-             else
 
-             {
 
-                 var tab = new DynamicTabItem();
 
-                 tab.Header = page.Caption();
 
-                 //if (page is FrameworkElement element)
 
-                 //    element.Margin = new Thickness(0, 2, 0, 0);
 
-                 tab.Content = page;
 
-                 if (page is DynamicEditorGrid.DynamicEditPage)
 
-                 {
 
-                     Editors.Items.Add(tab);
 
-                 }
 
-                 else
 
-                 {
 
-                     OtherPages.Items.Add(tab);
 
-                 }
 
-             }
 
-         }
 
-         Editors.SelectedIndex = 0;
 
-         OtherPages.SelectedIndex = 0;
 
-     }
 
-     private bool bChanging;
 
-     public event PropertyChangedEventHandler? PropertyChanged;
 
-     protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
 
-     {
 
-         PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
 
-     }
 
-     private void Editors_SelectionChanged(object sender, SelectionChangedEventArgs e)
 
-     {
 
-         if (bChanging) return;
 
-         if ((e.OriginalSource != Editors && e.OriginalSource != OtherPages) || e.OriginalSource is not DynamicTabControl tabControl) return;
 
-         if (tabControl.SelectedItem is not DynamicTabItem tab) return;
 
-         bChanging = true;
 
-         try
 
-         {
 
-             if (tab is not null && tab.Content is IDynamicEditorPage page)
 
-             {
 
-                 SelectPage(page);
 
-             }
 
-         }
 
-         finally
 
-         {
 
-             bChanging = false;
 
-         }
 
-     }
 
-     private void DocumentWidthChanged(object sender, SizeChangedEventArgs e)
 
-     {
 
-         if (DocumentControl.Content is DynamicDocumentGrid<BillDocument, Bill, BillLink> docs)
 
-             docs.RowHeight = e.NewSize.Width;
 
-     }
 
- }
 
 
  |