public void DeleteEvent(object sender, RoutedEventArgs e) { if (_selectedItem > -1) { EventWithParamViewModels.RemoveAt(_selectedItem); _baseLayer.BaseMethods.DeleteEvent(Events[_selectedItem]); Events.RemoveAt(_selectedItem); UpdateEvents(); NavigationWindowShower.IsSaved = false; Sum(); } }
public void UpdateEvent(EventWithParamViewModel callEventViewModel) { if (EventWithParamViewModels.Count != Events.Count || !EventWithParamViewModels.Contains(callEventViewModel)) { return; } int index = EventWithParamViewModels.IndexOf(callEventViewModel); RenameSimilarEvents(callEventViewModel); Events[index].Name = callEventViewModel.Name; Events[index].Probability = callEventViewModel.Probability; NavigationWindowShower.IsSaved = false; }
public void AddEvent(Event ev, EventParam eventParam) { var haveThisEvInEvents = Events.Any(e => e.Name.Trim() == ev.Name.Trim()); if (haveThisEvInEvents) { return; } EventWithParamViewModels.Add(new EventWithParamViewModel(ev, eventParam, this)); Events.Add(ev); eventParam.Event = ev; EventParams.Add(eventParam); _baseLayer.DssDbContext.Events.Local.Add(ev); Sum(); NavigationWindowShower.IsSaved = false; }