private void numericUpDown1_ValueChanged(object sender, EventArgs e) { if (!_ignoreEvent) { UiCommands.OnOperation(SmartVolManagerPackage.BgMusicManager.ActiveBgMusic.Id, Operation.SetVolumeToNoFade, (mVolumeUpDown.Value / 100.0m).ToString(), false, true); } }
private bool chooseSelected() { try { if (mSoundTree.SelectedNode == null) { return(false); } Cursor.Current = Cursors.WaitCursor; if ((mSoundTree.SelectedNode.Parent != null) && (mSoundTree.SelectedNode.Parent.Text == "Recent Sounds")) { SoundPlayerInfo soundInfo = getRecentByName((string)mSoundTree.SelectedNode.Tag); if (soundInfo.Name == "System Sounds") { MessageBox.Show("You cannot set this sound as your background music."); Cursor.Current = Cursors.Default; return(false); } soundInfo = makeSelectedAFavorite(); UiCommands.OnOperation(soundInfo.Id, Operation.ChangeMusic, "", false, true); UpdateBgMusicUI(); refresh(); } else if ((mSoundTree.SelectedNode.Parent != null) && (mSoundTree.SelectedNode.Parent.Text == "Favorites")) { long musicId = long.Parse((string)mSoundTree.SelectedNode.Tag); SoundPlayerInfo soundInfo = SmartVolManagerPackage.BgMusicManager.FindPlayerInfo(musicId); if (soundInfo.Name == "System Sounds") { MessageBox.Show("You cannot set this sound as your background music."); Cursor.Current = Cursors.Default; return(false); } UiCommands.OnOperation(musicId, Operation.ChangeMusic, "", false, true); UpdateBgMusicUI(); } } catch (Exception ex) { MuteFm.SmartVolManagerPackage.SoundEventLogger.LogException(ex); } Cursor.Current = Cursors.Default; return(true); }
private void mResetSettingsMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "Are you sure you want to reset mute.fm settings (both preferences and sound information) to the factory default?", Constants.ProgramName, MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { UiCommands.OnOperation(Operation.Stop); try { System.IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\mute.fm\config.json"); } catch (Exception ex) { SmartVolManagerPackage.SoundEventLogger.LogException(ex); } /* // Not possible without closing down awesomium * if (MessageBox. Show("Do you also want to clear the mute.fm browser cache? This will free up space but may require setting up accounts for music services again.", Constants.ProgramName, MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) * { * try * { * System.IO.Directory.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\" + Constants.ProgramName + @"\Awesomium", true); * } * catch (Exception ex) * { * SmartVolManagerPackage.SoundEventLogger.LogException(ex); * } * }*/ SmartVolManagerPackage.BgMusicManager.Init(true); reloadIconsToolStripMenuItem_Click(null, null); // Regenerate icons just in case MessageBox.Show(null, "Settings were reset! Press OK to quit and then rerun to experience original settings.", Constants.ProgramName); UiCommands.mPlayerForm.Exit(false); //UiCommands.OnOperation(Operation.Play); //UiCommands.UpdateUiForState(); } }
private void mUncheckButton_Click(object sender, EventArgs e) { UiCommands.OnOperation(_musicId, Operation.IgnoreForAutoMute, "", false, true); }
private void mUnmuteButton_Click(object sender, EventArgs e) { UiCommands.OnOperation(_musicId, Operation.Unmute, "", false, true); }
private void mFgMusicIcon_Click(object sender, EventArgs e) { UiCommands.OnOperation(_musicId, Operation.Show, "", false, true); }
private void mBgMusicIcon_Click(object sender, EventArgs e) { UiCommands.OnOperation(Operation.Show); }
private void mUnmuteButton_Click(object sender, EventArgs e) { UiCommands.OnOperation(Operation.Unmute); }
private void mStopButton_Click(object sender, EventArgs e) { UiCommands.OnOperation(Operation.Stop); }
private void mPlayButton_Click(object sender, EventArgs e) { UiCommands.OnOperation(Operation.Play); }
private void mNextTrackButton_Click(object sender, EventArgs e) { UiCommands.OnOperation(Operation.NextTrack); }
private void mDislikeButton_Click(object sender, EventArgs e) { UiCommands.OnOperation(Operation.Dislike); }
private static void Hook_KeyPressed(object sender, KeyPressedEventArgs e) { if (DateTime.Now.Subtract(_lastKeyPress).TotalMilliseconds < 200) // Don't allow rapid keypresses { return; } _lastKeyPress = DateTime.Now; long key = (long)e.Key; if (0 != (e.Modifier & ModifierKeys.Alt)) { key |= (long)Keys.Alt; } if (0 != (e.Modifier & ModifierKeys.Control)) { key |= (long)Keys.Control; } if (0 != (e.Modifier & ModifierKeys.Shift)) { key |= (long)Keys.Shift; } if (0 != (e.Modifier & ModifierKeys.Win)) { key |= (long)Keys.LWin; } for (int i = 0; i < SmartVolManagerPackage.BgMusicManager.MuteFmConfig.Hotkeys.Length; i++) { Hotkey hotkey = SmartVolManagerPackage.BgMusicManager.MuteFmConfig.Hotkeys[i]; if (hotkey.Key == key) { switch (hotkey.Name.ToLower()) { case "play": UiCommands.OnOperation(Operation.Play); break; case "pause": UiCommands.OnOperation(Operation.Pause); break; case "stop": UiCommands.OnOperation(Operation.Stop); break; case "mute": UiCommands.OnOperation(Operation.Mute); break; case "unmute": UiCommands.OnOperation(Operation.Unmute); break; case "previous track": UiCommands.OnOperation(Operation.PrevTrack); break; case "next track": UiCommands.OnOperation(Operation.NextTrack); break; case "show": UiCommands.OnOperation(Operation.Show); break; case "toggle muting music/videos": // Could add this to enumeration SmartVolManagerPackage.BgMusicManager.ToggleFgMute(); UiCommands.OnOperation(Operation.Restore); break; default: break; } } } }