Beispiel #1
0
        private void mOkButton_Click(object sender, EventArgs e)
        {
            if (mMusicInfoNameTextBox.Text.Trim() == "")
            {
                MessageBox.Show(this, "Error: Name not set.");
                return;
            }
            if ((!mWebsiteRadioButton.Checked) && (!System.IO.File.Exists(mMusicInfoFileNameTextBox.Text.Trim())))
            {
                MessageBox.Show(this, "File not found.  Please enter full path and do not include quotes.", Constants.ProgramName);
                return;
            }

            // Update ignoreforautomute
            if (!mWebsiteRadioButton.Checked)
            {
                bool wasIgnoreForAutomute;
                SmartVolManagerPackage.BgMusicManager.IgnoreProcNameForAutomuteDict.TryGetValue(GetProcName(_musicInfo.UrlOrCommandLine), out wasIgnoreForAutomute);
                if ((wasIgnoreForAutomute) && (!mIgnoreAutomuteCheckbox.Checked))
                {
                    // Remove it
                    string procname = GetProcName(_musicInfo.UrlOrCommandLine);
                    SmartVolManagerPackage.BgMusicManager.IgnoreProcNameForAutomuteDict.Remove(procname);
                    MuteFmConfigUtil.InitIgnoreForAutoMute(SmartVolManagerPackage.BgMusicManager.IgnoreProcNameForAutomuteDict, SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
                }
                else if (((!wasIgnoreForAutomute) && (mIgnoreAutomuteCheckbox.Checked)) && (mIgnoreAutomuteCheckbox.Visible = true))
                {
                    // Add it
                    string procname = GetProcName(mMusicInfoFileNameTextBox.Text);
                    SmartVolManagerPackage.BgMusicManager.IgnoreProcNameForAutomuteDict[procname] = true;
                    MuteFmConfigUtil.InitIgnoreForAutoMute(SmartVolManagerPackage.BgMusicManager.IgnoreProcNameForAutomuteDict, SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
                }
            }

            _musicInfo.IsWeb = mWebsiteRadioButton.Checked;
            _musicInfo.Name  = this.mMusicInfoNameTextBox.Text;

            if (_musicInfo.IsWeb)
            {
                _musicInfo.UrlOrCommandLine = this.mWebsiteUrlTextBox.Text.Trim();
                _musicInfo.CommandLineArgs  = "";
            }
            else
            {
                _musicInfo.UrlOrCommandLine = this.mMusicInfoFileNameTextBox.Text.Trim();
                _musicInfo.CommandLineArgs  = this.mProgramArgumentsTextBox.Text;
            }

            if (this.Text == Constants.ProgramName + " - Add Sound Info")
            {
                MuteFmConfigUtil.AddSoundPlayerInfo(_musicInfo, SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
            }

            _musicInfo.OnLoadCommand   = _commands["OnLoad"];
            _musicInfo.PlayCommand     = _commands["Play"];
            _musicInfo.PauseCommand    = _commands["Pause"];
            _musicInfo.PrevSongCommand = _commands["PrevTrack"];
            _musicInfo.NextSongCommand = _commands["NextTrack"];
            _musicInfo.LikeCommand     = _commands["Like"];
            _musicInfo.DislikeCommand  = _commands["Dislike"];
            _musicInfo.StopCommand     = _commands["Stop"];

            _musicInfo.KillAfterAutoMute = mStopIfMutedTooLongCheckbox.Checked;

            MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);

            MuteFmConfigUtil.GenerateIconImage(_musicInfo, true);

            this.Close();
        }