1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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,
- (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)
- {
- }
- }
- }
|