Пример #1
0
 /// <summary>
 /// Generically references scope to instances of scope into a dictionary from a guid, guids dictionary
 /// </summary>
 /// <param name="characteristic"></param>
 /// <param name="instances"></param>
 /// <param name="referenceDict"></param>
 /// <param name="characteristicList"></param>
 private static void linkCharacteristicWithInstances(ITECObject characteristic, IList instances,
                                                     Dictionary <Guid, List <Guid> > referenceDict,
                                                     ObservableListDictionary <ITECObject> characteristicList)
 {
     foreach (ITECObject item in instances)
     {
         if (referenceDict[characteristic.Guid].Contains(item.Guid))
         {
             characteristicList.AddItem(characteristic, item);
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Rereferences the objects in a typical, instances scope dictionary after copying a typical system.
 /// </summary>
 /// <param name="characteristic">The typical items (equipment, panels, controllers) in the typical system</param>
 /// <param name="instances">The instances of those items in child system instance</param>
 /// <param name="oldCharacteristicInstances">A previosuly linked scope dictionary, from the original system before copying</param>
 /// <param name="newCharacteristicInstances">The scope dictionary that must be linked</param>
 static private void linkCharacteristicCollections(IList characteristic, IList instances,
                                                   ObservableListDictionary <ITECObject> oldCharacteristicInstances,
                                                   ObservableListDictionary <ITECObject> newCharacteristicInstances)
 {
     foreach (var item in oldCharacteristicInstances.GetFullDictionary())
     {
         foreach (ITECObject charItem in characteristic)
         {
             if (item.Key.Guid == charItem.Guid)
             {
                 foreach (var sub in item.Value)
                 {
                     foreach (ITECObject subInstance in instances)
                     {
                         if (subInstance.Guid == sub.Guid)
                         {
                             newCharacteristicInstances.AddItem(charItem, subInstance);
                         }
                     }
                 }
             }
         }
     }
 }