public void RepairSets(FocusModel focus, List <FocusModel> fociList)
 {
     //Relative ids
     if (focus.CoordinatesRelativeTo != null)
     {
         CoordinatesRelativeTo = fociList.FirstOrDefault(f => f.UniqueName
                                                         == focus.CoordinatesRelativeTo.UniqueName);
     }
     //Prerequisites
     foreach (PrerequisitesSetModel set in focus.Prerequisite)
     {
         //Add the linked focus
         PrerequisitesSetModel prerequiste = new PrerequisitesSetModel(
             fociList.FirstOrDefault(f => f.UniqueName == set.Focus.UniqueName));
         //Run through all the parents and add them
         foreach (FocusModel parent in set.FociList)
         {
             prerequiste.FociList.Add(
                 fociList.FirstOrDefault(f => f.UniqueName == parent.UniqueName));
         }
         Prerequisite.Add(prerequiste);
     }
     //Mutually exclusives
     foreach (MutuallyExclusiveSetModel set in focus.MutualyExclusive)
     {
         //Create the set with both foci
         MutualyExclusive.Add(new MutuallyExclusiveSetModel(
                                  fociList.FirstOrDefault(f => f.UniqueName == set.Focus1.UniqueName),
                                  fociList.FirstOrDefault(f => f.UniqueName == set.Focus2.UniqueName)));
     }
 }
Пример #2
0
 public void Delete()
 {
     //Kill the focus sets
     foreach (MutuallyExclusiveSet set in MutualyExclusive.ToList())
     {
         set.DeleteSetRelations();
     }
     foreach (PrerequisitesSet set in Prerequisite.ToList())
     {
         set.DeleteSetRelations();
     }
     Messenger.Default.Send(new NotificationMessage(this, "DeleteFocus"));
 }
 public void Delete()
 {
     UndoService.Current[GetUndoRoot()].BeginChangeSetBatch("FullyDeleteFocus", false);
     //Kill the focus sets
     foreach (MutuallyExclusiveSetModel set in MutualyExclusive.ToList())
     {
         set.DeleteSetRelations();
     }
     foreach (PrerequisitesSetModel set in Prerequisite.ToList())
     {
         set.DeleteSetRelations();
     }
     Messenger.Default.Send(new NotificationMessage(this,
                                                    new ViewModelLocator().Main.SelectedTab, "DeleteFocus"));
 }