コード例 #1
0
        private void form_reboot_FormClosed(object sender, FormClosedEventArgs e)
        {
            SystemHotKey.UnRegHotKey(Handle, 100);
            SystemHotKey.UnRegHotKey(Handle, 101);

            // 关闭浏览器窗口
            ControlProcess.CloseProcess();
        }
コード例 #2
0
        private void Form_Exit()
        {
            // 关闭浏览器窗口
            IsRunning = false;
            ControlProcess.CloseProcess();

            // 关闭当前窗体
            nti_reboot.Visible = false;
            this.Close();
            this.Dispose();
            Application.Exit();
        }
コード例 #3
0
 private void form_reboot_Load(object sender, EventArgs e)
 {
     //注册热键Shift+S,Id号为100。HotKey.KeyModifiers.Shift也可以直接使用数字4来表示。
     SystemHotKey.RegHotKey(Handle, 100, SystemHotKey.KeyModifiers.Ctrl, Keys.F12);
     SystemHotKey.RegHotKey(Handle, 101, SystemHotKey.KeyModifiers.Ctrl, Keys.F11);
     Task.Factory.StartNew(() =>
     {
         while (IsRunning)
         {
             ControlProcess.GetProcess();
         }
     });
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: wlpwz/bind-refactor
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (!IsAdministrator())
            {
                MessageBox.Show("请以管理员身份运行!");
                return;
            }

            var instance = ControlProcess.RunningInstance();

            if (instance == null)
            {
                Application.Run(new form_reboot());
            }
            else
            {
                ControlProcess.HandleRunningInstance(instance); // 已经有一个实例在运行,激活它
            }
        }