private void AddToTable(Table table, LabelledEntryWidget w, uint l, uint r, uint t, uint b) { table.Attach(w, l, r, t, b, 0, 0, 4, 20); }
public AutoRunConfigView(IAutoParameterListener listener, AutoParameters ap) : base(WindowType.Toplevel) { _listener = listener; Title = "Auto Sequence Config"; //SetSizeRequest(950, 350); SetPosition(WindowPosition.Center); _startDelay = CreateWidget("Start Delay [ms]", GetValueString(ap.StartDelay)); _ignitionTime = CreateWidget("Ignition Time [ms]", GetValueString(ap.IgnitionTime)); _preStage1Time = CreateWidget("Pre Stage 1 Time [ms]", GetValueString(ap.PreStage1Time)); _preStage2MaxTime = CreateWidget("Pre Stage 2 Max Time [ms]", GetValueString(ap.PreStage2MaxTime)); _preStage2StableTime = CreateWidget("Pre Stage 2 Stable Time [ms]", GetValueString(ap.PreStage2StableTime)); _rampUpStableTime = CreateWidget("Ramp Up Stable Time [ms]", GetValueString(ap.RampUpStableTime)); _rampUpMaxTime = CreateWidget("Ramp Up Max Time [ms]", GetValueString(ap.RampUpMaxTime)); _burnTime = CreateWidget("Burn Time [ms]", GetValueString(ap.BurnTime)); _shutdown1Time = CreateWidget("Shutdown 1 Time [ms]", GetValueString(ap.Shutdown1Time)); _shutdown2Time = CreateWidget("Shutdown 2 Time [ms]", GetValueString(ap.Shutdown2Time)); _flushTime = CreateWidget("Flush Time [ms]", GetValueString(ap.FlushTime)); _preStage1FuelPosition = CreateWidget("Pre Stage 1 Fuel Pos. [%]", GetValueString(ap.PreStage1FuelPosition)); _preStage2FuelPosition = CreateWidget("Pre Stage 2 Fuel Pos. [%]", GetValueString(ap.PreStage2FuelPosition)); _rampUpFuelPosition = CreateWidget("Ramp Up Fuel Pos. [%]", GetValueString(ap.RampUpFuelPosition)); _shutdown1FuelPosition = CreateWidget("Shutdown 1 Fuel Pos. [%]", GetValueString(ap.Shutdown1FuelPosition)); _shutdown2FuelPosition = CreateWidget("Shutdown 2 Fuel Pos. [%]", GetValueString(ap.Shutdown2FuelPosition)); _preStage1OxidPosition = CreateWidget("Pre Stage 1 Oxid Pos. [%]", GetValueString(ap.PreStage1OxidPosition)); _preStage2OxidPosition = CreateWidget("Pre Stage 2 Oxid Pos. [%]", GetValueString(ap.PreStage2OxidPosition)); _rampUpOxidPosition = CreateWidget("Ramp Up Oxid Pos. [%]", GetValueString(ap.RampUpOxidPosition)); _shutdown1OxidPosition = CreateWidget("Shutdown 1 Oxid Pos. [%]", GetValueString(ap.Shutdown1OxidPosition)); _shutdown2OxidPosition = CreateWidget("Shutdown 2 Oxid Pos. [%]", GetValueString(ap.Shutdown2OxidPosition)); _preStage2StablePressure = CreateWidget("Pre Stage 2 Stable Pres. [bara]", GetValueString(ap.PreStage2StablePressure)); _chamberPressurePressure = CreateWidget("Cham. Pres. Thres. [bara]", GetValueString(ap.ChamberPressurePressure)); _emptyFuelFeedPressureThreshold = CreateWidget("Empty Fuel Pres. [bara]", GetValueString(ap.EmptyFuelFeedPressureThreshold)); _emtpyOxidFeedPressureThreshold = CreateWidget("Empty Oxid Pres. [bara]", GetValueString(ap.EmptyOxidFeedPressureThreshold)); _btnAutoRunConfigSave = new Button { Label = "Save", WidthRequest = 80, HeightRequest = 40 }; /* Table How To ;) * * 0 1 2 * 0+----------+----------+ * | | | * 1+----------+----------+ * | | | * 2+----------+----------+ * */ Table layout = new Table(6, 7, false); AddToTable(layout, _startDelay, 0, 1, 0, 1); AddToTable(layout, _ignitionTime, 0, 1, 1, 2); AddToTable(layout, _preStage1Time, 0, 1, 2, 3); AddToTable(layout, _preStage1FuelPosition, 0, 1, 3, 4); AddToTable(layout, _preStage1OxidPosition, 0, 1, 4, 5); AddToTable(layout, _preStage2MaxTime, 1, 2, 0, 1); AddToTable(layout, _preStage2StableTime, 1, 2, 1, 2); AddToTable(layout, _preStage2FuelPosition, 1, 2, 2, 3); AddToTable(layout, _preStage2OxidPosition, 1, 2, 3, 4); AddToTable(layout, _preStage2StablePressure, 1, 2, 4, 5); AddToTable(layout, _rampUpMaxTime, 2, 3, 0, 1); AddToTable(layout, _rampUpStableTime, 2, 3, 1, 2); AddToTable(layout, _rampUpFuelPosition, 2, 3, 2, 3); AddToTable(layout, _rampUpOxidPosition, 2, 3, 3, 4); AddToTable(layout, _burnTime, 3, 4, 0, 1); AddToTable(layout, _chamberPressurePressure, 3, 4, 1, 2); AddToTable(layout, _emptyFuelFeedPressureThreshold, 3, 4, 2, 3); AddToTable(layout, _emtpyOxidFeedPressureThreshold, 3, 4, 3, 4); AddToTable(layout, _shutdown1Time, 4, 5, 0, 1); AddToTable(layout, _shutdown1FuelPosition, 4, 5, 1, 2); AddToTable(layout, _shutdown1OxidPosition, 4, 5, 2, 3); AddToTable(layout, _shutdown2Time, 5, 6, 0, 1); AddToTable(layout, _shutdown2FuelPosition, 5, 6, 1, 2); AddToTable(layout, _shutdown2OxidPosition, 5, 6, 2, 3); AddToTable(layout, _flushTime, 6, 7, 0, 1); layout.Attach(_btnAutoRunConfigSave, 6, 7, 5, 6, 0, 0, 20, 20); _btnAutoRunConfigSave.Pressed += getTimings; Add(layout); ShowAll(); }
public SessionSettingsView(ISessionSettingsViewListener handler, Session session) : base(WindowType.Toplevel) { _listener = handler; _session = session; SetSizeRequest(400, 650); SetPosition(WindowPosition.Center); //Build(); Title = "Session Settings"; /* * ------------------------------------------- Machine Page */ VBox machinePage = new VBox(false, 20); // Log file path _chosenFilePath = PreferenceManager.Manager.Preferences.System.LogFilePath ?? _chosenFilePath; HBox filepathContainer = new HBox(false, 0); _lblFilepath = new Label(); SetFilePathLabel(_chosenFilePath); _btnChooseFilePath = new Button { Label = "Choose" }; _btnChooseFilePath.Pressed += ChooseFilePathPressed; filepathContainer.PackStart(_btnChooseFilePath, false, false, 10); filepathContainer.PackStart(_lblFilepath, false, false, 0); // Select serial port HBox portBox = new HBox(false, 10); _portDropdown = new DropdownWidget(null); PortRefreshPressed(null, null); if (PreferenceManager.Manager.Preferences.System.Serial.PortName != null) { _portDropdown.Set(PreferenceManager.Manager.Preferences.System.Serial.PortName); } _btnPortRefresh = new Button { Label = "Refresh" }; _btnPortRefresh.Pressed += PortRefreshPressed; portBox.PackStart(_portDropdown, false, false, 10); portBox.PackStart(_btnPortRefresh, false, false, 0); _baudRateDropdown = new DropdownWidget("Baud rate", bauds.Select(x => x.ToString()).ToArray()); _baudRateDropdown.Set(PreferenceManager.Manager.Preferences.System.Serial.BaudRate.ToString()); _chkSettingsOnStartup = new LabelledCheckboxWidget { LabelText = "Show settings on startup", Checked = PreferenceManager.Manager.Preferences.Visual.ShowSettingsOnStartup }; machinePage.PackStart(new Label("Serial port:"), false, false, 10); machinePage.PackStart(portBox, false, false, 0); machinePage.PackStart(_baudRateDropdown, false, false, 10); machinePage.PackStart(new Label("Save path:"), false, false, 0); machinePage.PackStart(filepathContainer, false, false, 0); machinePage.PackStart(_chkSettingsOnStartup, false, false, 20); /* * ------------------------------------------- Visual Page */ VBox visualPage = new VBox(false, 10); // Component limits _session.Mapping.Components().ForEach((Component obj) => { if (obj is IWarningLimits sc) { _componentWidgets.Add(new ComponentSettingWidget(obj)); } }); VBox componentSections = new VBox(false, 20); componentSections.PackStart(LayoutLimitsSection(_componentWidgets.FindAll((ComponentSettingWidget obj) => obj.Component is PressureComponent)), false, false, 0); componentSections.PackStart(LayoutLimitsSection(_componentWidgets.FindAll((ComponentSettingWidget obj) => obj.Component is TemperatureComponent)), false, false, 0); componentSections.PackStart(LayoutLimitsSection(_componentWidgets.FindAll((ComponentSettingWidget obj) => obj.Component is LoadComponent)), false, false, 0); componentSections.PackStart(LayoutLimitsSection(_componentWidgets.FindAll((ComponentSettingWidget obj) => obj.Component is VoltageComponent)), false, false, 0); componentSections.PackStart(LayoutLimitsSection(_componentWidgets.FindAll((ComponentSettingWidget obj) => obj.Component is FlowComponent)), false, false, 0); ScrolledWindow scrolledWindow = new ScrolledWindow { HeightRequest = 550 }; //scrolledWindow.SetPolicy(PolicyType.Never, PolicyType.Automatic); scrolledWindow.AddWithViewport(componentSections); visualPage.PackStart(scrolledWindow, false, false, 0); /* * ------------------------------------------- Fluid Page */ VBox fluidPage = new VBox(false, 20); oxidValveCoefficient = new LabelledEntryWidget() { LabelText = "Oxidizer valve flow coefficient (CV)", EntryText = FloatValue(PreferenceManager.Manager.Preferences.Fluid.Oxid.CV) }; oxidDensity = new LabelledEntryWidget() { LabelText = "Oxidizer density [kg/m^3]", EntryText = FloatValue(PreferenceManager.Manager.Preferences.Fluid.Oxid.Density) }; fuelValveCoefficient = new LabelledEntryWidget() { LabelText = "Fuel valve flow coefficient (CV)", EntryText = FloatValue(PreferenceManager.Manager.Preferences.Fluid.Fuel.CV) }; fuelDensity = new LabelledEntryWidget() { LabelText = "Fuel density [kg/m^3]", EntryText = FloatValue(PreferenceManager.Manager.Preferences.Fluid.Fuel.Density) }; todaysPressure = new LabelledEntryWidget() { LabelText = "Today's pressure [bar]", EntryText = FloatValue(PreferenceManager.Manager.Preferences.Fluid.TodaysPressure) }; showAbsolutePressure = new LabelledRadioWidget { LabelText = "Pressure measure: ", ShowAbsolutePressure = PreferenceManager.Manager.Preferences.Visual.ShowAbsolutePressure }; fluidPage.PackStart(new Label("Fluid system values"), false, false, 0); fluidPage.PackStart(oxidValveCoefficient, false, false, 0); fluidPage.PackStart(oxidDensity, false, false, 0); fluidPage.PackStart(fuelValveCoefficient, false, false, 0); fluidPage.PackStart(fuelDensity, false, false, 0); fluidPage.PackStart(new Label("Pressure properties"), false, false, 0); fluidPage.PackStart(todaysPressure, false, false, 0); fluidPage.PackStart(showAbsolutePressure, false, false, 0); /* * ------------------------------------------- Overall */ VBox container = new VBox(false, 10); Notebook notebook = new Notebook { machinePage, visualPage, fluidPage }; notebook.SetTabLabelText(machinePage, "Machine"); notebook.SetTabLabelText(visualPage, "Visuals"); notebook.SetTabLabelText(fluidPage, "Fluid system"); // Bottom save container HBox cancelSaveContainer = new HBox(false, 0); _btnSave = new Button { Label = "Save", WidthRequest = 60, HeightRequest = 40 }; _btnSave.Pressed += SavePressed; cancelSaveContainer.PackEnd(_btnSave, false, false, 10); container.PackStart(notebook, false, false, 0); container.PackStart(cancelSaveContainer, false, false, 0); Add(container); Resizable = false; ShowAll(); }