public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender) { _statusPanelController.Dispose(); _statusPanelController = null; return NSApplicationTerminateReply.Now; }
public override bool OpenFile(NSApplication sender, string filename) { logger.Info("App.OpenFile: {0}", filename); try { var model = SlideshowModel.ParseFile(filename); if (model != null) { var controller = new SlideshowWindowController(); controller.Model = model; controller.Window.MakeKeyAndOrderFront(this); startedSlideshow = true; return true; } else { logger.Info("Failed loading '{0}'", filename); } } catch (Exception e) { logger.Info("Error opening file: {0}", e); } return true; }
public override bool ApplicationShouldHandleReopen (NSApplication sender, bool has_visible_windows) { if (!has_visible_windows) Program.Controller.HandleReopen (); return true; }
// show the main window when the application button is clicked public override bool ApplicationShouldHandleReopen(NSApplication sender, bool hasVisibleWindows) { if (!hasVisibleWindows) { if (Application.Instance.MainForm != null) Application.Instance.MainForm.Show(); } return true; }
public override NSApplicationTerminateReply ApplicationShouldTerminate (NSApplication sender) { Debug.WriteLine("[Dark Havoc] Exiting game..."); JoshoEngine.DestroyEngine(Program.gameInstance); Debug.WriteLine("[Dark Havoc] Qutting.. Bye! :)"); return NSApplicationTerminateReply.Now; }
public NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender) { RxApp.MainThreadScheduler.Schedule(() => shouldPersistState.OnNext(Disposable.Create(() => sender.ReplyToApplicationShouldTerminate(true)))); return NSApplicationTerminateReply.Later; }
public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender) { var args = new CancelEventArgs(); var form = Application.Instance.MainForm == null ? null : Application.Instance.MainForm.Handler as IMacWindow; if (form != null) args.Cancel = !form.CloseWindow(Application.Instance.OnTerminating); else Application.Instance.OnTerminating(args); return args.Cancel ? NSApplicationTerminateReply.Cancel : NSApplicationTerminateReply.Now; }
// do any OS X - specific file/application open/launch handling here public override bool ApplicationShouldHandleReopen(NSApplication sender, bool hasVisibleWindows) { // show main window when the application button is clicked if (!hasVisibleWindows) { var form = Application.Instance.MainForm; if (form != null) form.Show (); } return true; }
public override bool OpenFile(NSApplication sender, string filename) { if (mainWindowController == null) { mainWindowController = new MainWindowController(); mainWindowController.Window.MakeKeyAndOrderFront(this); } return mainWindowController.OpenFolderDirectly(filename); }
public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender) { // Clean up all of the panels, and disposable resources if (_statusItem != null) { _statusItem.Dispose(); _statusItem = null; } return NSApplicationTerminateReply.Now; }
public override void Init(string[] args) { NSApplication.Init(); m_app = NSApplication.SharedApplication; m_app.ActivateIgnoringOtherApps(true); m_statusItem = NSStatusBar.SystemStatusBar.CreateStatusItem(32); m_statusItem.HighlightMode = true; base.Init(args); }
public override bool OpenFile(NSApplication sender, string filename) { Environment.SetEnvironmentVariable("MONO_MANAGED_WATCHER", "enabled"); if (controller == null) { this.filename = filename; logger.Info("OpenFile '{0}'", filename); return true; } return controller.OpenFolderOrFile(filename); }
public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender) { var args = new CancelEventArgs(); var form = Application.Instance.MainForm != null ? Application.Instance.MainForm.Handler as IMacWindow : null; if (form != null) { if (!form.CloseWindow ()) return NSApplicationTerminateReply.Cancel; } Application.Instance.OnTerminating (args); if (args.Cancel) return NSApplicationTerminateReply.Cancel; else return NSApplicationTerminateReply.Now; }
public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender) { var args = new CancelEventArgs(); var app = ((ApplicationHandler)Application.Instance.Handler); var form = Application.Instance.MainForm == null ? null : Application.Instance.MainForm.Handler as IMacWindow; if (form != null) args.Cancel = !form.CloseWindow(ce => app.Callback.OnTerminating(app.Widget, ce)); else { app.Callback.OnTerminating(app.Widget, args); } return args.Cancel ? NSApplicationTerminateReply.Cancel : NSApplicationTerminateReply.Now; }
public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender) { if (Engine.Instance.Terminated == false) { if (mainWindowController.ShutdownConfirmed) return NSApplicationTerminateReply.Later; else if(mainWindowController.Shutdown() == false) return NSApplicationTerminateReply.Cancel; else return NSApplicationTerminateReply.Later; } else { return NSApplicationTerminateReply.Now; } }
public override void OpenFiles(NSApplication sender, string[] filenames) { openFile = new OpenFileFromFinderController (); openFile.UserChoseOpen += (string passphrase) => { AppController.DecryptAndOpenFile( OS.Current.FileInfo(filenames[0]), new Passphrase(passphrase), new ProgressContext(), AppController.OperationFailureHandler); ReleaseOpenFileController(); }; openFile.UserChoseCancel += () => { ReleaseOpenFileController(); }; openFile.ShowWindow (sender); }
public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender) { // Clean up all of the panels, and disposable resources if (_usageChecker != null) { _usageChecker.Dispose(); _usageChecker = null; } if (_statusPanelController != null) { _statusPanelController.Dispose(); _statusPanelController = null; } return NSApplicationTerminateReply.Now; }
public override void RegisteredForRemoteNotifications (NSApplication application, NSData deviceToken) { var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken"); //There's probably a better way to do this var strFormat = new NSString("%@"); var dt = new NSString(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new MonoTouch.ObjCRuntime.Class("NSString").Handle, new MonoTouch.ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle)); var newDeviceToken = dt.ToString().Replace("<", "").Replace(">", "").Replace(" ", ""); if (string.IsNullOrEmpty(oldDeviceToken) || !deviceToken.Equals(newDeviceToken)) { //TODO: Put your own logic here to notify your server that the device token has changed/been created! } //Save device token now NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "PushDeviceToken"); Console.WriteLine("Device Token: " + newDeviceToken); }
public override NSApplicationTerminateReply ApplicationShouldTerminate (NSApplication sender) { NSAlert alert = NSAlert.WithMessage("Warning", "Yes", "No", null, "Do you really want to close?"); var button = alert.RunModal(); if ( button == 0 ) { return NSApplicationTerminateReply.Cancel; }//if else { return NSApplicationTerminateReply.Now; }//else }
protected override void Run(string[] args) { try { m_app.Run(); } finally { if (m_statusItem != null) { NSStatusBar.SystemStatusBar.RemoveStatusItem(m_statusItem); m_statusItem = null; m_keeper.Clear(); m_images.Clear(); } m_app = null; } }
public override bool ApplicationShouldOpenUntitledFile (NSApplication sender) { return false; }
public int RunSheetModal (NSWindow window, NSApplication application) { if (application == null) throw new ArgumentNullException ("application"); // same behavior as BeginSheet with a null window if (window == null) return RunModal (); int returnCode = -1000; BeginSheetForResponse (window, r => { returnCode = r; application.StopModal (); }); application.RunModalForWindow (Window); return returnCode; }
public override void OpenFiles (NSApplication sender, string[] filenames) { var openFilesEvent = OpenFilesRequest; if (openFilesEvent != null) { var args = new OpenFilesEventArgs (filenames); openFilesEvent (NSApplication.SharedApplication, args); } }
/// <summary> /// Applications the should handle reopen. /// </summary> /// <returns><c>true</c>, if should handle reopen was applicationed, <c>false</c> otherwise.</returns> /// <param name="sender">Sender.</param> /// <param name="hasVisibleWindows">If set to <c>true</c> has visible windows.</param> public override bool ApplicationShouldHandleReopen (NSApplication sender, bool hasVisibleWindows) { return true; }
public override void ReceivedRemoteNotification (NSApplication application, NSDictionary userInfo) { Console.WriteLine("Received Remote Notification!"); }
// If the application was launched with an url, we don't open a default window public override bool ApplicationShouldOpenUntitledFile (NSApplication sender) { return shouldOpenInitialFile; }
/// <summary> /// Applications the open untitled file. /// </summary> /// <returns><c>true</c>, if open untitled file was applicationed, <c>false</c> otherwise.</returns> /// <param name="sender">Sender.</param> public override bool ApplicationOpenUntitledFile (NSApplication sender) { return true; }
public override NSApplicationTerminateReply ApplicationShouldTerminate (NSApplication sender) { var terminatingEvent = Terminating; if (terminatingEvent != null) { var args = new TerminationEventArgs (); terminatingEvent (NSApplication.SharedApplication, args); return args.Reply; } return NSApplicationTerminateReply.Now; }
public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender) { return true; }
public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender) { var close = (controller != null) ? controller.WindowShouldClose() : true; return close ? NSApplicationTerminateReply.Now : NSApplicationTerminateReply.Cancel; }