public InvoiceClickedEventArgs(Invoice invoice) { Invoice = invoice; }
public void Show(Invoice invoice) { _invoice = invoice; Show(); }
public async void ShowPdf(Invoice invoice) { if (new Version(CompanyFile.CompanyFile.ProductVersion) < new Version("2013.4")) { MessageBox.Show("Company file does not support PDF creation!"); return; } IsLoading = true; var pdfName = invoice.Number + ".pdf"; var iService = new ServiceInvoiceService(new ApiConfiguration(), null, _keyService); try { var pdf = await iService.GetInvoiceFormAsPdfAsync(CompanyFile.CompanyFile, invoice.UID, CompanyFile.Authentication[0], null); var localFolder = ApplicationData.Current.LocalFolder; var storageFile = await localFolder.CreateFileAsync(pdfName, CreationCollisionOption.ReplaceExisting); using (var outputStream = await storageFile.OpenStreamForWriteAsync()) { await pdf.CopyToAsync(outputStream); } Windows.System.Launcher.LaunchFileAsync(storageFile); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { IsLoading = false; } }