public GuiWidget GetBaudRateWidget() { FlowLayoutWidget baudRateContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); baudRateContainer.Margin = new BorderDouble(0); List <string> baudRates = new List <string> { "115200", "250000" }; BorderDouble baudRateMargin = new BorderDouble(3, 3, 5, 3); foreach (string baudRate in baudRates) { BaudRateRadioButton baudOption = new BaudRateRadioButton(baudRate); BaudRateButtonsList.Add(baudOption); baudOption.Margin = baudRateMargin; baudOption.HAnchor = HAnchor.ParentLeft; baudOption.TextColor = this.subContainerTextColor; if (this.ActivePrinter.BaudRate == baudRate) { baudOption.Checked = true; } baudRateContainer.AddChild(baudOption); } otherBaudRateRadioButton = new RadioButton(LocalizedString.Get("Other")); otherBaudRateRadioButton.Margin = baudRateMargin; otherBaudRateRadioButton.TextColor = this.subContainerTextColor; baudRateContainer.AddChild(otherBaudRateRadioButton); //See if the baud rate of the current print is in the list of displayed rates, //flag the 'other' option if it is not and prefill the rate. otherBaudRateInput = new MHTextEditWidget(""); otherBaudRateInput.Visible = false; otherBaudRateInput.HAnchor |= HAnchor.ParentLeftRight; if (this.ActivePrinter.BaudRate != null) { if (!baudRates.Contains(this.ActivePrinter.BaudRate.ToString())) { otherBaudRateRadioButton.Checked = true; otherBaudRateInput.Text = this.ActivePrinter.BaudRate.ToString(); otherBaudRateInput.Visible = true; } } baudRateContainer.AddChild(otherBaudRateInput); return(baudRateContainer); }
public GuiWidget GetBaudRateWidget() { FlowLayoutWidget baudRateContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); baudRateContainer.Margin = new BorderDouble(0); List<string> baudRates = new List<string> { "115200", "250000" }; BorderDouble baudRateMargin = new BorderDouble(3, 3, 5, 0); foreach (string baudRate in baudRates) { BaudRateRadioButton baudOption = new BaudRateRadioButton(baudRate); BaudRateButtonsList.Add(baudOption); baudOption.Margin = baudRateMargin; baudOption.TextColor = ActiveTheme.Instance.PrimaryTextColor; if (this.ActivePrinter.BaudRate == baudRate) { baudOption.Checked = true; } baudRateContainer.AddChild(baudOption); } otherBaudRateRadioButton = new RadioButton(LocalizedString.Get("Other")); otherBaudRateRadioButton.Margin = baudRateMargin; otherBaudRateRadioButton.TextColor = ActiveTheme.Instance.PrimaryTextColor; baudRateContainer.AddChild(otherBaudRateRadioButton); //See if the baud rate of the current print is in the list of displayed rates, //flag the 'other' option if it is not and prefill the rate. otherBaudRateInput = new MHTextEditWidget(""); otherBaudRateInput.Visible = false; otherBaudRateInput.HAnchor = HAnchor.ParentLeftRight; if (this.ActivePrinter.BaudRate != null) { if (!baudRates.Contains(this.ActivePrinter.BaudRate.ToString())) { otherBaudRateRadioButton.Checked = true; otherBaudRateInput.Text = this.ActivePrinter.BaudRate.ToString(); otherBaudRateInput.Visible = true; } } baudRateContainer.AddChild(otherBaudRateInput); return baudRateContainer; }