123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System.IO;
- using System.Linq;
- using System.Windows;
- using System.Windows.Controls;
- using Comal.Classes;
- using InABox.Clients;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.Wpf;
- namespace PRSDesktop
- {
- /// <summary>
- /// Interaction logic for ImportBillWindow.xaml
- /// </summary>
- public partial class ImportBillWindow : ThemableWindow
- {
- private readonly Bill _bill;
- private BillDocument[] _documents;
- public ImportBillWindow(Bill bill)
- {
- _bill = bill;
- InitializeComponent();
- new Client<BillDocument>().Load(
- new Filter<BillDocument>(x => x.EntityLink.ID).IsEqualTo(_bill.ID),
- null,
- CoreRange.All,
- (o, e) =>
- {
- Dispatcher.Invoke(() =>
- {
- _documents = o;
- ReloadDocuments();
- });
- }
- );
- }
- private void ReloadDocuments()
- {
- string[] exts = { ".pdf", ".png", ".jpg", ".jpeg", ".bmp" };
- foreach (var document in _documents)
- {
- var ext = Path.GetExtension(document.DocumentLink.FileName).ToLower();
- if (exts.Contains(ext))
- {
- var tab = new DynamicTabItem { Header = Path.GetFileName(document.DocumentLink.FileName) };
- Documents.Items.Add(tab);
- }
- }
- }
- private void Documents_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- }
- }
- }
|