本文整理汇总了C#中MonoMac.AppKit.NSApplication类的典型用法代码示例。如果您正苦于以下问题:C# NSApplication类的具体用法?C# NSApplication怎么用?C# NSApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSApplication类属于MonoMac.AppKit命名空间,在下文中一共展示了NSApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplicationShouldTerminate
public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender)
{
_statusPanelController.Dispose();
_statusPanelController = null;
return NSApplicationTerminateReply.Now;
}
示例2: OpenFile
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;
}
示例3: ApplicationShouldHandleReopen
public override bool ApplicationShouldHandleReopen (NSApplication sender, bool has_visible_windows)
{
if (!has_visible_windows)
Program.Controller.HandleReopen ();
return true;
}
示例4: ApplicationShouldHandleReopen
// 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;
}
示例5: ApplicationShouldTerminate
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;
}
示例6: ApplicationShouldTerminate
public NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender)
{
RxApp.MainThreadScheduler.Schedule(() =>
shouldPersistState.OnNext(Disposable.Create(() =>
sender.ReplyToApplicationShouldTerminate(true))));
return NSApplicationTerminateReply.Later;
}
示例7: ApplicationShouldTerminate
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;
}
示例8: ApplicationShouldHandleReopen
// 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;
}
示例9: OpenFile
public override bool OpenFile(NSApplication sender, string filename)
{
if (mainWindowController == null)
{
mainWindowController = new MainWindowController();
mainWindowController.Window.MakeKeyAndOrderFront(this);
}
return mainWindowController.OpenFolderDirectly(filename);
}
示例10: ApplicationShouldTerminate
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;
}
示例11: Init
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);
}
示例12: OpenFile
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);
}
示例13: ApplicationShouldTerminate
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;
}
示例14: ApplicationShouldTerminate
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;
}
示例15: ApplicationShouldTerminate
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;
}
}