private void Host_EntryUpdated(object sender, EntryEventArgs e) { var repository = sender as IEntryRepository; if (repository != null) { SaveEntries(repository); } Dispatcher.Invoke(delegate { if (e.Date >= KitchenMenu.StartDate && e.Date <= KitchenMenu.EndDate) { for (int i = 0; i < KitchenMenu.Entries.Count; i++) { if (KitchenMenu.Entries[i].Date == e.Date) { KitchenMenu.Entries[i] = e.Entry.Dated(e.Date); return; } else if (KitchenMenu.Entries[i].Date > e.Date) { KitchenMenu.Entries.Insert(i, e.Entry.Dated(e.Date)); return; } } KitchenMenu.Entries.Add(e.Entry.Dated(e.Date)); } }); }
private void Repository_Updated(object sender, EntryEventArgs e) { EntryUpdated?.Invoke(sender, e); }