public void Unexecute() { // Add the shortcut back to the list (if it hasn't been added again in the meantime). var prefManager = PreferencesManager.Instance(); var bIsShortcutAlready = false; foreach (var sf in prefManager.ShortcutFolders) { if (sf.Location == MShortcut.Location) { bIsShortcutAlready = true; break; } } if (!bIsShortcutAlready) { prefManager.ShortcutFolders.Add(MShortcut); prefManager.Export(); // Refresh the list. MFbUi.ReloadShortcuts(); } }
public void Execute() { var prefManager = PreferencesManager.Instance(); // Parse the list and remove any match. for (var i = prefManager.ShortcutFolders.Count - 1; i >= 0; i--) { if (prefManager.ShortcutFolders[i].Location == MShortcut.Location) { prefManager.ShortcutFolders.RemoveAt(i); } } prefManager.Export(); // Refresh the list. MFbUi.ReloadShortcuts(); }