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(); }
protected void OnGlobalSettingsRelease(object sender, ButtonReleaseEventArgs args) { if (card.IsNotEmpty()) { if (Driver.AnalogOutput.CheckCardEmpty(card)) { var parent = Toplevel as Window; var ms = new TouchDialog("Are you sure you with to delete " + card, parent); ms.Response += (o, a) => { if (a.ResponseId == ResponseType.Yes) { var deleted = CardSettingsHelper.OnCardDeleteEvent(card, Driver.AnalogOutput); if (deleted) { combo.comboList.Remove(card); if (Driver.AnalogOutput.cardCount == 0) { card = string.Empty; sceneTitle = "No Analog Output Cards Added"; foreach (var display in displays) { display.Visible = false; } combo.activeIndex = -1; settingsButton.buttonColor = "grey1"; } else { card = Driver.AnalogOutput.firstCard; combo.activeText = card; GetCardData(); } QueueDraw(); } } }; ms.Run(); ms.Destroy(); } } }
protected void OnSettingsRelease(object sender, ButtonReleaseEventArgs args) { if (powerStripName.IsNotEmpty()) { if (Driver.Power.CheckCardEmpty(powerStripName)) { var parent = Toplevel as Window; var ms = new TouchDialog("Are you sure you with to delete " + powerStripName, parent); ms.Response += (o, a) => { if (a.ResponseId == ResponseType.Yes) { var deleted = CardSettingsHelper.OnCardDeleteEvent(powerStripName, Driver.Power); if (deleted) { combo.comboList.Remove(powerStripName); if (power.cardCount == 0) { powerStripName = string.Empty; sceneTitle = "No Power Strips Added"; foreach (var sel in selectors) { sel.Visible = false; } graphics.Visible = false; combo.activeIndex = -1; } else { powerStripName = Driver.Power.firstCard; combo.activeText = powerStripName; GetPowerData(); } QueueDraw(); } } }; ms.Run(); ms.Destroy(); } } }