public void AddRecentProject(RecentProjectViewModel project) { if (!RecentProjects.Any(cur => cur.Id == project.Id)) { _RecentProjectsInternal.Insert(0, project); while (RecentProjects.Count > 10) _RecentProjectsInternal.RemoveAt(10); } else { var existingProject = RecentProjects.FirstOrDefault(cur => cur.Id == project.Id); RecentProjectViewModel replacingProject = existingProject.EntityId != null ? existingProject : project; _RecentProjectsInternal.Remove(existingProject); _RecentProjectsInternal.Insert(0, replacingProject); } NotifyPropertyChanged<ReadOnlyCollection<RecentProjectViewModel>>(() => RecentProjects); }
public void RemoveRecentProject(RecentProjectViewModel project) { _RecentProjectsInternal.Remove(project); NotifyPropertyChanged<ReadOnlyCollection<RecentProjectViewModel>>(() => RecentProjects); }