public bool Print(bool showPanel, Window parent, NSPrintPanel panel) { var op = NSPrintOperation.FromView(Control); if (printSettings != null) { op.PrintInfo = printSettings.ToNS(); } if (panel != null) { op.PrintPanel = panel; } op.ShowsPrintPanel = showPanel; if (parent != null) { var parentHandler = (IMacWindow)parent.Handler; var closeSheet = new SheetHelper(); op.RunOperationModal(parentHandler.Control, closeSheet, new Selector("printOperationDidRun:success:contextInfo:"), IntPtr.Zero); NSApplication.SharedApplication.RunModalForWindow(parentHandler.Control); return(closeSheet.Success); } return(op.RunOperation()); }
protected override bool RunDialog(IntPtr hwndOwner) { var currentDirectory = Environment.CurrentDirectory; try { using (var context = new ModalDialogContext()) { using (var panel = new NSPrintPanel()) { var info = NSPrintInfo.SharedPrintInfo ?? new NSPrintInfo(); if (NSPanelButtonType.Ok != (NSPanelButtonType)(int)panel.RunModalWithPrintInfo(info)) { return(false); } } return(true); } } finally { } }
void ShowDocument(NSObject sender) { var dlg = new NSPrintPanel(); // Display the print dialog as dialog box if (ShowPrintAsSheet) { dlg.BeginSheet(new NSPrintInfo(), this, this, null, new IntPtr()); } else { if (dlg.RunModalWithPrintInfo(new NSPrintInfo()) == 1) { var alert = new NSAlert() { AlertStyle = NSAlertStyle.Warning, InformativeText = "We need to print the document here...", MessageText = "Print Document", }; alert.RunModal(); } } }
public void PrintPanelDidEnd(NSPrintPanel printPanel, int returnCode, IntPtr contextInfo) { NSApplication.SharedApplication.StopModalWithCode(returnCode); }
void ShowDocument (NSObject sender) { var dlg = new NSPrintPanel(); // Display the print dialog as dialog box if (ShowPrintAsSheet) { dlg.BeginSheet(new NSPrintInfo(),this,this,null,new IntPtr()); } else { if (dlg.RunModalWithPrintInfo(new NSPrintInfo()) == 1) { var alert = new NSAlert () { AlertStyle = NSAlertStyle.Warning, InformativeText = "We need to print the document here...", MessageText = "Print Document", }; alert.RunModal (); } } }