void FindAddress(object sender, EventArgs args) { idir.Invoices().ForEach(delegate (string name) { Invoice invoice = new Invoice(); invoice.load(idir.PathName(name)); if (String.Compare(invoice.namn, namn.Text, true) == 0) { address.Text = invoice.address; postnr.Text = invoice.postnr; postort.Text = invoice.postort; referens.Text = invoice.referens; } }); }
private void PrintInvoice(object sender, EventArgs args) { try { string name; if (SelectedInvoice(out name)) { Invoice invoice = new Invoice(); string file = idir.PathName(name); invoice.load(file); PrintInvoice printDoc = new PrintInvoice(invoice); System.Windows.Forms.PrintDialog dlg = new System.Windows.Forms.PrintDialog(); dlg.AllowSomePages = true; dlg.ShowHelp = true; dlg.Document = printDoc; dlg.PrinterSettings.MinimumPage = 1; dlg.PrinterSettings.MaximumPage = 2; dlg.PrinterSettings.FromPage = 1; dlg.PrinterSettings.ToPage = 2; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { printDoc.Print(); } } } catch (System.Exception e) { MessageDialog("Error in " + e.TargetSite + ": " + e.Message); } }
private void ShowInvoice(object sender, EventArgs args) { try { string name; if (SelectedInvoice(out name)) { Invoice invoice = new Invoice(); string file = idir.PathName(name); invoice.load(file); ShowWindow sw = new ShowWindow(invoice); sw.Show(); // PrintInvoice printDoc = new PrintInvoice(invoice); // System.Windows.Forms.PrintPreviewDialog dlgPrintPreview = new System.Windows.Forms.PrintPreviewDialog(); // dlgPrintPreview.Document = printDoc; // dlgPrintPreview.WindowState = System.Windows.Forms.FormWindowState.Maximized; // dlgPrintPreview.ShowDialog(); } } catch (System.Exception e) { MessageDialog("Error in " + e.TargetSite + ": " + e.Message); } }
private void Edit(object sender, EventArgs args) { try { string name; if (SelectedInvoice(out name)) { Invoice invoice = new Invoice(); string file = idir.PathName(name); invoice.load(file); Window editWindow = new EditWindow(invoice, file, idir, UpdateHDList); editWindow.Show(); } } catch (System.Exception e) { MessageDialog("Error in " + e.TargetSite + ": " + e.Message); } }