Пример #1
0
 public void Click()
 {
     if (!IsEdit)
     {
         newMission.AddObserver(AvailableTeams.Where(x => x.IsSelected).ToList <IMyObserver>());
     }
     else
     {
         toEdit.AddObserver(AvailableTeams.Where(x => x.IsSelected).ToList <IMyObserver>());
     }
     ActualTeams.AddRange(AvailableTeams.Where(x => x.IsSelected).ToList());
     AvailableTeams.RemoveRange(ActualTeams);
     NotifyOfPropertyChange(() => AvailableTeams);
     NotifyOfPropertyChange(() => ActualTeams);
 }
Пример #2
0
 public void Add()
 {
     if (!IsEdit)
     {
         newMission.Name          = Name;
         newMission.Description   = Description;
         newMission.StartTime     = StartTime;
         newMission.EndTime       = EndTime;
         newMission.MissionTypeId = SelectedMissionType?.Id;
         SelectedTeams            = ActualTeams.ToList();
         string x = MissionService.Add(newMission);
         if (x == null)
         {
             MissionService.SetObserversToMission(newMission.Observers, MissionService.GetAll().Last().Id);
             TryClose();
         }
         else
         {
             Error = x;
         }
     }
     else
     {
         toEdit.Name          = Name;
         toEdit.Description   = Description;
         toEdit.StartTime     = StartTime;
         toEdit.EndTime       = EndTime;
         toEdit.MissionTypeId = SelectedMissionType?.Id;
         SelectedTeams        = ActualTeams.ToList();
         string x = MissionService.Edit(toEdit);
         if (x == null)
         {
             MissionService.SetObserversToMission(toEdit.Observers, toEdit.Id);
             TryClose();
         }
         else
         {
             Error = x;
         }
     }
 }
Пример #3
0
 public void ClickBack()
 {
     if (!IsEdit)
     {
         foreach (var item in ActualTeams.Where(x => x.IsSelected).ToList <IMyObserver>())
         {
             newMission.RemoveObserver(item);
         }
     }
     else
     {
         foreach (var item in ActualTeams.Where(x => x.IsSelected).ToList <IMyObserver>())
         {
             toEdit.RemoveObserver(item);
         }
     }
     AvailableTeams.AddRange(ActualTeams.Where(x => x.IsSelected).ToList());
     ActualTeams.RemoveRange(AvailableTeams);
     NotifyOfPropertyChange(() => AvailableTeams);
     NotifyOfPropertyChange(() => ActualTeams);
 }
 private void InitProperties()
 {
     TeamsByLeague = ActualTeams.GroupBy(t => t.LeagueId).Select(t => t.ToList()).ToList();
 }