public ShipView(ShipOrderVM viewModel) : this() { DataContext = viewModel; shipMoveView = new ShipMoveView(viewModel); shipFCView = new ShipFireControlView(viewModel); shipAttackView = new ShipAttackView(viewModel); cargoView = new CargoView.CargoStorageView(); //cargoView.SetDataContextFrom(viewModel); componentsView.DataContext = new ComponentDesignsListVM(viewModel.SelectedShip); viewModel.ShipList.SelectionChangedEvent += ShipList_SelectionChangedEvent; TabPage tpMove = new TabPage(); tpMove.Content = shipMoveView; tpMove.Text = "Move Orders"; shipview_tabs.Pages.Add(tpMove); TabPage tpFC = new TabPage(); tpFC.Content = shipFCView; tpFC.Text = "Fire Control Configuration"; shipview_tabs.Pages.Add(tpFC); TabPage tpAttack = new TabPage(); tpAttack.Content = shipAttackView; tpAttack.Text = "Attack Orders"; shipview_tabs.Pages.Add(tpAttack); TabPage tpCargo = new TabPage(); tpCargo.Content = cargoView; tpCargo.Text = "Cargo"; shipview_tabs.Pages.Add(tpCargo); TabPage tpComponents = new TabPage(); tpComponents.Content = componentsView; tpComponents.Text = "Components"; shipview_tabs.Pages.Add(tpComponents); }
private void SetViewForViewmodel(IDBViewmodel vm, TabPage tabPage) { if (vm is CargoStorageVM) { CargoView.CargoStorageView view = new CargoView.CargoStorageView(); view.DataContext = vm; tabPage.Content = view; tabPage.Text = "Cargo"; } else if (vm is RefiningVM) { RefinaryView.RefinaryView view = new RefinaryView.RefinaryView(); view.DataContext = vm; tabPage.Content = view; tabPage.Text = "Refinary"; } else if (vm is TranslationMoveVM) { MoveOrderViews.TranslateMoveView view = new MoveOrderViews.TranslateMoveView(); view.DataContext = vm; tabPage.Content = view; tabPage.Text = "Helm"; } }