Exemplo n.º 1
0
 protected virtual void InitViewModels()
 {
     ActionsViewModel = new ActionsViewModel(BaseLayer, ActionErrorCatcher);
     ActionViewModel = new ActionViewModel(CreateActionTemplate(), ActionsViewModel, ActionErrorCatcher);
     EventsViewModel = new EventsViewModel(BaseLayer, EventErrorCatcher);
     EventViewModel = new EventViewModel(CreateEventTemplate(), EventsViewModel, EventErrorCatcher);
     TaskParamsViewModel = new TaskParamsViewModel(BaseLayer, TaskParamErrorCatcher);
     EventsDepActionsViewModel = new EventsDepActionsViewModel(BaseLayer, EventErrorCatcher);
     EventDepActionViewModel = new EventDepActionViewModel(BaseLayer, CreateEventTemplate(), EventsDepActionsViewModel, EventErrorCatcher);
 }
 private int FindIndexInEventViewModels(EventViewModel element)
 {
     for (int i = 0; i < EventViewModels.Count; i++)
         if (EventViewModels[i] == element)
             return i;
     return OUT_OF_RANGE;
 }
 void RenameSimilarEvents(EventViewModel callEventViewModel)
 {
     var simeventslist = SearchSimilarEvents(callEventViewModel.Name.Trim()).ToList();
     foreach (var ev in simeventslist)
     {
         if (EventViewModels[Events.IndexOf(ev)] == callEventViewModel) continue;
         string name = callEventViewModel.Name;
         EventViewModels[Events.IndexOf(ev)].Name = name + "*";
         ev.Name = name + "*";
     }
 }
 public void UpdateEvent(EventViewModel callEventViewModel)
 {
     if (EventViewModels.Count != Events.Count || !EventViewModels.Contains(callEventViewModel)) return;
     int index = EventViewModels.IndexOf(callEventViewModel);
     RenameSimilarEvents(callEventViewModel);
     Events[index].Name = callEventViewModel.Name;
 }