Beispiel #1
0
        internal void Add(ReferentialBase item)
        {
            var type = item.GetType();

            if (!_entities.TryGetValue(type, out TypesIndex types))
            {
                types = new TypesIndex(this);
                _entities.Add(type, types);
            }

            TargetListIndex typeEntity = types.GetByTypename(item.TypeEntity);
            ModelIndex      dic2       = typeEntity.Get(item.TargetName);

            if (dic2.ContainsKey(item.Name))
            {
                var olditem = dic2[item.Name];

                if (olditem is INotifyPropertyChanged n1)
                {
                    n1.PropertyChanged -= N_PropertyChanged;
                }

                dic2.Set(item);
                //PropagateFileChanged(item);
                return;
            }

            dic2.Set(item);
            //PropagateFileChanged(item);

            if (item is INotifyPropertyChanged n2)
            {
                n2.PropertyChanged -= N_PropertyChanged;
            }
        }
Beispiel #2
0
 internal IEnumerable <TargetListIndex> GetTypeNames(TypesIndex item)
 {
     if (this._typeNames.Count == 0)
     {
         foreach (var item2 in item.Values)
         {
             yield return(item2);
         }
     }
     else
     {
         foreach (var type in this._typeNames)
         {
             var t = item.GetIfExistsByTypename(type);
             if (t != null)
             {
                 yield return(t);
             }
         }
     }
 }