Ejemplo n.º 1
0
        public static int Run(NSSavePanel panel, Control parent)
        {
            int ret;

            if (parent != null)
            {
                var window = parent.ControlObject as NSWindow;
                if (window == null && parent.ControlObject is NSView)
                {
                    window = ((NSView)parent.ControlObject).Window;
                }
                if (window == null || !panel.RespondsToSelector(new Selector("beginSheetModalForWindow:completionHandler:")))
                {
                    ret = (int)panel.RunModal();
                }
                else
                {
                    panel.BeginSheet(window, result => NSApplication.SharedApplication.StopModalWithCode(result));
                    ret = (int)NSApplication.SharedApplication.RunModalForWindow(window);
                }
            }
            else
            {
                ret = (int)panel.RunModal();
            }
            return(ret);
        }
Ejemplo n.º 2
0
		public static int Run (NSSavePanel panel, Control parent)
		{
			int ret;
			if (parent != null) {
				var window = parent.ControlObject as NSWindow;
				if (window == null && parent.ControlObject is NSView)
					window = ((NSView)parent.ControlObject).Window;
				if (window == null || !panel.RespondsToSelector (new Selector ("beginSheetModalForWindow:completionHandler:")))
					ret = panel.RunModal ();
				else {
					panel.BeginSheet (window, delegate(int result) { 
						NSApplication.SharedApplication.StopModalWithCode (result); 
					});
					ret = NSApplication.SharedApplication.RunModalForWindow (window);
				}
			} else
				ret = panel.RunModal ();
			return ret;
		}