/// <summary> /// /// </summary> /// <param name="name"></param> /// <returns></returns> private KeyboardShortcutProfile CreateShortcutProfile(String name = "") { KeyboardShortcutProfile profile = new KeyboardShortcutProfile(); bool copy = false; if (name == "") { // create a "CustomX" name int i=0; bool found; while (true) { i++; found = false; foreach (KeyboardShortcutProfile scp in SettingsManager.ShortcutProfiles) if (scp.Name == U.T("ShortcutCustom") + i.ToString()) found = true; if (found) continue; name = U.T("ShortcutCustom") + i.ToString(); break; } copy = true; } SettingsManager.InitShortcutProfile(profile, name, false); if (copy) // copy shortcuts from current profile { KeyboardShortcutProfile currentProfile = SettingsManager.GetCurrentShortcutProfile(); foreach (KeyboardShortcut sc in currentProfile.Shortcuts) { KeyboardShortcut newSc = SettingsManager.GetKeyboardShortcut(profile, sc.Category, sc.Name); newSc.Keys = sc.Keys; } } SettingsManager.ShortcutProfiles.Add(profile); PrefShortcutProfile.Items.Add(new ComboBoxItem() { Content = profile.Name }); PrefShortcutProfile.SelectedIndex = PrefShortcutProfile.Items.Count - 1; return profile; }
/// <summary> /// /// </summary> /// <param name="profile"></param> /// <param name="category"></param> /// <param name="name"></param> /// <param name="keysAsText"></param> /// <param name="isGlobal"></param> private static void SetKeyboardShortcut(KeyboardShortcutProfile profile, String category, String name, String keysAsText, bool isGlobal = false) { KeyboardShortcut sc = GetKeyboardShortcut(profile, category, name); if (sc == null) { sc = new KeyboardShortcut(); sc.Category = category; sc.Name = name; profile.Shortcuts.Add(sc); } SetKeyboardShortcut(sc, keysAsText, isGlobal); }
/// <summary> /// Initializes a keyboard shortcut profile. /// </summary> /// <param name="profile">The keyboard shortcut profile</param> /// <param name="name">The name of the profile</param> /// <param name="isprotected">Whether or not the profile is protected from changes by user</param> public static void InitShortcutProfile(KeyboardShortcutProfile profile, String name, Boolean isprotected) { profile.Name = name; profile.IsProtected = isprotected; profile.Shortcuts = new List<KeyboardShortcut>(); // set the default shortcuts profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Add track", IsGlobal = false, Keys = "Alt+T" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Add folder", IsGlobal = false, Keys = "Alt+F" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Add playlist", IsGlobal = false, Keys = "Alt+P" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Add radio station", IsGlobal = false, Keys = "Alt+R" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Add app", IsGlobal = false, Keys = "Alt+A" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Generate playlist", IsGlobal = false, Keys = "Alt+G" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Minimize", IsGlobal = false, Keys = "Ctrl+Shift+M" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Restore", IsGlobal = true, Keys = "Ctrl+Shift+R" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Help", IsGlobal = false, Keys = "F1" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Close", IsGlobal = false, Keys = "Ctrl+W" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Video", IsGlobal = false, Keys = "Ctrl+F1" }); // index 10 profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Visualizer", IsGlobal = false, Keys = "Ctrl+F2" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Files", IsGlobal = false, Keys = "Ctrl+F3" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "YouTube", IsGlobal = false, Keys = "Ctrl+F4" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "SoundCloud", IsGlobal = false, Keys = "Ctrl+F5" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Radio", IsGlobal = false, Keys = "Ctrl+F6" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Queue", IsGlobal = false, Keys = "Ctrl+F7" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "History", IsGlobal = false, Keys = "Ctrl+F8" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Playlists", IsGlobal = false, Keys = "Ctrl+F9" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Tracklist", IsGlobal = false, Keys = "Ctrl+T" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Search", IsGlobal = false, Keys = "Ctrl+F" }); // index 20 profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "General preferences", IsGlobal = false, Keys = "Alt+F1" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Music sources", IsGlobal = false, Keys = "Alt+F2" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Services", IsGlobal = false, Keys = "Alt+F3" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Apps", IsGlobal = false, Keys = "Alt+F5" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Keyboard shortcuts", IsGlobal = false, Keys = "Alt+F6" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "About", IsGlobal = false, Keys = "Alt+F7" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Toggle details pane", IsGlobal = false, Keys = "Alt+D" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Toggle menu bar", IsGlobal = false, Keys = "Alt+M" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Create playlist", IsGlobal = false, Keys = "Ctrl+N" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Play or pause", IsGlobal = false, Keys = "Alt+5 (numpad)" }); // index 30 profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Next", IsGlobal = false, Keys = "Alt+6 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Previous", IsGlobal = false, Keys = "Alt+4 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Toggle shuffle", IsGlobal = false, Keys = "Alt+9 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Toggle repeat", IsGlobal = false, Keys = "Alt+7 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Increase volume", IsGlobal = false, Keys = "Alt+8 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Decrease volume", IsGlobal = false, Keys = "Alt+2 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Seek forward", IsGlobal = false, Keys = "Alt+3 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Seek backward", IsGlobal = false, Keys = "Alt+1 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Add bookmark", IsGlobal = false, Keys = "Alt+B" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to previous bookmark", IsGlobal = false, Keys = "Alt+Left" }); // index 40 profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to next bookmark", IsGlobal = false, Keys = "Alt+Right" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to first bookmark", IsGlobal = false, Keys = "Alt+Home" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to last bookmark", IsGlobal = false, Keys = "Alt+End" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 1", IsGlobal = false, Keys = "Alt+1" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 2", IsGlobal = false, Keys = "Alt+2" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 3", IsGlobal = false, Keys = "Alt+3" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 4", IsGlobal = false, Keys = "Alt+4" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 5", IsGlobal = false, Keys = "Alt+5" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 6", IsGlobal = false, Keys = "Alt+6" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 7", IsGlobal = false, Keys = "Alt+7" }); // index 50 profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 8", IsGlobal = false, Keys = "Alt+8" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 9", IsGlobal = false, Keys = "Alt+9" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 10", IsGlobal = false, Keys = "Alt+0" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to current track", IsGlobal = false, Keys = "Alt+C" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to selected track", IsGlobal = false, Keys = "Alt+X" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Play track", IsGlobal = false, Keys = "Enter" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Queue and dequeue", IsGlobal = false, Keys = "Shift+Q" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Open folder", IsGlobal = false, Keys = "Ctrl+L" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Remove", IsGlobal = false, Keys = "Delete" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Remove from harddrive", IsGlobal = false, Keys = "Shift+Delete" }); // index 60 profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Copy", IsGlobal = false, Keys = "Ctrl+C" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Move", IsGlobal = false, Keys = "Ctrl+X" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "View information", IsGlobal = false, Keys = "Ctrl+I" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Share", IsGlobal = false, Keys = "Shift+S" }); }
public static void InitializeShortcutProfiles(List<KeyboardShortcutProfile> profiles) { // Stoffi KeyboardShortcutProfile shortStoffi = new KeyboardShortcutProfile(); InitShortcutProfile(shortStoffi, "Stoffi", true); profiles.Add(shortStoffi); // Stoffi (laptop) KeyboardShortcutProfile shortLaptop = new KeyboardShortcutProfile(); InitShortcutProfile(shortLaptop, "Stoffi (laptop)", true); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Previous", "Ctrl+1"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Play or pause", "Ctrl+2"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Next", "Ctrl+3"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Decrease volume", "Ctrl+4"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Increase volume", "Ctrl+5"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Seek backward", "Ctrl+6"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Seek forward", "Ctrl+7"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Toggle shuffle", "Ctrl+8"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Toggle repeat", "Ctrl+9"); profiles.Add(shortLaptop); // Amarok KeyboardShortcutProfile shortAmarok = new KeyboardShortcutProfile(); InitShortcutProfile(shortAmarok, "Amarok", true); SetKeyboardShortcut(shortAmarok, "Application", "Add track", "Win+A"); SetKeyboardShortcut(shortAmarok, "Application", "Add playlist", "Space"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Play or pause", "Win+X"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Next", "Win+B"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Previous", "Win+Z"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Toggle shuffle", "Ctrl+H"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Increase volume", "Win++ (numpad)"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Decrease volume", "Win+- (numpad)"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Seek forward", "Win+Shift++ (numpad)"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Seek backward", "Win+Shift+- (numpad)"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Jump to current track", "Ctrl+Enter"); SetKeyboardShortcut(shortAmarok, "MainWindow", "Toggle menu bar", "Ctrl+M"); profiles.Add(shortAmarok); // Banshee KeyboardShortcutProfile shortBanshee = new KeyboardShortcutProfile(); InitShortcutProfile(shortBanshee, "Banshee", true); SetKeyboardShortcut(shortBanshee, "Application", "Add track", "Ctrl+I"); SetKeyboardShortcut(shortBanshee, "Application", "Close", "Ctrl+Q"); SetKeyboardShortcut(shortBanshee, "MediaCommands", "Play or pause", "Space"); SetKeyboardShortcut(shortBanshee, "MediaCommands", "Next", "N"); SetKeyboardShortcut(shortBanshee, "MediaCommands", "Previous", "B"); profiles.Add(shortBanshee); // Foobar2000 KeyboardShortcutProfile shortFoobar2000 = new KeyboardShortcutProfile(); InitShortcutProfile(shortFoobar2000, "Foobar2000", true); SetKeyboardShortcut(shortFoobar2000, "Application", "Add track", "Ctrl+O"); SetKeyboardShortcut(shortFoobar2000, "Application", "Add folder", "Ctrl+A"); SetKeyboardShortcut(shortFoobar2000, "Application", "Add playlist", "Ctrl+L"); SetKeyboardShortcut(shortFoobar2000, "Application", "Add radio station", "Ctrl+U"); SetKeyboardShortcut(shortFoobar2000, "MainWindow", "General preferences", "Ctrl+P"); SetKeyboardShortcut(shortFoobar2000, "Track", "View information", "Alt+Enter"); profiles.Add(shortFoobar2000); // iTunes KeyboardShortcutProfile shortiTunes = new KeyboardShortcutProfile(); InitShortcutProfile(shortiTunes, "iTunes", true); SetKeyboardShortcut(shortiTunes, "Application", "Add track", "Ctrl+O"); SetKeyboardShortcut(shortiTunes, "Application", "Add playlist", "Ctrl+P"); SetKeyboardShortcut(shortiTunes, "Application", "Add radio station", "Ctrl+U"); SetKeyboardShortcut(shortiTunes, "MainWindow", "General preferences", "Ctrl+,"); SetKeyboardShortcut(shortiTunes, "MainWindow", "Search", "Ctrl+Alt+F"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Play or pause", "Space"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Increase volume", "Ctrl+Up"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Decrease volume", "Ctrl+Down"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Seek forward", "Ctrl+Alt+Right"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Seek backward", "Ctrl+Alt+Left"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Previous", "Left"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Next", "Right"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Jump to current track", "Ctrl+L"); SetKeyboardShortcut(shortiTunes, "Track", "Open folder", "Ctrl+R"); profiles.Add(shortiTunes); // MusicBee KeyboardShortcutProfile shortMusicBee = new KeyboardShortcutProfile(); InitShortcutProfile(shortMusicBee, "MusicBee", true); SetKeyboardShortcut(shortMusicBee, "MainWindow", "General preferences", "Ctrl+O"); SetKeyboardShortcut(shortMusicBee, "MainWindow", "Create playlist", "Ctrl+Shift+N"); SetKeyboardShortcut(shortMusicBee, "MediaCommands", "Play or pause", "Ctrl+P"); SetKeyboardShortcut(shortMusicBee, "MediaCommands", "Next", "Ctrl+N"); SetKeyboardShortcut(shortMusicBee, "MediaCommands", "Previous", "Ctrl+B"); SetKeyboardShortcut(shortMusicBee, "MediaCommands", "Increase volume", "Ctrl+Up"); SetKeyboardShortcut(shortMusicBee, "MediaCommands", "Decrease volume", "Ctrl+Down"); SetKeyboardShortcut(shortMusicBee, "Track", "Queue and dequeue", "Ctrl+Enter"); SetKeyboardShortcut(shortMusicBee, "Track", "View information", "Alt+E"); profiles.Add(shortMusicBee); // Rythmbox KeyboardShortcutProfile shortRythmbox = new KeyboardShortcutProfile(); InitShortcutProfile(shortRythmbox, "Rythmbox", true); SetKeyboardShortcut(shortRythmbox, "Application", "Close", "Ctrl+Q"); SetKeyboardShortcut(shortRythmbox, "Application", "Add folder", "Ctrl+O"); SetKeyboardShortcut(shortRythmbox, "Application", "Add radio station", "Ctrl+I"); SetKeyboardShortcut(shortRythmbox, "MainWindow", "Search", "Alt+S"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Play or pause", "Ctrl+Space"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Previous", "Alt+Left"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Next", "Alt+Right"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Toggle shuffle", "Ctrl+U"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Toggle repeat", "Ctrl+R"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Jump to current track", "Ctrl+J"); SetKeyboardShortcut(shortRythmbox, "Track", "View information", "Alt+Enter"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Jump to previous bookmark", "Alt+,"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Jump to next bookmark", "Alt+."); profiles.Add(shortRythmbox); // Spotify KeyboardShortcutProfile shortSpotify = new KeyboardShortcutProfile(); InitShortcutProfile(shortSpotify, "Spotify", true); SetKeyboardShortcut(shortSpotify, "MediaCommands", "Play or pause", "Space"); SetKeyboardShortcut(shortSpotify, "MediaCommands", "Next", "Ctrl+Right"); SetKeyboardShortcut(shortSpotify, "MediaCommands", "Previous", "Ctrl+Left"); SetKeyboardShortcut(shortSpotify, "MediaCommands", "Increase volume", "Ctrl+Up"); SetKeyboardShortcut(shortSpotify, "MediaCommands", "Decrease volume", "Ctrl+Down"); SetKeyboardShortcut(shortSpotify, "MainWindow", "Search", "Ctrl+L"); SetKeyboardShortcut(shortSpotify, "MainWindow", "General preferences", "Ctrl+P"); SetKeyboardShortcut(shortSpotify, "Track", "Open folder", "Alt+L"); profiles.Add(shortSpotify); // VLC KeyboardShortcutProfile shortVLC = new KeyboardShortcutProfile(); InitShortcutProfile(shortVLC, "VLC", true); SetKeyboardShortcut(shortVLC, "Application", "Add track", "Ctrl+O"); SetKeyboardShortcut(shortVLC, "Application", "Add folder", "Ctrl+F"); SetKeyboardShortcut(shortVLC, "Application", "Add radio station", "Ctrl+N"); SetKeyboardShortcut(shortVLC, "Application", "Close", "Ctrl+Q"); SetKeyboardShortcut(shortVLC, "MainWindow", "General preferences", "Ctrl+P"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Play or pause", "Space"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Next", "N"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Previous", "P"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Seek backward", "Ctrl+Left"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Seek forward", "Ctrl+Right"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Increase volume", "Ctrl+Up"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Decrease volume", "Ctrl+Down"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Toggle shuffle", "R"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Toggle repeat", "L"); SetKeyboardShortcut(shortVLC, "MainWindow", "Search", "F3"); SetKeyboardShortcut(shortVLC, "MainWindow", "Create playlist", "Ctrl+Alt+P"); profiles.Add(shortVLC); // Winamp KeyboardShortcutProfile shortWinamp = new KeyboardShortcutProfile(); InitShortcutProfile(shortWinamp, "Winamp", true); SetKeyboardShortcut(shortWinamp, "Application", "Minimize", "Alt+M"); SetKeyboardShortcut(shortWinamp, "Application", "Add track", "Ctrl+Alt+L"); SetKeyboardShortcut(shortWinamp, "MainWindow", "History", "Ctrl+H"); SetKeyboardShortcut(shortWinamp, "MainWindow", "General preferences", "Ctrl+P"); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Play or pause", "Ctrl+Alt+Insert", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Next", "Ctrl+Alt+PageDown", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Previous", "Ctrl+Alt+PageUp", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Increase volume", "Ctrl+Alt+Up", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Decrease volume", "Ctrl+Alt+Down", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Seek forward", "Ctrl+Alt+Right", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Seek backward", "Ctrl+Alt+Left", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Toggle shuffle", "S"); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Toggle repeat", "R"); SetKeyboardShortcut(shortWinamp, "Track", "View information", "Alt+3"); SetKeyboardShortcut(shortWinamp, "MainWindow", "Toggle menu bar", "Ctrl+Alt+M"); profiles.Add(shortWinamp); // Windows Media Player KeyboardShortcutProfile shortWMP = new KeyboardShortcutProfile(); InitShortcutProfile(shortWMP, "Windows Media Player", true); SetKeyboardShortcut(shortWMP, "Application", "Add track", "Ctrl+O"); SetKeyboardShortcut(shortWMP, "Application", "Add radio station", "Ctrl+U"); SetKeyboardShortcut(shortWMP, "MainWindow", "Search", "Ctrl+E"); SetKeyboardShortcut(shortWMP, "MainWindow", "Toggle menu bar", "F10"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Play or pause", "Ctrl+P"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Next", "Ctrl+F"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Previous", "Ctrl+B"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Seek forward", "Ctrl+Shift+F"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Seek backward", "Ctrl+Shift+B"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Toggle shuffle", "Ctrl+H"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Toggle repeat", "Ctrl+T"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Increase volume", "F9"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Decrease volume", "F8"); SetKeyboardShortcut(shortWMP, "Track", "View information", "F2"); SetKeyboardShortcut(shortWMP, "MainWindow", "Tracklist", "Ctrl+1"); profiles.Add(shortWMP); }
/// <summary> /// Find a keyboard shortcut inside a profile by looking for its name. /// </summary> /// <param name="profile">The keyboard shortcut profile to look in</param> /// <param name="category">The name of the category of the shortcut</param> /// <param name="name">The name of the shortcut</param> /// <returns>The keyboard shortcut corresponding to the category and name inside the profile</returns> public static KeyboardShortcut GetKeyboardShortcut(KeyboardShortcutProfile profile, String category, String name) { foreach (KeyboardShortcut s in profile.Shortcuts) if (s.Name == name && s.Category == category) return s; return null; }
/// <summary> /// Find a keyboard shortcut inside a profile by looking for its key combination. /// </summary> /// <param name="profile">The keyboard shortcut profile to look in</param> /// <param name="keysAsText">The key combination of the shortcut</param> /// <returns>A corresponding shortcut if found, otherwise null</returns> public static KeyboardShortcut GetKeyboardShortcut(KeyboardShortcutProfile profile, String keysAsText) { if (profile != null) foreach (KeyboardShortcut s in profile.Shortcuts) if (s.Keys == keysAsText) return s; return null; }