protected void OnClearButtonRelease(object sender, ButtonReleaseEventArgs args) { var parent = Toplevel as Window; var ms = new TouchDialog("Save events before clearing", parent); ms.Response += (o, a) => { if (a.ResponseId == ResponseType.Yes) { SaveEvents(); buffer.Clear(); } else if (a.ResponseId == ResponseType.No) { ms.Destroy(); var parent2 = Toplevel as Window; var d = new TouchDialog("Are you sure you want to clear all the contents of the event logger", parent2); d.Response += (obj, arg) => { if (arg.ResponseId == ResponseType.Yes) { buffer.Clear(); } }; d.Run(); d.Destroy(); } }; ms.Run(); ms.Destroy(); }
protected override bool OnDelete(object sender) { if (groupName == Temperature.defaultTemperatureGroup) { var parent = Toplevel as Window; var ms = new TouchDialog(groupName + " is the default temperature group.\n" + "Are you sure you want to delete this group", parent); bool confirmed = false; ms.Response += (o, a) => { if (a.ResponseId == ResponseType.Yes) { confirmed = true; } }; ms.Run(); ms.Destroy(); if (!confirmed) { return(false); } } Temperature.RemoveTemperatureGroup(groupName); return(true); }
protected void OnResetButtonReleased(object sender, ButtonReleaseEventArgs e) { if (testIdx != -1) { bool restart = false; if (tests[testIdx].Done) { restart = true; } else { var parent = Toplevel as Window; var ms = new TouchDialog( "Are you sure you want to quit in the middle of a procedure", parent); ms.Response += (obj, a) => { if (a.ResponseId == ResponseType.Yes) { restart = true; } }; ms.Run(); ms.Destroy(); } if (restart) { Restart(); } } }
protected void OnComboChanged(object sender, ComboBoxChangedEventArgs e) { int newIdx = testIdx; if (testIdx != -1) { if (!tests[testIdx].InProcedure) { var parent = Toplevel as Window; var ms = new TouchDialog( "Are you sure you want to quit in the middle of a procedure", parent); ms.Response += (o, a) => { if (a.ResponseId == ResponseType.Yes) { newIdx = e.activeIndex; } }; ms.Run(); ms.Destroy(); } else { newIdx = e.activeIndex; } } else { newIdx = e.activeIndex; } if (newIdx != testIdx) { if (testIdx != -1) { tests[testIdx].Restart(); } testIdx = newIdx; nameLabel.text = tests[testIdx].name; nameLabel.QueueDraw(); resetBtn.Visible = false; skipBtn.Visible = false; stepButton.text = "Start"; stepButton.buttonColor = "pri"; enableStepButton = true; stepLabel.text = "Press start"; actionLabel.text = string.Empty; stepButton.QueueDraw(); stepLabel.QueueDraw(); actionLabel.QueueDraw(); } }
protected void OnCloseButtonRelease(object sender, ButtonReleaseEventArgs args) { var parent = Toplevel as Window; var ms = new TouchDialog("Are you sure?\nClosing application ends all controller functionality!", parent); ms.Response += (o, a) => { if (a.ResponseId == ResponseType.Yes) { Application.Quit(); } }; ms.Run(); ms.Destroy(); }
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(); } } }
public LightingStateWidget() { SetSizeRequest(540, 380); lightingStateDisplay = new LightingStateDisplay(); lightingStateDisplay.SetSizeRequest(540, 380); lightingStateDisplay.LightingStateSelectionChanged += (obj, args) => { if (args.stateSelected) { adjustDimmingTogetherSelector.Visible = true; adjustDimmingTogetherLabel.Visible = true; deleteStateButton.Visible = true; } else { adjustDimmingTogetherSelector.Visible = false; adjustDimmingTogetherLabel.Visible = false; deleteStateButton.Visible = false; } }; lightingStateDisplay.LightingStateInfoChanged += (obj, hasChanged) => { if (hasChanged) { acceptChangesButton.buttonColor = "pri"; undoChangesButton.buttonColor = "pri"; } else { acceptChangesButton.buttonColor = "grey1"; undoChangesButton.buttonColor = "grey1"; } acceptChangesButton.QueueDraw(); undoChangesButton.QueueDraw(); }; Put(lightingStateDisplay, 0, 0); lightingStateDisplay.Show(); adjustDimmingTogetherSelector = new TouchSelectorSwitch(); adjustDimmingTogetherSelector.SetSizeRequest(180, 30); adjustDimmingTogetherSelector.sliderSize = MySliderSize.Large; adjustDimmingTogetherSelector.textOptions[0] = "Separate"; adjustDimmingTogetherSelector.textOptions[1] = "Together"; adjustDimmingTogetherSelector.sliderColorOptions[1] = "pri"; adjustDimmingTogetherSelector.selectedTextColorOptions[1] = "black"; adjustDimmingTogetherSelector.currentSelected = 1; adjustDimmingTogetherSelector.SelectorChangedEvent += (obj, args) => { lightingStateDisplay.adjustDimmingTogether = args.currentSelectedIndex == 1; }; Put(adjustDimmingTogetherSelector, 0, 350); adjustDimmingTogetherLabel = new TouchLabel(); adjustDimmingTogetherLabel.text = "Adjust Dimming"; adjustDimmingTogetherLabel.WidthRequest = 180; adjustDimmingTogetherLabel.textAlignment = TouchAlignment.Center; Put(adjustDimmingTogetherLabel, 0, 328); acceptChangesButton = new TouchButton(); acceptChangesButton.text = "Accept"; acceptChangesButton.buttonColor = "grey1"; acceptChangesButton.SetSizeRequest(80, 40); acceptChangesButton.ButtonReleaseEvent += (obj, args) => { if (lightingStateDisplay.hasStateInfoChanged) { var parent = Toplevel as Window; var ms = new TouchDialog("Do you want to make the changes permanent", parent, new string[] { "Yes", "No", "Cancel" }); ms.Response += (o, a) => { if (a.ResponseId != ResponseType.Cancel) { var makeChangePermanant = a.ResponseId == ResponseType.Yes; Devices.Lighting.SetLightingFixtureLightingStates( fixtureName, lightingStateDisplay.lightingStates, !makeChangePermanant); lightingStateDisplay.selectedState = -1; lightingStateDisplay.hasStateInfoChanged = false; lightingStateDisplay.QueueDraw(); } }; ms.Run(); ms.Destroy(); } }; Put(acceptChangesButton, 460, 340); acceptChangesButton.Show(); undoChangesButton = new TouchButton(); undoChangesButton.text = "Undo"; undoChangesButton.buttonColor = "grey1"; undoChangesButton.SetSizeRequest(80, 40); undoChangesButton.ButtonReleaseEvent += (obj, args) => { if (lightingStateDisplay.hasStateInfoChanged) { SetStates(fixtureName); } }; Put(undoChangesButton, 370, 340); undoChangesButton.Show(); deleteStateButton = new TouchButton(); deleteStateButton.text = "Delete"; deleteStateButton.SetSizeRequest(80, 40); deleteStateButton.buttonColor = "compl"; deleteStateButton.textColor = "white"; deleteStateButton.ButtonReleaseEvent += (obj, args) => { var parent = Toplevel as Window; var ms = new TouchDialog("Are you sure you want to delete the state", parent); ms.Response += (o, a) => { if (a.ResponseId == ResponseType.Yes) { lightingStateDisplay.RemoveSelectedState(); } }; ms.Run(); ms.Destroy(); }; Put(deleteStateButton, 280, 340); Show(); }