void UpdateBookmarkedVplan() { if (SchoolVplan.Value == null) { return; } List <Change> bookmarkedChanges = new List <Change>(); foreach (Change change in SchoolVplan.Value.Changes) { var bookmark = GetSchoolClassBookmark(change.SchoolClass); if (bookmark != null && bookmark.Bookmarked) { bookmarkedChanges.Add(change); } } var newVplan = new Vplan(SchoolVplan.Value.LastUpdate, bookmarkedChanges); if (!newVplan.Equals(MyVplan.Value)) { MyVplan.Value = newVplan; } }
private void UpdateData(Vplan vplan) { if (vplan == null) { Dates.Value = new Collection <VplanDayViewModel>(); return; } var dayViewModelBuilders = new Dictionary <string, VplanDayViewModelBuilder>(); var lastUpdate = vplan.LastUpdate.ToString("dd.MM.yy hh:mm"); foreach (var item in vplan.Changes) { var date = item.Day.ToString("dd.MM.yy"); VplanDayViewModelBuilder dayViewModelBuilder; if (dayViewModelBuilders.ContainsKey(date)) { dayViewModelBuilder = dayViewModelBuilders[date]; } else { dayViewModelBuilder = new VplanDayViewModelBuilder( item.Day.ToString("dddd"), date, lastUpdate, IsRefreshing, LoadItemsCommand ); dayViewModelBuilders[date] = dayViewModelBuilder; } dayViewModelBuilder.Items.Add(new ChangeViewModel(item)); } var dayViewModels = new Collection <VplanDayViewModel>(); foreach (VplanDayViewModelBuilder builder in dayViewModelBuilders.Values) { dayViewModels.Add(builder.Build()); } Dates.Value = dayViewModels; }
public async Task PersistVplan(Vplan vplan) { await Persist(vplan, VplanFileName, VplanSempahore); }
public Task PersistVplan(Vplan vplan) => Task.CompletedTask;