Пример #1
0
        public static void Delete(FastSetting fast = FastSetting.False)
        {
            if (ApplicationHelper.IsUserAdministrator())
            {
                try
                {
                    UnRegister(fast);
                    MessageBox.Show(Resources.Strings.TipUnRegister, Resources.Strings.Title,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + "\n" + Resources.Strings.TipRunAsAdmin,
                                    Resources.Strings.Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                string cmd = "/unreg";
                if (fast == FastSetting.True)
                {
                    cmd += " /fast";
                }

                ApplicationHelper.StartSelf(cmd, true);
            }
        }
Пример #2
0
        public static void Add(
            ShiftSetting shift = ShiftSetting.False,
            QuickSetting quick = QuickSetting.False)
        {
            if (ApplicationHelper.IsUserAdministrator())
            {
                try { UnRegister(quick); } catch { }

                try
                {
                    Register(shift, quick);
                    MessageBox.Show(Resources.Strings.TipRegister, Resources.Strings.Title,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + "\n" + Resources.Strings.TipRunAsAdmin,
                                    Resources.Strings.Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                string cmd = CLIHelper.GenerateCmdReg(shift, quick);
                ApplicationHelper.StartSelf(cmd, true);
            }
        }