Beispiel #1
0
        private void reloadIconsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            WebServer.ClearOldEntries(DateTime.Now);

            for (int i = 0; i < SmartVolManagerPackage.BgMusicManager.MuteFmConfig.BgMusics.Length; i++)
            {
                MuteFmConfigUtil.GenerateIconImage(SmartVolManagerPackage.BgMusicManager.MuteFmConfig.BgMusics[i], false);
            }

            mBgMusicIcon.Image = MuteFmConfigUtil.GetImage(MuteFm.SmartVolManagerPackage.BgMusicManager.ActiveBgMusic.Id, 32);
        }
Beispiel #2
0
        public static void ShowSite(string title, string url)
        {
            OnOperation(Operation.Stop);

            MuteFm.SoundPlayerInfo bgm = new MuteFm.SoundPlayerInfo();
            bgm.IsWeb            = true;
            bgm.UrlOrCommandLine = url;
            bgm.Name             = title; // TODO: get title as well and then show domain: title or something similar (like in mutetab)
            bgm.Id = -1;
            MuteFmConfigUtil.GenerateIconImage(bgm, false);

            SmartVolManagerPackage.BgMusicManager.ActiveBgMusic = bgm;
            SmartVolManagerPackage.BgMusicManager.BgMusicPids   = new int[0];

            OnOperation(Operation.Show);
        }
Beispiel #3
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();
        }