コード例 #1
0
 //Copy Constructor
 public TECEquipment(TECEquipment equipmentSource, Dictionary <Guid, Guid> guidDictionary = null,
                     ObservableListDictionary <ITECObject> characteristicReference        = null, TemplateSynchronizer <TECSubScope> ssSynchronizer = null) : this()
 {
     if (guidDictionary != null)
     {
         guidDictionary[_guid] = equipmentSource.Guid;
     }
     foreach (TECSubScope subScope in equipmentSource.SubScope)
     {
         var toAdd = new TECSubScope(subScope, guidDictionary, characteristicReference);
         if (ssSynchronizer != null && ssSynchronizer.Contains(subScope))
         {
             ssSynchronizer.LinkNew(ssSynchronizer.GetTemplate(subScope), toAdd);
         }
         characteristicReference?.AddItem(subScope, toAdd);
         SubScope.Add(toAdd);
     }
     copyPropertiesFromScope(equipmentSource);
 }
コード例 #2
0
        public void LinkNewTest()
        {
            TemplateSynchronizer <TestObject> synchronizer = new TemplateSynchronizer <TestObject>(obj => new TestObject(), obj => { }, (sync, obj1, obj2, e) => { }, new TECScopeTemplates());
            var template = new TestObject();

            synchronizer.NewGroup(template);

            bool changed = false;

            synchronizer.TECChanged += arg =>
            {
                changed = true;
            };

            var existing = new TestObject();

            synchronizer.LinkNew(template, existing);

            Assert.IsTrue(synchronizer.GetFullDictionary()[template].Contains(existing));
            Assert.IsTrue(changed);
        }