当前位置: 首页>>代码示例>>C#>>正文


C# PluginInitContext.CloseApp方法代码示例

本文整理汇总了C#中PluginInitContext.CloseApp方法的典型用法代码示例。如果您正苦于以下问题:C# PluginInitContext.CloseApp方法的具体用法?C# PluginInitContext.CloseApp怎么用?C# PluginInitContext.CloseApp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PluginInitContext的用法示例。


在下文中一共展示了PluginInitContext.CloseApp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitInternal

 protected override void InitInternal(PluginInitContext context)
 {
     availableResults.Add(new Result
     {
         Title = "Shutdown",
         SubTitle = "Shutdown Computer",
         Score = 100,
         IcoPath = "Images\\exit.png",
         Action = (c) => Process.Start("shutdown","/s /t 0")
     });
     availableResults.Add(new Result
     {
         Title = "Log off",
         SubTitle = "Log off current user",
         Score = 20,
         IcoPath = "Images\\logoff.png",
         Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
     });
     availableResults.Add(new Result
     {
         Title = "Lock",
         SubTitle = "Lock this computer",
         Score = 20,
         IcoPath = "Images\\lock.png",
         Action = (c) => LockWorkStation()
     });
     availableResults.Add(new Result
     {
         Title = "Exit",
         SubTitle = "Close this app",
         Score = 110,
         IcoPath = "Images\\app.png",
         Action = (c) => context.CloseApp()
     });
 }
开发者ID:pluto92,项目名称:Wox,代码行数:35,代码来源:Sys.cs

示例2: InitInternal

 protected override void InitInternal(PluginInitContext context)
 {
     availableResults.Add(new Result
     {
         Title = "Shutdown",
         SubTitle = "Shutdown Computer",
         Score = 100,
         IcoPath = "Images\\exit.png",
         Action = (c) =>
         {
             Process.Start("shutdown", "/s /t 0");
             return true;
         }
     });
     availableResults.Add(new Result
     {
         Title = "Log off",
         SubTitle = "Log off current user",
         Score = 20,
         IcoPath = "Images\\logoff.png",
         Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
     });
     availableResults.Add(new Result
     {
         Title = "Lock",
         SubTitle = "Lock this computer",
         Score = 20,
         IcoPath = "Images\\lock.png",
         Action = (c) =>
         {
             LockWorkStation();
             return true;
         }
     });
     availableResults.Add(new Result
     {
         Title = "Exit",
         SubTitle = "Close this app",
         Score = 110,
         IcoPath = "Images\\app.png",
         Action = (c) =>
         {
             context.CloseApp();
             return true;
         }
     });
     availableResults.Add(new Result
     {
         Title = "Restart Wox",
         SubTitle = "Restart Wox",
         Score = 110,
         IcoPath = "Images\\restart.png",
         Action = (c) =>
         {
             ProcessStartInfo Info = new ProcessStartInfo();
             Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Application.ExecutablePath + "\"";
             Info.WindowStyle = ProcessWindowStyle.Hidden;
             Info.CreateNoWindow = true;
             Info.FileName = "cmd.exe";
             Process.Start(Info);
             context.CloseApp();
             return true;
         }
     });
     availableResults.Add(new Result
     {
         Title = "Setting",
         SubTitle = "Tweak this app",
         Score = 40,
         IcoPath = "Images\\app.png",
         Action = (c) =>
         {
             context.OpenSettingDialog();
             return true;
         }
     });
 }
开发者ID:ZhangHongJi,项目名称:Wox,代码行数:77,代码来源:Sys.cs


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