コード例 #1
0
            private void OnAutostartToggle(object sender, EventArgs e)
            {
                var isAutostartEnabled = _autostartManager.IsAutostartEnabled();

                if (isAutostartEnabled)
                {
                    _autostartManager.DisableAutostart();
                }
                else
                {
                    _autostartManager.EnableAutostart();
                }

                UpdateAutostartMenuItemText();
            }
コード例 #2
0
        // settings ================================================================================

        void Settings_Click(object sender, EventArgs e)
        {
            ToolStripItem     item     = (ToolStripItem)sender;
            ToolStripMenuItem menuitem = (ToolStripMenuItem)sender;

            MenuSelectedActionCheck(item.Name);

            switch (menuitem.Name)
            {
            case "SettingsAutostart":
                if (AutostartHelper.IsAutostartEnabled() == true)
                {
                    AutostartHelper.DisableAutostart();
                }
                else
                {
                    AutostartHelper.EnableAutostart();
                }
                SaveSettingsAndUpdateMenu();
                break;

            case "SettingsDisabled":
                Mapper.SettingsDisabled = !Mapper.SettingsDisabled;
                SaveSettingsAndUpdateMenu();
                break;

            case "SettingsDisableInFullscreen":
                Mapper.SettingsDisableInFullscreen = !Mapper.SettingsDisableInFullscreen;
                SaveSettingsAndUpdateMenu();
                break;

            case "SettingsEnableSound":
                Mapper.SettingsEnableSound = !Mapper.SettingsEnableSound;
                SaveSettingsAndUpdateMenu();
                break;

            case "SettingsShiftCapsLock":
                Mapper.SettingsShiftCapsLock = !Mapper.SettingsShiftCapsLock;
                SaveSettingsAndUpdateMenu();
                break;
            }
        }
コード例 #3
0
        private void chkRunWhenStartup_CheckedChanged(object sender, EventArgs e)
        {
            var        autostartEnabled           = chkRunWhenStartup.Checked;
            const bool registerShortcutForAllUser = false;
            var        autostartManager           = new AutostartManager(Application.ProductName, Application.ExecutablePath,
                                                                         registerShortcutForAllUser);

            if (autostartEnabled)
            {
                if (!autostartManager.IsAutostartEnabled())
                {
                    autostartManager.EnableAutostart();
                }
            }
            else
            {
                if (autostartManager.IsAutostartEnabled())
                {
                    autostartManager.DisableAutostart();
                }
            }
        }