public async Task <ProjectViewModel> OpenProject(RecentProject t) { var project = await ProjectViewModel.Get(t.Id); await AddToRecentList(project); OnProjectOpened(project); return(project); }
internal async Task AddToRecentList(ProjectViewModel project) { var lst = (from z in RecentProjects where !z.Id.Equals(project.MetaData.Id, StringComparison.InvariantCultureIgnoreCase) select z).ToList(); lst.Insert(0, RecentProject.From(project, DateTime.Now)); RecentProjects = lst; OnPropertyChanged("RecentProjects"); var json = JsonConvert.SerializeObject(lst); await _settingsMgr.SetSettings("recent_projects", json, true); }
internal static RecentProject From(ProjectViewModel project, DateTime lastChange) { var t = new RecentProject() { Id = project.MetaData.Id, LastChange = lastChange, Kind = "", Name = project.MetaData.Name, LastPath = project.MetaData.LastPath }; return(t); }