protected override bool OnUpdateTimer() { if (fixtureName.IsNotEmpty()) { if (isDimmingFixture) { float level = Devices.Lighting.GetCurrentDimmingLevel(fixtureName); dimmingProgressBar.currentProgressSecondary = level / 100.0f; actualTextBox.text = string.Format("{0:N2}", level); level = Devices.Lighting.GetRequestedDimmingLevel(fixtureName); dimmingProgressBar.currentProgress = level / 100.0f; requestedLabel.text = string.Format("{0:N2}", level); requestedTextBox.text = string.Format("{0:N2}", level); actualTextBox.QueueDraw(); requestedLabel.QueueDraw(); dimmingProgressBar.QueueDraw(); if (dimmingIsManual) { autoTextBox.text = string.Format("{0:N2}", Devices.Lighting.GetAutoDimmingLevel(fixtureName)); autoTextBox.QueueDraw(); } } return(isDimmingFixture); } return(false); }
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 GetAtoGroupData() { if (atoGroupName.IsNotEmpty()) { if (AutoTopOff.GetAtoGroupEnable(atoGroupName)) { atoStateTextBox.text = string.Format("{0} : {1}", AutoTopOff.GetAtoGroupState(atoGroupName), AutoTopOff.GetAtoGroupAtoTime(atoGroupName).SecondsToString()); if (Alarm.CheckAlarming(AutoTopOff.GetAtoGroupFailAlarmIndex(atoGroupName)) || AutoTopOff.GetAtoGroupState(atoGroupName) == AutoTopOffState.Cooldown) { atoClearFailBtn.Visible = true; atoClearFailBtn.Show(); } else { atoClearFailBtn.Visible = false; } } else { atoStateTextBox.text = "ATO Disabled"; atoClearFailBtn.Visible = false; } } else { atoStateTextBox.text = "ATO Disabled"; atoClearFailBtn.Visible = false; } atoStateTextBox.QueueDraw(); }
protected void GetGroupData() { if (groupName.IsNotEmpty()) { levelLabel.text = WaterLevel.GetWaterLevelGroupLevel(groupName).ToString("F1"); } else { levelLabel.text = "--"; } levelLabel.QueueDraw(); }
protected override bool OnUpdateTimer() { --currentTime; timerProgress.progress = (float)currentTime / (float)actionOption; timerProgress.progressColor = new TouchColor("compl").Blend(new TouchColor("pri"), timerProgress.progress); if ((currentTime % 5) == 0) { timerLabel.text = string.Format("{0:D} secs", currentTime / 5); } if (currentTime == 0) { timerProgress.Visible = false; timerLabel.Visible = false; skipBtn.Visible = false; enableStepButton = true; stepButton.text = "Next"; stepButton.buttonColor = "seca"; stepButton.QueueDraw(); timerProgress.QueueDraw(); timerLabel.QueueDraw(); skipBtn.QueueDraw(); NextStep(); timerRunning = false; } timerLabel.QueueDraw(); timerProgress.QueueDraw(); return(timerRunning); }
protected void GetGroupData() { if (!groupName.IsEmpty()) { tempTextBox.text = Temperature.GetTemperatureGroupTemperature(groupName).ToString("F1"); tempSetpoint.text = Temperature.GetTemperatureGroupTemperatureSetpoint(groupName).ToString("F1"); tempDeadband.text = Temperature.GetTemperatureGroupTemperatureDeadband(groupName).ToString("F1"); } else { tempTextBox.text = "--"; tempSetpoint.text = "--"; tempDeadband.text = "--"; } tempTextBox.QueueDraw(); tempSetpoint.QueueDraw(); tempDeadband.QueueDraw(); }
protected void OnDimmingModeSelectorChanged(object sender, SelectorChangedEventArgs args) { if (args.currentSelectedIndex == 0) { Devices.Lighting.SetDimmingMode(fixtureName, Mode.Manual); var ic = Devices.Lighting.GetGadgetChannel(fixtureName); Driver.Power.SetChannelMode(ic, Mode.Manual); dimmingProgressBar.enableTouch = true; requestedTextBox.Visible = true; requestedTextBox.text = string.Format("{0:N2}", Devices.Lighting.GetRequestedDimmingLevel(fixtureName)); autoTextBox.Visible = true; autoLabel.Visible = true; dimmingIsManual = true; autoTextBox.text = string.Format("{0:N2}", Devices.Lighting.GetAutoDimmingLevel(fixtureName)); if (Driver.Power.GetChannelValue(ic)) { outletSelectorSwitch.currentSelected = 0; } else { outletSelectorSwitch.currentSelected = 2; } outletSelectorSwitch.QueueDraw(); } else { Devices.Lighting.SetDimmingMode(fixtureName, Mode.Auto); Driver.Power.SetChannelMode(Devices.Lighting.GetGadgetChannel(fixtureName), Mode.Auto); dimmingProgressBar.enableTouch = false; requestedTextBox.Visible = false; autoTextBox.Visible = false; autoLabel.Visible = false; dimmingIsManual = false; outletSelectorSwitch.currentSelected = 1; outletSelectorSwitch.QueueDraw(); } dimmingProgressBar.QueueDraw(); autoTextBox.QueueDraw(); autoLabel.QueueDraw(); }
protected void GetSwitchData() { if (switchName.IsNotEmpty()) { var floatSwitch = (FloatSwitch)Sensors.FloatSwitches.GetGadget(switchName); bool state = floatSwitch.activated; if (state) { switchStateTextBox.text = "Activated"; switchStateTextBox.textColor = "pri"; } else { switchStateTextBox.text = "Normal"; switchStateTextBox.textColor = "seca"; } switchStateLabel.Visible = true; switchTypeLabel.Visible = true; SwitchType type = floatSwitch.switchType; switchTypeLabel.text = Utils.GetDescription(type); } else { switchStateLabel.Visible = false; switchTypeLabel.Visible = false; switchStateTextBox.text = "Switch not available"; switchStateTextBox.textColor = "white"; } switchCombo.Visible = false; switchCombo.Visible = true; switchCombo.QueueDraw(); switchTypeLabel.QueueDraw(); switchStateTextBox.QueueDraw(); }
protected void GetHeaterData() { if (heaterName.IsNotEmpty()) { if (Driver.Power.GetChannelValue(Devices.Heater.GetGadgetChannel(heaterName))) { heaterLabel.text = "Heater On"; heaterLabel.textColor = "secb"; } else { heaterLabel.text = "Heater Off"; heaterLabel.textColor = "white"; } } else { heaterLabel.text = "No Heaters Connected"; heaterLabel.textColor = "white"; } heaterLabel.QueueDraw(); }
protected void NextStep() { string step, action; bool done = tests[testIdx].GetNextStep(out step, out action); stepLabel.text = step; actionLabel.text = action; if (!string.Equals(action, "NOP", StringComparison.InvariantCultureIgnoreCase)) { if (action.StartsWith("Timer", StringComparison.InvariantCultureIgnoreCase)) { try { int start = action.IndexOf('('); actionOption = Convert.ToInt32(action.Substring(start + 1, action.Length - 2 - start)) * 5; currentTime = actionOption; stepButton.text = "Start Timer"; timerProgress.Visible = true; timerProgress.progress = 100.0f; timerProgress.progressColor = "pri"; timerLabel.Visible = true; timerLabel.text = string.Format("{0:D} secs", currentTime / 5); skipBtn.Visible = true; } catch { Restart(); MessageBox.Show("Invalid procedure command"); } } else if (action.StartsWith("Record", StringComparison.InvariantCultureIgnoreCase)) { try { int start = action.IndexOf('('); actionOption = Convert.ToInt32(action.Substring(start + 1, action.Length - 2 - start)); if ((actionOption != 1) && (actionOption != 2)) { Restart(); MessageBox.Show("Invalid procedure command"); } else { stepButton.text = "Enter titration level"; } } catch { Restart(); MessageBox.Show("Invalid procedure command"); } } } if (done) { stepButton.text = "Done"; stepButton.buttonColor = "compl"; string result = String.Format("{0:f2} {1}", tests[testIdx].CalculateResults(), tests[testIdx].unit); stepLabel.text = result; Logger.Add("Tested {0}, result is {1}", tests[testIdx].name, result); } stepLabel.QueueDraw(); actionLabel.QueueDraw(); stepButton.QueueDraw(); }