protected void OnComboChanged(object sender, ComboBoxChangedEventArgs args) { if (args.activeText != "New power strip...") { for (int i = 0; i < selectors.Length; ++i) { selectors[i].Unsubscribe(); } powerStripName = args.activeText; GetPowerData(); var ic = IndividualControl.Empty; ic.Group = powerStripName; for (int i = 0; i < selectors.Length; ++i) { ic.Individual = i; selectors[i].Subscribe(ic); } } else { var parent = Toplevel as Window; var numberInput = new TouchNumberInput(false, parent); numberInput.Title = "Address"; numberInput.TextSetEvent += (o, a) => { a.keepText = CardSettingsHelper.OnAddressSetEvent(a.text, ref powerStripName, Driver.Power); if (a.keepText) { combo.comboList.Insert(combo.comboList.Count - 1, powerStripName); foreach (var sel in selectors) { sel.Visible = true; } graphics.Visible = true; combo.Visible = false; combo.Visible = true; sceneTitle = "Power Strip"; GetPowerData(); } }; numberInput.Run(); numberInput.Destroy(); // The number input was canceled if (combo.activeText == "New power strip...") { powerStripName = Driver.Power.firstCard; combo.activeText = powerStripName; GetPowerData(); } } QueueDraw(); }
protected void OnComboChanged(object sender, ComboBoxChangedEventArgs args) { if (args.activeText != "New card...") { card = args.activeText; GetCardData(); } else { var parent = Toplevel as Window; var numberInput = new TouchNumberInput(false, parent); numberInput.Title = "Address"; numberInput.TextSetEvent += (o, a) => { a.keepText = CardSettingsHelper.OnAddressSetEvent(a.text, ref card, Driver.AnalogOutput); if (a.keepText) { combo.comboList.Insert(combo.comboList.Count - 1, card); foreach (var display in displays) { display.Visible = true; } combo.activeText = card; combo.Visible = false; combo.Visible = true; sceneTitle = "Analog Output Cards"; GetCardData(); } }; numberInput.Run(); numberInput.Destroy(); // The number input was canceled if (combo.activeText == "New card...") { card = Driver.AnalogOutput.firstCard; combo.activeText = card; GetCardData(); } } QueueDraw(); }