本文整理汇总了C#中NSApplication类的典型用法代码示例。如果您正苦于以下问题:C# NSApplication类的具体用法?C# NSApplication怎么用?C# NSApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSApplication类属于命名空间,在下文中一共展示了NSApplication类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplicationShouldHandleReopen
public override bool ApplicationShouldHandleReopen(NSApplication sender, bool hasVisibleWindows)
{
// This could be invoked before DidFinishLaunching
if (MainWindow != null) {
MainWindow.IsVisible = true;
MainWindow.MakeKeyAndOrderFront (this);
}
return false;
}
示例2: ApplicationShouldHandleReopen
public override bool ApplicationShouldHandleReopen(NSApplication sender, bool hasVisibleWindows)
{
if (!hasVisibleWindows)
{
foreach (var window in sender.Windows)
window.MakeKeyAndOrderFront(this);
}
return true;
}
示例3: ApplicationShouldTerminate
public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender)
{
if (_mainWindowController.ContinueIfChanged())
{
return NSApplicationTerminateReply.Now;
}
else
{
return NSApplicationTerminateReply.Cancel;
}
}
示例4: ApplicationShouldTerminateAfterLastWindowClosed
public override bool ApplicationShouldTerminateAfterLastWindowClosed(NSApplication sender)
{
return true;
}
示例5: ApplicationShouldOpenUntitledFile
public override bool ApplicationShouldOpenUntitledFile(NSApplication sender)
{
Console.WriteLine("ApplicationShouldOpenUntitledFile called");
return PreferenceController.PreferenceEmptyDoc;
}
示例6: NSRunloopScheduler
public NSRunloopScheduler(NSApplication app)
{
theApp = app;
}
示例7: OpenFile
/// <summary>
/// This method is called when the user selects a file from the <c>Open Recent</c>
/// menu item.
/// </summary>
/// <returns><c>true</c>, if file was opened, <c>false</c> otherwise.</returns>
/// <param name="sender">A pointer to the app.</param>
/// <param name="filename">The full path and filename of the file to open.</param>
/// <remarks>For more details, see: https://developer.xamarin.com/guides/mac/user-interface/working-with-menus/#Working_with_the_Open_Recent_Menu</remarks>
public override bool OpenFile (NSApplication sender, string filename)
{
// Trap all errors
try {
// Escape any spaces (" ") or they will cause an error
// when converted to an NSUrl.
filename = filename.Replace (" ", "%20");
var url = new NSUrl ("file://"+filename);
return OpenFile(url);
} catch {
return false;
}
}
示例8: ApplicationShouldTerminate
/// <summary>
/// Called before the app terminates to allow the app to cancel the termination
/// based on state, such as a file not being saved.
/// </summary>
/// <returns>A flag stating if the app can terminate at this time.</returns>
/// <param name="sender">A pointer to the app.</param>
/// <remarks>For more details, see: https://developer.xamarin.com/guides/mac/user-interface/working-with-windows/#Modified_Windows_Content</remarks>
public override NSApplicationTerminateReply ApplicationShouldTerminate (NSApplication sender)
{
// See if any window needs to be saved first
foreach (NSWindow window in NSApplication.SharedApplication.Windows) {
if (window.Delegate != null && !window.Delegate.WindowShouldClose (this)) {
// Did the window terminate the close?
return NSApplicationTerminateReply.Cancel;
}
}
// Allow normal termination
return NSApplicationTerminateReply.Now;
}
示例9: ApplicationShouldHandleReopen
public override bool ApplicationShouldHandleReopen(NSApplication sender, bool hasVisibleWindows)
{
if (hasVisibleWindows == false)
m_window.MakeKeyAndOrderFront (null);
return true;
}
示例10: ApplicationShouldOpenUntitledFile
public override bool ApplicationShouldOpenUntitledFile (NSApplication sender)
{
return false;
}