static void Main(string[] args) { ReferenceGuide guide1 = new ReferenceGuide("Desktop Support Guide"); ReferenceGuide guide2 = new ReferenceGuide("Laptop Support Guide"); ReferenceGuide guide3 = new ReferenceGuide("Server Support Guide"); Report project1 = new Report("IT Upgrade Report"); Report project2 = new Report("Customer Project Report"); Report project3 = new Report("Office Relocation Report"); Printer <ReferenceGuide> referenceGuidePrinter = new Printer <ReferenceGuide>(); referenceGuidePrinter.DocumentAddingToQueue += new DocumentAddingToQueueDelegate <ReferenceGuide>(referenceGuidePrinter_DocumentAddingToQueue); referenceGuidePrinter.AddDocumentToQueue(guide1); referenceGuidePrinter.AddDocumentToQueue(guide2); referenceGuidePrinter.AddDocumentToQueue(guide3); referenceGuidePrinter.PrintDocuments(); Console.ReadLine(); Printer <Report> reportPrinter = new Printer <Report>(); reportPrinter.AddDocumentToQueue(project1); reportPrinter.AddDocumentToQueue(project2); reportPrinter.AddDocumentToQueue(project3); reportPrinter.DocumentPrinted += new Action <Printer <Report>, DocumentPrintedEventArgs <Report> >(reportPrinter_DocumentPrinted); reportPrinter.PrintDocuments(); Console.ReadLine(); }
static void Main(string[] args) { //Запись в журнал событий об ошибках, произошедших при публикации SOAP //с поддержкой COM-интерфейсов в COM + приложений. Report project1 = new Report("IT Upgrade Report"); Report project2 = new Report("Customer Project Report"); Report project3 = new Report("Office Relocation Report"); ReferenceGuide guide1 = new ReferenceGuide("Desktop Support Guide"); ReferenceGuide guide2 = new ReferenceGuide("Laptop Support Guide"); ReferenceGuide guide3 = new ReferenceGuide("Server Support Guide"); Printer <Report> reportPrinter = new Printer <Report>(); reportPrinter.AddDocumentToQueue(project1); reportPrinter.AddDocumentToQueue(project2); reportPrinter.AddDocumentToQueue(project3); reportPrinter.PrintDocuments(); Console.ReadLine(); Printer <ReferenceGuide> referenceGuidePrinter = new Printer <ReferenceGuide>(); referenceGuidePrinter.AddDocumentToQueue(guide1); referenceGuidePrinter.AddDocumentToQueue(guide2); referenceGuidePrinter.AddDocumentToQueue(guide3); referenceGuidePrinter.PrintDocuments(); Console.ReadLine(); }
static bool referenceGuidePrinter_DocumentAddingToQueue(ReferenceGuide document) { System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show(String.Format("Reference Guide Title: {0} \nProceeed?", document.Title), "Reference Guide Printing", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Information); if (result == System.Windows.Forms.DialogResult.OK) { return(true); } else { return(false); } }