Exemplo n.º 1
0
        /// <summary>
        /// OK ボタンをクリックした
        /// </summary>
        private void OKButton_Click(object sender, EventArgs e)
        {
            // ショートカットキーの正常確認
            if (!ValidateHotkeys())
            {
                LanguageManager.Language Language;

                // 設定に応じた言語オブジェクトを取得
                if (Properties.Settings.Default.Language == "Automatic")
                {
                    // OS の言語を取得
                    string OSLanguage = System.Globalization.CultureInfo.CurrentCulture.Name;
                    Language = LanguageManager.Get(OSLanguage);
                }
                else
                {
                    Language = LanguageManager.Get(Properties.Settings.Default.Language);
                }

                string WarningMesage = Language.InvalidHotkeyWarningMessage;
                string WarningTitle  = Language.InvalidHotkeyWarningTitle;

                DialogResult result = MessageBox.Show
                                      (
                    WarningMesage,
                    WarningTitle,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Warning,
                    MessageBoxDefaultButton.Button2
                                      );

                if (result == DialogResult.No)
                {
                    return;
                }
            }

            // スコアボードの表示位置を文字列化
            string ScoreBoardPosition = ScoreBoardPositionRadio_Top.Checked ? "top" : "bottom";

            // ロゴ画像を選択した場合はアプリケーションフォルダ内に複製
            string Extension = Path.GetExtension(LogoPictureBox.ImageLocation);

            if (LogoPictureBox.ImageLocation != LogoFileNameWithoutExtension + Extension && LogoPictureBox.ImageLocation != null && LogoPictureBox.ImageLocation != string.Empty)
            {
                if (!Directory.Exists(Path.GetDirectoryName(LogoFileNameWithoutExtension)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(LogoFileNameWithoutExtension));
                }
                File.Copy(LogoPictureBox.ImageLocation, LogoFileNameWithoutExtension + Extension, true);
                LogoPictureBox.ImageLocation = LogoFileNameWithoutExtension + Extension;
            }

            // ホットキーのデータを作成
            KeysConverter kc = new KeysConverter();

            ConfigManager.HotkeyData WinHotkey = new ConfigManager.HotkeyData();
            if (!string.IsNullOrEmpty(WinHotkeyCombobox.Text))
            {
                WinHotkey.KeyCode = (Keys)kc.ConvertFromString(WinHotkeyCombobox.Text);
            }
            if (WinHotkeyModCheckbox_Ctrl.Checked)
            {
                WinHotkey.ModKey |= MOD_KEY.CONTROL;
            }
            if (WinHotkeyModCheckbox_Alt.Checked)
            {
                WinHotkey.ModKey |= MOD_KEY.ALT;
            }
            if (WinHotkeyModCheckbox_Shift.Checked)
            {
                WinHotkey.ModKey |= MOD_KEY.SHIFT;
            }

            ConfigManager.HotkeyData LoseHotkey = new ConfigManager.HotkeyData();
            if (!string.IsNullOrEmpty(LoseHotkeyCombobox.Text))
            {
                LoseHotkey.KeyCode = (Keys)kc.ConvertFromString(LoseHotkeyCombobox.Text);
            }
            if (LoseHotkeyModCheckbox_Ctrl.Checked)
            {
                LoseHotkey.ModKey |= MOD_KEY.CONTROL;
            }
            if (LoseHotkeyModCheckbox_Alt.Checked)
            {
                LoseHotkey.ModKey |= MOD_KEY.ALT;
            }
            if (LoseHotkeyModCheckbox_Shift.Checked)
            {
                LoseHotkey.ModKey |= MOD_KEY.SHIFT;
            }

            ConfigManager.HotkeyData DrawHotkey = new ConfigManager.HotkeyData();
            if (!string.IsNullOrEmpty(DrawHotkeyCombobox.Text))
            {
                DrawHotkey.KeyCode = (Keys)kc.ConvertFromString(DrawHotkeyCombobox.Text);
            }
            if (DrawHotkeyModCheckbox_Ctrl.Checked)
            {
                DrawHotkey.ModKey |= MOD_KEY.CONTROL;
            }
            if (DrawHotkeyModCheckbox_Alt.Checked)
            {
                DrawHotkey.ModKey |= MOD_KEY.ALT;
            }
            if (DrawHotkeyModCheckbox_Shift.Checked)
            {
                DrawHotkey.ModKey |= MOD_KEY.SHIFT;
            }

            // Config を作成
            ConfigManager.Config Config = new ConfigManager.Config
                                          (
                NameTextBox.Text,
                LogoPictureBox.ImageLocation,
                MainColorBox.BackColor,
                SubColorBox.BackColor,
                FontColorBox.BackColor,
                VolumeTrackbar.Value,
                ScoreBoardSizeTrackbar.Value,
                ScoreBoardPosition,
                WinHotkey,
                LoseHotkey,
                DrawHotkey,
                EnableProductionCheckbox.Checked
                                          );

            // 保存
            ConfigManager.Save(Config);

            // フォームを閉じる
            this.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// OK ボタンをクリックした
        /// </summary>
        private void OKButton_Click(object sender, EventArgs e)
        {
            // ショートカットキーの正常確認
            if (!ValidateHotkeys())
            {
                DialogResult result = MessageBox.Show
                                      (
                    "F12 キーは単体で設定しても動作しないことがあります。\r\nCtrl, Shift, Alt のいずれかと併せてご使用ください。\n\n警告を無視してこのまま続行しますか?",
                    "警告",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Warning,
                    MessageBoxDefaultButton.Button2
                                      );

                if (result == DialogResult.No)
                {
                    return;
                }
            }

            // スコアボードの表示位置を文字列化
            string ScoreBoardPosition = ScoreBoardPositionRadio_Top.Checked ? "top" : "bottom";

            // ロゴ画像を選択した場合はアプリケーションフォルダ内に複製
            string Extension = Path.GetExtension(LogoPictureBox.ImageLocation);

            if (LogoPictureBox.ImageLocation != LogoFileNameWithoutExtension + Extension && LogoPictureBox.ImageLocation != null && LogoPictureBox.ImageLocation != string.Empty)
            {
                if (!Directory.Exists(Path.GetDirectoryName(LogoFileNameWithoutExtension)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(LogoFileNameWithoutExtension));
                }
                File.Copy(LogoPictureBox.ImageLocation, LogoFileNameWithoutExtension + Extension, true);
                LogoPictureBox.ImageLocation = LogoFileNameWithoutExtension + Extension;
            }

            // ホットキーのデータを作成
            KeysConverter kc = new KeysConverter();

            ConfigManager.HotkeyData WinHotkey = new ConfigManager.HotkeyData();
            if (!string.IsNullOrEmpty(WinHotkeyCombobox.Text))
            {
                WinHotkey.KeyCode = (Keys)kc.ConvertFromString(WinHotkeyCombobox.Text);
            }
            if (WinHotkeyModCheckbox_Ctrl.Checked)
            {
                WinHotkey.ModKey |= MOD_KEY.CONTROL;
            }
            if (WinHotkeyModCheckbox_Alt.Checked)
            {
                WinHotkey.ModKey |= MOD_KEY.ALT;
            }
            if (WinHotkeyModCheckbox_Shift.Checked)
            {
                WinHotkey.ModKey |= MOD_KEY.SHIFT;
            }

            ConfigManager.HotkeyData LoseHotkey = new ConfigManager.HotkeyData();
            if (!string.IsNullOrEmpty(LoseHotkeyCombobox.Text))
            {
                LoseHotkey.KeyCode = (Keys)kc.ConvertFromString(LoseHotkeyCombobox.Text);
            }
            if (LoseHotkeyModCheckbox_Ctrl.Checked)
            {
                LoseHotkey.ModKey |= MOD_KEY.CONTROL;
            }
            if (LoseHotkeyModCheckbox_Alt.Checked)
            {
                LoseHotkey.ModKey |= MOD_KEY.ALT;
            }
            if (LoseHotkeyModCheckbox_Shift.Checked)
            {
                LoseHotkey.ModKey |= MOD_KEY.SHIFT;
            }

            ConfigManager.HotkeyData DrawHotkey = new ConfigManager.HotkeyData();
            if (!string.IsNullOrEmpty(DrawHotkeyCombobox.Text))
            {
                DrawHotkey.KeyCode = (Keys)kc.ConvertFromString(DrawHotkeyCombobox.Text);
            }
            if (DrawHotkeyModCheckbox_Ctrl.Checked)
            {
                DrawHotkey.ModKey |= MOD_KEY.CONTROL;
            }
            if (DrawHotkeyModCheckbox_Alt.Checked)
            {
                DrawHotkey.ModKey |= MOD_KEY.ALT;
            }
            if (DrawHotkeyModCheckbox_Shift.Checked)
            {
                DrawHotkey.ModKey |= MOD_KEY.SHIFT;
            }

            // Config を作成
            ConfigManager.Config Config = new ConfigManager.Config
                                          (
                NameTextBox.Text,
                LogoPictureBox.ImageLocation,
                MainColorBox.BackColor,
                SubColorBox.BackColor,
                FontColorBox.BackColor,
                VolumeTrackbar.Value,
                ScoreBoardSizeTrackbar.Value,
                ScoreBoardPosition,
                WinHotkey,
                LoseHotkey,
                DrawHotkey
                                          );

            // 保存
            ConfigManager.Save(Config);

            // フォームを閉じる
            this.Close();
        }