public static void AddNewEntry(string filename, string filepath, string game, Settings.RecentFileType type) { Settings.RecentFileEntry alreadyExistsEntry = null; if (App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents == null) { App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents = new ObservableCollection <Settings.RecentFileEntry>(); } foreach ( Settings.RecentFileEntry entry in App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents.Where( entry => entry.FileName == filename && entry.FilePath == filepath && entry.FileGame == game)) { alreadyExistsEntry = entry; } if (alreadyExistsEntry == null) { // Add New Entry var newEntry = new Settings.RecentFileEntry { FileGame = game, FileName = filename, FilePath = filepath, FileType = type }; App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents.Insert(0, newEntry); } else { // Move existing Entry App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents.Remove(alreadyExistsEntry); App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents.Insert(0, alreadyExistsEntry); } JumpLists.UpdateJumplists(); }
public static void RemoveEntry(Settings.RecentFileEntry entry) { App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents.Remove(entry); }