/// <summary> /// Constructor /// </summary> internal MainWindowView(MainWindowModel m, SettingsCallback settings, ControlCallback control, UnityAction close) : base( CommonWindowProperties.mainListMinWidth + 20, // min width CommonWindowProperties.mainListMinHeight, // min height CommonWindowProperties.mainWindowSpacing, // spacing CommonWindowProperties.mainElementPadding, // padding TextAnchor.UpperLeft // text anchor ) { model = m; settingsCallback = settings; controlCallback = control; closeCallback = close; // Filter AddChild(new DialogGUIHorizontalLayout( new DialogGUIToggle(model.GetActiveControllersToggleState(), Localizer.Format("#LOC_BV_ActiveControllers"), model.ActiveControllersChecked, 140f), new DialogGUIToggle(model.GetDisabledControllersToggleState(), Localizer.Format("#LOC_BV_DisabledControllers"), model.DisabledControllersChecked, 140f), new DialogGUIFlexibleSpace(), new DialogGUIButton(model.GetControlButtonText, ToggleControl, model.ControlButtonCanBeEnabled, 150f, CommonWindowProperties.buttonHeight, false, CommonWindowProperties.ActiveSkin.button) )); // Column headers AddChild(new DialogGUIHorizontalLayout( new DialogGUISpace(0f), new DialogGUILabel(Localizer.Format("#LOC_BV_ColumnHeader_Name"), 150f) { guiStyle = CommonWindowProperties.Style_Label_Bold_Left }, new DialogGUISpace(10f), new DialogGUILabel(Localizer.Format("#LOC_BV_ColumnHeader_Status"), 70f) { guiStyle = CommonWindowProperties.Style_Label_Bold_Center }, new DialogGUISpace(10f), new DialogGUILabel(Localizer.Format("#LOC_BV_ColumnHeader_Body"), 60f) { guiStyle = CommonWindowProperties.Style_Label_Bold_Center }, new DialogGUISpace(10f), new DialogGUILabel(Localizer.Format("#LOC_BV_ColumnHeader_Speed"), 60f) { guiStyle = CommonWindowProperties.Style_Label_Bold_Center }, new DialogGUISpace(10f), new DialogGUILabel(Localizer.Format("#LOC_BV_ColumnHeader_Distance"), 90f) { guiStyle = CommonWindowProperties.Style_Label_Bold_Center } )); AddChild(new DialogGUIScrollList(new Vector2(CommonWindowProperties.mainListMinWidth, CommonWindowProperties.mainListMinHeight + 220), false, true, model.GetVesselListLayout())); }
/// <summary> /// Show main window dialog /// </summary> private void ShowMainWindow() { if (MainView == null) { if (MainModel == null) // Create model for the Main View { MainModel = new MainWindowModel(); } MainView = new MainWindowView(MainModel, ToggleSettingsWindow, ToggleControlWindow, () => { appLauncherButton.SetFalse(true); }); MainView.Show(); } }