Пример #1
0
        private void CargoStorageByTypeVM_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (var item in e.NewItems)
                {
                    KeyValuePair <Entity, PrIwObsList <Entity> > kvp = (KeyValuePair <Entity, PrIwObsList <Entity> >)item;
                    ComponentSpecificDesignVM design = new ComponentSpecificDesignVM(kvp.Key, kvp.Value);
                    DesignStore.Add(design);
                }
            }
            else if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (var item in e.OldItems)
                {
                    Entity key = (Entity)item;
                    foreach (var vmitem in DesignStore.ToArray())
                    {
                        if (vmitem.EntityID == key.Guid)
                        {
                            DesignStore.Remove(vmitem);
                            break;
                        }
                    }
                }
            }


            OnPropertyChanged(nameof(HasComponents));
        }
Пример #2
0
 private void InitEntities()
 {
     foreach (var item in _storageDB.StoredEntities[TypeID])
     {
         ComponentSpecificDesignVM design = new ComponentSpecificDesignVM(item.Key, item.Value);
         DesignStore.Add(design);
     }
     _storageDB.StoredEntities[TypeID].CollectionChanged += CargoStorageByTypeVM_CollectionChanged;
     OnPropertyChanged(nameof(HasComponents));
 }
Пример #3
0
 private void SpecificInstances_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         foreach (var item in e.NewItems)
         {
             KeyValuePair <Entity, PrIwObsList <Entity> > kvp = (KeyValuePair <Entity, PrIwObsList <Entity> >)item;
             var newDesigns = new ComponentSpecificDesignVM(kvp.Key, kvp.Value);
             Designs.Add(newDesigns);
         }
     }
 }