• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# AppKit.NSApplication类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MonoMac.AppKit.NSApplication的典型用法代码示例。如果您正苦于以下问题:C# NSApplication类的具体用法?C# NSApplication怎么用?C# NSApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NSApplication类属于MonoMac.AppKit命名空间,在下文中一共展示了NSApplication类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ApplicationShouldTerminate

        public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender)
        {
            _statusPanelController.Dispose();
            _statusPanelController = null;

            return NSApplicationTerminateReply.Now;
        }
开发者ID:GordonXin,项目名称:MacMenuBarPanel,代码行数:7,代码来源:AppDelegate.cs


示例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;
		}
开发者ID:kevintavog,项目名称:WatchThis.net,代码行数:26,代码来源:AppDelegate.cs


示例3: ApplicationShouldHandleReopen

        public override bool ApplicationShouldHandleReopen (NSApplication sender, bool has_visible_windows)
        {
            if (!has_visible_windows)
                Program.Controller.HandleReopen ();

            return true;
        }
开发者ID:WisdomWolf,项目名称:SparkleShare,代码行数:7,代码来源:SparkleUI.cs


示例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;
 }
开发者ID:nagyist,项目名称:Notedown,代码行数:9,代码来源:AppDelegate.cs


示例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;
		}
开发者ID:JoshuaKennedy,项目名称:DarkHavoc,代码行数:8,代码来源:Program.cs


示例6: ApplicationShouldTerminate

        public NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender)
        {
            RxApp.MainThreadScheduler.Schedule(() =>
                shouldPersistState.OnNext(Disposable.Create(() =>
                    sender.ReplyToApplicationShouldTerminate(true))));

            return NSApplicationTerminateReply.Later;
        }
开发者ID:bbqchickenrobot,项目名称:RxUI-UWP-Sample,代码行数:8,代码来源:AppKitAutoSuspendHelper.cs


示例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;
		}
开发者ID:alexandrebaker,项目名称:Eto,代码行数:10,代码来源:AppDelegate.cs


示例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;
 }
开发者ID:M1C,项目名称:Eto,代码行数:11,代码来源:AppDelegate.cs


示例9: OpenFile

        public override bool OpenFile(NSApplication sender, string filename)
        {
            if (mainWindowController == null)
            {
                mainWindowController = new MainWindowController();
                mainWindowController.Window.MakeKeyAndOrderFront(this);
            }

            return mainWindowController.OpenFolderDirectly(filename);
        }
开发者ID:kevintavog,项目名称:MapThis,代码行数:10,代码来源:AppDelegate.cs


示例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;
        }
开发者ID:jbutz,项目名称:GitHubNotifications,代码行数:11,代码来源:AppDelegate.cs


示例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);
        }
开发者ID:Berimor66,项目名称:duplicati,代码行数:11,代码来源:CocoaRunner.cs


示例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);
		}
开发者ID:kevintavog,项目名称:Radish.net,代码行数:12,代码来源:AppDelegate.cs


示例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;
        }
开发者ID:M1C,项目名称:Eto,代码行数:13,代码来源:AppDelegate.cs


示例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;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:13,代码来源:AppDelegate.cs


示例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;
     }
 }
开发者ID:Clodo76,项目名称:airvpn-client,代码行数:14,代码来源:AppDelegate.cs


示例16: OpenFiles

 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);
 }
开发者ID:samilamti,项目名称:axcrypt-net,代码行数:16,代码来源:AppDelegate.cs


示例17: ApplicationShouldTerminate

        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;
        }
开发者ID:danclarke,项目名称:AquissUsageChecker,代码行数:17,代码来源:AppDelegate.cs


示例18: RegisteredForRemoteNotifications

		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);
		}
开发者ID:GrimReio,项目名称:PushSharp,代码行数:19,代码来源:AppDelegate.cs


示例19: ApplicationShouldTerminate

		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

		}
开发者ID:Nailz,项目名称:MonoGame-Samples,代码行数:19,代码来源:Program.cs


示例20: ApplicationShouldOpenUntitledFile

		public override bool ApplicationShouldOpenUntitledFile (NSApplication sender)
		{
			return false;
		}
开发者ID:RafasTavares,项目名称:mac-samples,代码行数:4,代码来源:AppDelegate.cs



注:本文中的MonoMac.AppKit.NSApplication类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AppKit.NSButton类代码示例发布时间:2022-05-26
下一篇:
C# MonoJavaBridge.JniHandle类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap