public void EndSheet(Cocoa.Window sheet, int returnCode) { if (sheet == null) { throw new ArgumentNullException("sheet"); } ObjCMessaging.objc_msgSend(NativeObject, "endSheet:returnCode:", typeof(void), typeof(System.IntPtr), sheet.NativeObject, typeof(int), returnCode); }
public void BeginSheet(string directory, string filename, Cocoa.Window docWindow, SavePanelHandler modalDelegate, System.IntPtr contextInfo) { if (modalDelegate == null) { throw new ArgumentNullException("modalDelegate"); } Cocoa.Object target = (Cocoa.Object)modalDelegate.Target; MethodInfo method = modalDelegate.Method; string selector = method.Name; foreach (ExportAttribute export_attribute in Attribute.GetCustomAttributes(method, typeof(ExportAttribute))) { if (export_attribute.Selector != null) { selector = export_attribute.Selector; } } ObjCMessaging.objc_msgSend(NativeObject, "beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:", typeof(void), typeof(System.IntPtr), (directory == null) ? IntPtr.Zero : new Cocoa.String(directory).NativeObject, typeof(System.IntPtr), (filename == null) ? IntPtr.Zero : new Cocoa.String(filename).NativeObject, typeof(System.IntPtr), (docWindow == null) ? IntPtr.Zero : docWindow.NativeObject, typeof(System.IntPtr), target.NativeObject, typeof(System.IntPtr), ObjCMethods.sel_getUid(selector), typeof(System.IntPtr), contextInfo); }
public void Run() { Application.Init (); Application.LoadFramework ("WebKit"); Application.LoadNib ("MonoDoc.nib"); if (File.Exists ("monodoc.index")) { Rect rect; Image image = new Image ("mono.png"); image.BackgroundColor = Color.Red; rect.Size = image.Size; rect.Origin.X = (Screen.Main.Frame.Size.Width-400)/2; rect.Origin.Y = (Screen.Main.Frame.Size.Height-300)/2; rect.Size.Height += 20; Window window = new Window (rect, 0, BackingStoreType.Buffered, false); rect.Origin.X = 0; rect.Origin.Y = 0; rect.Size.Height = 20; ProgressIndicator p_indicator = new ProgressIndicator (rect); window.View.AddSubview (p_indicator); rect.Origin.X = 0; rect.Origin.Y = 20; rect.Size = image.Size; ImageView imageview = new ImageView (rect); imageview.Image = image; window.View.AddSubview (imageview); p_indicator.StartAnimation (); System.Threading.Thread t = new System.Threading.Thread (new ThreadStart (MakeIndex)); t.Start (); IntPtr session = Application.SharedApplication.ModalSessionForWindow (window); window.Show (); while (t.IsAlive) { Application.SharedApplication.RunModalSession (session); System.Threading.Thread.Sleep (50); } Application.SharedApplication.EndModalSession (session); p_indicator.StopAnimation (); window.Close (); } Application.Run (); }
public IntPtr ModalSessionForWindow(Window window) { return (IntPtr) ObjCMessaging.objc_msgSend (NativeObject, "beginModalSessionForWindow:", typeof (IntPtr), typeof (IntPtr), window.NativeObject); }