private void OnComponentSelected(ComponentViewModel component)
 {
     if (ComponentSelected!=null)
     {
         ComponentSelected.Invoke(this, new ComponentSelectedEventArgs() { ComponentVM = this});
     }
 }
 public BoardViewModel(ObservableCollection<AbstractBuildable> components)
 {
     this.components = components;
     ComponentVMs = new ObservableCollection<ComponentViewModel>();
     components.CollectionChanged += Components_CollectionChanged;
     foreach (var component in components)
     {
         var componentVM = new ComponentViewModel(component);
         componentVM.ComponentSelected += ComponentVM_ComponentSelected;
         ComponentVMs.Add(componentVM);
     }
 }
Example #3
0
 public BoardViewModel(ObservableCollection<AbstractBuildable> components)
 {
     this.components = components;
     ComponentVMs = new ObservableCollection<ComponentViewModel>();
     components.CollectionChanged += Components_CollectionChanged;
     foreach (var component in components)
     {
         var componentVM = new ComponentViewModel(component);
         componentVM.ComponentSelected += ComponentVM_ComponentSelected;
         ComponentVMs.Add(componentVM);
     }
     Click = new DelegateCommand<IInputElement>(OnBoadLeftClick);
 }
Example #4
0
 private void Components_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     foreach (var item in e.NewItems)
     {
         var componentVM = new ComponentViewModel((AbstractBuildable)item);
         componentVM.ComponentSelected += ComponentVM_ComponentSelected;
         ComponentVMs.Add(componentVM);
     }
 }