Beispiel #1
0
        private void mDefaultsButton_Click(object sender, EventArgs e)
        {
            string procname = "";

            if (mWebsiteRadioButton.Checked)
            {
                procname = this.mWebsiteUrlTextBox.Text.Trim().TrimEnd('/');
            }
            else
            {
                procname = GetProcName(this.mMusicInfoFileNameTextBox.Text);
            }
            if (MuteFmConfigUtil.hasDefaults(procname))
            {
                SoundPlayerInfo tempMusicInfo = new SoundPlayerInfo();
                if (mWebsiteRadioButton.Checked)
                {
                    tempMusicInfo.UrlOrCommandLine = procname;
                }
                else
                {
                    tempMusicInfo.UrlOrCommandLine = mMusicInfoFileNameTextBox.Text;
                }

                if (this.mWebsiteRadioButton.Checked)
                {
                    MuteFmConfigUtil.InitDefaultsWeb(tempMusicInfo);
                }
                else
                {
                    MuteFmConfigUtil.InitDefaultsProcess(tempMusicInfo, procname);
                }
                _commands["OnLoad"]    = tempMusicInfo.OnLoadCommand;
                _commands["Play"]      = tempMusicInfo.PlayCommand;
                _commands["Pause"]     = tempMusicInfo.PauseCommand;
                _commands["PrevTrack"] = tempMusicInfo.PrevSongCommand;
                _commands["NextTrack"] = tempMusicInfo.NextSongCommand;
                _commands["Like"]      = tempMusicInfo.LikeCommand;
                _commands["Dislike"]   = tempMusicInfo.DislikeCommand;
                _commands["Stop"]      = tempMusicInfo.StopCommand;

                MessageBox.Show(this, "Defaults loaded.", Constants.ProgramName);
                mCommandsListbox_SelectedIndexChanged(null, null);
            }
            else
            {
                MessageBox.Show(this, "No defaults", Constants.ProgramName); // should never see this
            }
        }