コード例 #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            Settings.PartNaming                = (EGeneralNaming)comBoxPartName.SelectedIndex;
            Settings.PartName                  = txtBoxPartName.Text;
            Settings.ExtraMetaFiles            = ckBoxExtraMetaFiles.Checked;
            Settings.Latin1EncodingForPlaylist = ckBoxLatin1.Checked;
            Settings.FlatFolders               = ckBoxFlatFolders.Checked;
            Settings.FlatFolderNaming          = (EFlatFolderNaming)comBoxFlatFolders.SelectedIndex;
            Settings.PartNames                 = txtBoxCustPart.Text;
            Settings.AddnlValTitlePunct        = txtBoxCustTitleChars.Text;
            Settings.ShortChapterSec           = (uint)nudShortChapter.Value;
            Settings.VeryShortChapterSec       = (uint)nudVeryShortChapter.Value;

            bool ck = ckBoxFileAssoc.Checked;

            if ((Settings.FileAssoc ?? false) != ck)
            {
                Settings.FileAssoc = ck;
                new FileAssoc(Settings, this).Update();
            }

            switch (comBoxUpdate.SelectedIndex)
            {
            case 0:
                Settings.OnlineUpdate = null;
                break;

            case 1:
                Settings.OnlineUpdate = false;
                break;

            case 2:
                Settings.OnlineUpdate = true;
                break;
            }


            if (Culture.ChangeLanguage(comBoxLang, Settings))
            {
                Settings.Save();

                if (MsgBox.Show(this, $"{ApplName} {R.MsgLangRestart}", Owner.Text, MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
                {
                    return;
                }

                try {
                    Application.Restart();
                } catch (Exception) { }

                Environment.Exit(0);
            }
        }