private void SetViewModel(int oldSelection, int newSelection) { _colonyScreenVM = gameVM.SelectedColonyScreenVM; DataContext = gameVM.SelectedColonyScreenVM; //FacDataGrid.DataStore = _colonyScreenVM.Facilities; PopDataGrid.DataStore = _colonyScreenVM.Species.Cast <object>(); _colonyScreenVM.Species.CollectionChanged += Species_CollectionChanged; MineralDeposits.DataStore = _colonyScreenVM.PlanetMineralDepositVM.MineralDeposits.Values; gameVM.SelectedColonyScreenVM.PlanetMineralDepositVM.PropertyChanged += PlanetMineralDepositVM_PropertyChanged; CargoStorageVM cargoVM = new CargoStorageVM(gameVM); cargoVM.Initialise(_colonyScreenVM._colonyEntity); CargoView.DataContext = cargoVM; //gameVM.SelectedColonyScreenVM.RawMineralStockpileVM.PropertyChanged += RawMineralStockpileVM_PropertyChanged; //RefineryAbilityView = new JobAbilityView(colonyScreenVM.RefineryAbilityVM); RefineryAbilityView.SetViewModel(_colonyScreenVM.RefineryAbilityVM); ConstructionAbilityView.SetViewModel(_colonyScreenVM.ConstructionAbilityVM); //ResearchAbilityView = new ResearchAbilityView(colonyScreenVM.ColonyResearchVM); ResearchAbilityView.SetViewModel(_colonyScreenVM.ColonyResearchVM); }
public void SetDataContextFrom(ShipOrderVM shipOrderVM) { CargoStorageVM vm = new CargoStorageVM(shipOrderVM.GameVM); vm.Initialise(shipOrderVM.SelectedShip); DataContext = vm; }
private void CargoStorageView_DataContextChanged(object sender, EventArgs e) { if (DataContext is CargoStorageVM) { CargoTypes.Items.Clear(); CargoStorageVM dc = (CargoStorageVM)DataContext; foreach (var item in dc.CargoResourceStores) { CargoTypeStoreView typesView = new CargoTypeStoreView(); typesView.DataContext = item; CargoTypes.Items.Add(typesView); } dc.CargoResourceStores.CollectionChanged += CargoStore_CollectionChanged; } }
internal void HardRefresh() { if (_selectedEntity.Entity.HasDataBlob <CargoStorageDB>()) { var storeDB = _selectedEntity.Entity.GetDataBlob <CargoStorageDB>(); _storeVM = new CargoStorageVM(_state.Game.StaticData, storeDB); _storeVM.SetUpdateListner(_selectedEntity.Entity.Manager.ManagerSubpulses); } if (_selectedEntity.Entity.HasDataBlob <RefiningDB>()) { var refinaryDB = _selectedEntity.Entity.GetDataBlob <RefiningDB>(); _refineryVM = new RefiningVM(_state.Game, _selectedEntity.CmdRef, refinaryDB); _refineryVM.SetUpdateListner(_selectedEntity.Entity.Manager.ManagerSubpulses); } _cargoList = new CargoListPannelSimple(_staticData, _selectedEntity); }
internal void HardRefresh() { _factionInfoDB = _uiState.Faction.GetDataBlob <FactionInfoDB>(); if (_selectedEntity.Entity.HasDataBlob <CargoStorageDB>()) { var storeDB = _selectedEntity.Entity.GetDataBlob <CargoStorageDB>(); _storeVM = new CargoStorageVM(_uiState.Game.StaticData, storeDB); _storeVM.SetUpdateListner(_selectedEntity.Entity.Manager.ManagerSubpulses); } if (_selectedEntity.Entity.HasDataBlob <IndustryAbilityDB>()) { _industryDB = _selectedEntity.Entity.GetDataBlob <IndustryAbilityDB>(); _industryPannel = new IndustryPannel2(_uiState, _selectedEntity.Entity, _industryDB); } else { _industryDB = null; _industryPannel = null; } _cargoList = new CargoListPannelSimple(_staticData, _selectedEntity); /* * lock (_factionInfoDB.ComponentDesigns) * { * int num = _factionInfoDB.ComponentDesigns.Count; * _constructableDesigns = new ComponentDesign[num]; * _constructablesNames = new string[num]; * _constructablesIDs = new Guid[num]; * int i = 0; * foreach (var design in _factionInfoDB.ComponentDesigns) * { * _constructableDesigns[i] = design.Value; * _constructablesIDs[i] = design.Key; * _constructablesNames[i] = design.Value.Name; * i++; * } * * * }*/ }