public ComponentViewModel(AbstractBuildable component)
 {
     Component = component;
     if (component.BuildingsCapabilities!=null)
     {
         BuildingCapabilitiesVMs = new ObservableCollection<BuildingCapabilityViewModel>();
         foreach (var capability in component.BuildingsCapabilities)
         {
             var capabilityVM = new BuildingCapabilityViewModel(capability);
             BuildingCapabilitiesVMs.Add(capabilityVM);
         }
     }
     if (component.UnitsCapabilities != null)
     {
         UnitsCapabilitiesVMs = new ObservableCollection<BuildingCapabilityViewModel>();
         foreach (var capability in component.UnitsCapabilities)
         {
             var capabilityVM = new BuildingCapabilityViewModel(capability);
             UnitsCapabilitiesVMs.Add(capabilityVM);
         }
     }
     Click = new DelegateCommand<ComponentViewModel>(OnComponentSelected);
 }
Пример #2
0
 public void AddComponent(AbstractBuildable component)
 {
     Components.Add(component);
 }