示例#1
0
 void webControl1_AddressChanged(object sender, Awesomium.Core.UrlEventArgs e)
 {
     this.mUrlText.Text = webControl1.Source.ToString();
     if (webControl1.Source.ToString() == "about:blank")
     {
         return;
     }
     SmartVolManagerPackage.BgMusicManager.ActiveBgMusic.MostRecentUrl = webControl1.Source.ToString();
     MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
 }
示例#2
0
 private void showEditDialog(SoundPlayerInfo playerInfo, bool editable)
 {
     if (playerInfo != null)
     {
         MusicInfoEditForm form = new MusicInfoEditForm(playerInfo, editable);
         form.ShowDialog();
         if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
         {
             MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
         }
     }
 }
示例#3
0
        private void noneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!noneToolStripMenuItem.Checked)
            {
                noneToolStripMenuItem.Checked            = true;
                growlToolStripMenuItem.Checked           = false;
                systrayBalloonsToolStripMenuItem.Checked = false;
                SmartVolManagerPackage.BgMusicManager.MuteFmConfig.GeneralSettings.ShowBalloonNotifications = false;

                MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
                GrowlInstallHelper.GrowlInstallHelper.SetForceGrowl(false);
            }
        }
示例#4
0
        private void mOkButton_Click(object sender, EventArgs e)
        {
            List <Hotkey> hotkeyList = new List <Hotkey>();

            for (int i = 0; i < _hotkeyControls.Count; i++)
            {
                Hotkey hotkey = new Hotkey(_hotkeyControls[i].HotkeyName, _hotkeyControls[i].HotkeyEnabled, _hotkeyControls[i].HotkeyKey);
                hotkeyList.Add(hotkey);
            }
            SmartVolManagerPackage.BgMusicManager.MuteFmConfig.Hotkeys = hotkeyList.ToArray();
            MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
            this.Close();
        }
示例#5
0
        private void mDeleteButton_Click(object sender, EventArgs e)
        {
            if ((mSoundTree.SelectedNode != null) && (mSoundTree.SelectedNode.Tag != null))
            {
                if (long.Parse((string)mSoundTree.SelectedNode.Tag) == SmartVolManagerPackage.BgMusicManager.MuteFmConfig.GetActiveBgMusic().Id)
                {
                    MessageBox.Show(this, "Cannot delete current background music.", Constants.ProgramName);
                    return;
                }

                MuteFmConfigUtil.RemoveBgMusic(long.Parse((string)mSoundTree.SelectedNode.Tag), SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
                MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);

                refresh();
            }
        }
示例#6
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();
        }
示例#7
0
 private void notifyWhenNoMusicToPlayToolStripMenuItem_Click(object sender, EventArgs e)
 {
     notifyWhenNoMusicToPlayToolStripMenuItem.Checked = !notifyWhenNoMusicToPlayToolStripMenuItem.Checked;
     SmartVolManagerPackage.BgMusicManager.MuteFmConfig.GeneralSettings.NotifyWhenNoMusicToPlay = notifyWhenNoMusicToPlayToolStripMenuItem.Checked;
     MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
 }
示例#8
0
 private void mMuteDuringVideosCheckbox_CheckedChanged(object sender, EventArgs e)
 {
     SmartVolManagerPackage.BgMusicManager.MuteFmConfig.GeneralSettings.AutoMuteEnabled = mMuteDuringVideosCheckbox.Checked;
     MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
 }
示例#9
0
 private void notifyAboutProgramUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     notifyAboutProgramUpdatesToolStripMenuItem.Checked = !notifyAboutProgramUpdatesToolStripMenuItem.Checked;
     SmartVolManagerPackage.BgMusicManager.MuteFmConfig.GeneralSettings.NotifyAboutUpdates = notifyAboutProgramUpdatesToolStripMenuItem.Checked;
     MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
 }
示例#10
0
 private void playMusicOnStartupToolStripMenuItem_Click(object sender, EventArgs e)
 {
     playMusicOnStartupToolStripMenuItem.Checked = !playMusicOnStartupToolStripMenuItem.Checked;
     SmartVolManagerPackage.BgMusicManager.MuteFmConfig.GeneralSettings.PlayMusicOnStartup = playMusicOnStartupToolStripMenuItem.Checked;
     MuteFmConfigUtil.Save(SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
 }
示例#11
0
        public static void OnOperation(long musicId, Operation op, string param, bool ignoreCommand, bool track)
        {
            if (Program.LicenseExpired == true)
            {
                return;
            }

            if (MuteFm.UiPackage.WinSoundServerSysTray.Instance == null)
            {
                return;
            }

            MuteFm.UiPackage.WinSoundServerSysTray.Instance.Invoke((System.Windows.Forms.MethodInvoker) delegate
            {
                if ((musicId == SmartVolManagerPackage.BgMusicManager.ActiveBgMusic.Id) && ((op == Operation.Play) || (op == Operation.Unmute)))
                {
                    MuteFm.SmartVolManagerPackage.BgMusicManager.PerformOperation(musicId, Operation.ClearHistory, "", ignoreCommand);
                }

                if (op == Operation.Show)
                {
                    System.Threading.Thread.Sleep(250); // Ensure that window is shown after click sets focus to browser (if run in extension); was 750
                }
                // Queue up background music if a foreground sound is active
                // If user clicked play or unmute for bgmusic and music is automuted and countdown hasn't started, then note that user wants bgmusic and smartmute it but don't show fade messages or let it make sound [i.e. queue it up]
                if ((musicId == SmartVolManagerPackage.BgMusicManager.ActiveBgMusic.Id) &&
                    (((op == Operation.Play) || (op == Operation.Unmute)) &&
                     (SmartVolManagerPackage.BgMusicManager.EffectiveSilenceDateTime == DateTime.MaxValue) &&
                     (!SmartVolManagerPackage.BgMusicManager.BgMusicHeard) &&
                     (SmartVolManagerPackage.BgMusicManager.MuteFmConfig.GeneralSettings.AutoMuteEnabled)))
                {
                    MuteFm.SmartVolManagerPackage.BgMusicManager.UserWantsBgMusic = true;
                    MuteFm.SmartVolManagerPackage.BgMusicManager.PerformOperation(musicId, Operation.AutoMutedPlay, param, ignoreCommand);
                    return;
                }
                else
                {
                    int x = 0;
                    x++;
                }

                MuteFm.SmartVolManagerPackage.BgMusicManager.PerformOperation(musicId, op, param, ignoreCommand);

                if ((musicId == SmartVolManagerPackage.BgMusicManager.ActiveBgMusic.Id) || (op == Operation.ChangeMusic))
                {
                    // Extra logic because we know user chose to perform the operation
                    switch (op)
                    {
                    case Operation.Play:
                        SmartVolManagerPackage.BgMusicManager.AutoMuted = false;     // TODO
                        MuteFm.SmartVolManagerPackage.BgMusicManager.UserWantsBgMusic = true;
                        if (track)
                        {
                            TrackEvent("Play");
                        }
                        break;

                    case Operation.ChangeMusic:
                        SoundPlayerInfo playerInfo = SmartVolManagerPackage.BgMusicManager.FindPlayerInfo(musicId);
                        if (playerInfo != null)
                        {
                            SmartVolManagerPackage.BgMusicManager.UserMustClickPlay = false;     // reset it
                            if (playerInfo.Id <= 0)
                            {
                                MuteFmConfigUtil.AddSoundPlayerInfo(playerInfo, SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
                                //MixerWebSocketServerHelper.SendCommand("BGMUSICSITES", new GetBgMusicSiteSendData());
                            }

                            SmartVolManagerPackage.BgMusicManager.AlbumArtFileName = "";
                            SmartVolManagerPackage.BgMusicManager.TrackName        = "";

                            if (SmartVolManagerPackage.BgMusicManager.ActiveBgMusic.IsWeb)     // Changed 8/16/13 to only do this if web-based
                            {
                                OnOperation(Operation.Stop);
                            }
                            else
                            {
                                OnOperation(Operation.Pause);
                            }

                            SmartVolManagerPackage.BgMusicManager.ActiveBgMusic  = playerInfo;
                            SmartVolManagerPackage.BgMusicManager.BgMusicPids    = new int[0];
                            SmartVolManagerPackage.BgMusicManager.BgMusicVolInit = false;
                            OnOperation(Operation.Play);
                            UiPackage.UiCommands.UpdateUiForState();

                            // If shows up as a fgmusic but not as a bgmusic, add to bgmusics and remove from fgmusic
                            if (MuteFmConfigUtil.FindBgMusic(playerInfo.UrlOrCommandLine, SmartVolManagerPackage.BgMusicManager.MuteFmConfig) == null)
                            {
                                long tempId = playerInfo.Id;
                                MuteFmConfigUtil.AddSoundPlayerInfo(playerInfo, SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
                                playerInfo.Id = tempId;

                                var fgMusicList = new List <MuteFm.SoundPlayerInfo>(SmartVolManagerPackage.BgMusicManager.FgMusics);
                                fgMusicList.Remove(playerInfo);
                                SmartVolManagerPackage.BgMusicManager.FgMusics = fgMusicList.ToArray();
                            }

                            // Save current music as new default
                            MuteFm.SmartVolManagerPackage.BgMusicManager.MuteFmConfig.ActiveBgMusicId = musicId;
                            MuteFmConfigUtil.Save(MuteFm.SmartVolManagerPackage.BgMusicManager.MuteFmConfig);
                        }
                        break;

                    case Operation.Stop:
                        MuteFm.SmartVolManagerPackage.BgMusicManager.UserWantsBgMusic = false;
                        if (_autoShowAfterPlayWorker != null)
                        {
                            _autoShowAfterPlayWorker.CancelAsync();
                            _autoShowAfterPlayWorker = null;
                        }
                        break;

                    case Operation.Pause:

                    case Operation.Mute:
                        MuteFm.SmartVolManagerPackage.BgMusicManager.UserWantsBgMusic = false;

                        _autoShowAfterPlayWorker = new System.ComponentModel.BackgroundWorker();
                        _autoShowAfterPlayWorker.WorkerSupportsCancellation = true;
                        _autoShowAfterPlayWorker.DoWork += new DoWorkEventHandler(_isPausing_DoWork);
                        _autoShowAfterPlayWorker.RunWorkerAsync();

                        //MuteApp.SmartVolManagerPackage.BgMusicManager.PerformOperation(Operation.ClearHistory);
                        break;

                    case Operation.Unmute:
                        MuteFm.SmartVolManagerPackage.BgMusicManager.UserWantsBgMusic = true;
                        break;

                    case Operation.Exit:
                        Exit();
                        break;
                    }
                }
            });
            if (op == Operation.Exit)
            {
                Exit();

                /*//UiPackage.UiCommands.SetTopText("Exiting mute.fm...", false);
                 * //System.Threading.Thread.Sleep(3000);
                 * WebBgMusicForm.Visible = false;
                 * WebBgMusicForm.Close();
                 * UiPackage.WinSoundServerSysTray.Instance.Close();
                 * Environment.Exit(0);
                 * //Application.Exit();*/
            }
        }