Exemplo n.º 1
0
        public FormMain()
        {
            InitializeComponent();
            _version = Assembly.GetExecutingAssembly().GetName().Version;

            if (Settings.Default.UpgradeRequired)
            {
                Settings.Default.Upgrade();
                Settings.Default.UpgradeRequired = false;
                Settings.Default.Save();
            }

            _settingManager = new SettingManager();
            _settingManager.BackupFolderChanged += () =>
            {
                SetFolderTextBox(textBoxBackupFolder, _settingManager.BackupFolder);
                buttonBackupFolderOpen.Enabled = IsBackupFolderValid();
            };
            _settingManager.SavedGameFolderChanged += () =>
            {
                SetFolderTextBox(textBoxSavedGamesFolder, _settingManager.SavedGameFolder);
            };
            _settingManager.NotificationModeChanged += () =>
            {
                messageBoxToolStripMenuItem.Checked = _settingManager.NotificationMode == MessageMode.MessageBox;
                statusBarToolStripMenuItem.Checked  = _settingManager.NotificationMode == MessageMode.Status;
            };
            _settingManager.ScreenshotQualityChanged += () =>
            {
                giflowSizeToolStripMenuItem.Checked  = _settingManager.ScreenshotQuality == ScreenshotQuality.Gif;
                jpgmediumToolStripMenuItem.Checked   = _settingManager.ScreenshotQuality == ScreenshotQuality.Jpg;
                pnghugeSizeToolStripMenuItem.Checked = _settingManager.ScreenshotQuality == ScreenshotQuality.Png;
            };
            _settingManager.SortOrderChanged += () =>
            {
                ascendingToolStripMenuItem.Checked  = _settingManager.SortOrder == SortOrder.Ascending;
                descendingToolStripMenuItem.Checked = _settingManager.SortOrder == SortOrder.Descending;
            };
            _settingManager.SortKindChanged += () =>
            {
                savedAtToolStripMenuItem.Checked    = _settingManager.SortKind == SortKind.SavedAt;
                playedTimeToolStripMenuItem.Checked = _settingManager.SortKind == SortKind.PlayedTime;
            };
            _settingManager.HotKeysActiveChanged += () =>
            {
                activeToolStripMenuItem.Checked = _settingManager.HotKeysActive;
                if (_settingManager.HotKeysActive)
                {
                    _hotKeysManager?.Hook();
                }
                else
                {
                    _hotKeysManager?.UnHook();
                }
            };
            _settingManager.HotKeysSoundChanged += () =>
            {
                soundToolStripMenuItem.Checked = _settingManager.HotKeysSound;
            };
        }
Exemplo n.º 2
0
        private void InitHotKeys()
        {
            if (_hotKeysManager == null || _settingManager == null)
            {
                return;
            }

            _hotKeysManager.HotKeys.Clear();
            foreach (HotKeyToAction hotKeyToAction in _settingManager.HotKeyToActions)
            {
                _hotKeysManager.HotKeys.Add(hotKeyToAction);
            }

            if (_settingManager.HotKeysActive)
            {
                _hotKeysManager.Hook();
            }
        }