public SensorsWindow(params object[] options) { sceneTitle = "Sensors"; ExposeEvent += OnExpose; topWidget = new PhProbeWidget(); Put(topWidget, 415, 77); topWidget.Show(); bottomWidget = new WaterLevelSensorWidget(); Put(bottomWidget, 415, 277); bottomWidget.Show(); topCombo = new TouchComboBox(analogSensorNames); topCombo.WidthRequest = 235; topCombo.activeText = analogSensorNames[2]; topCombo.ComboChangedEvent += OnComboChange; Put(topCombo, 153, 77); topCombo.Show(); bottomCombo = new TouchComboBox(analogSensorNames); bottomCombo.WidthRequest = 235; bottomCombo.activeText = analogSensorNames[0]; bottomCombo.ComboChangedEvent += OnComboChange; Put(bottomCombo, 153, 277); bottomCombo.Show(); topWidget.GetSensorData(); bottomWidget.GetSensorData(); Show(); }
public SettingsComboBox(string name) : base(name) { combo = new TouchComboBox(); combo.SetSizeRequest(170, 30); combo.ButtonPressEvent += OnComboButtonPressed; Put(combo, 120, 0); combo.Show(); }
public AnalogOutputWindow(params object[] options) : base() { card = Driver.AnalogOutput.firstCard; if (card.IsNotEmpty()) { sceneTitle = "Analog Output Cards"; } else { sceneTitle = "No Analog Output Cards Added"; } displays = new AnalogChannelDisplay[4]; for (int i = 0; i < 4; ++i) { displays[i] = new AnalogChannelDisplay(); displays[i].divisionSteps = 1000; displays[i].typeLabel.Visible = true; displays[i].ForceButtonReleaseEvent += OnForceRelease; displays[i].ValueChangedEvent += OnValueChanged; Put(displays[i], 70, 90 + (i * 75)); if (card.IsNotEmpty()) { displays[i].Show(); } else { displays[i].Visible = false; } } settingsButton = new TouchButton(); settingsButton.SetSizeRequest(30, 30); settingsButton.buttonColor = "grey4"; settingsButton.text = Convert.ToChar(0x2699).ToString(); settingsButton.ButtonReleaseEvent += OnGlobalSettingsRelease; Put(settingsButton, 755, 35); settingsButton.Show(); combo = new TouchComboBox(Driver.AnalogOutput.GetAllCardNames()); combo.comboList.Add("New card..."); if (card.IsNotEmpty()) { combo.activeText = card; } combo.WidthRequest = 200; combo.ComboChangedEvent += OnComboChanged; Put(combo, 550, 35); combo.Show(); GetCardData(); Show(); }
public ChemistryWindow(params object[] options) : base(false) { sceneTitle = "Chemistry"; string path = System.IO.Path.Combine(Utils.AquaPicEnvironment, "TestProcedures"); var d = new DirectoryInfo(path); FileInfo[] files = d.GetFiles("*.json"); testIdx = -1; tests = new List <TestProcedure> (); foreach (var file in files) { try { tests.Add(new TestProcedure(file.FullName)); } catch (Exception ex) { Logger.AddError(ex.ToString()); } } timerProgress = new TouchCurvedProgressBar( new TouchColor("grey3"), new TouchColor("pri"), 100.0f); timerProgress.SetSizeRequest(250, 175); timerProgress.curveStyle = CurveStyle.ThreeQuarterCurve; Put(timerProgress, 275, 100); timerProgress.Visible = false; timerLabel = new TouchLabel(); timerLabel.WidthRequest = 200; timerLabel.textAlignment = TouchAlignment.Center; timerLabel.textSize = 20; Put(timerLabel, 300, 240); timerLabel.Visible = false; stepButton = new TouchButton(); stepButton.SetSizeRequest(200, 50); stepButton.buttonColor = "grey2"; stepButton.text = "N/A"; stepButton.ButtonReleaseEvent += OnStepButtonReleased; Put(stepButton, 300, 365); stepButton.Show(); resetBtn = new TouchButton(); resetBtn.SetSizeRequest(200, 50); resetBtn.text = "Restart"; resetBtn.ButtonReleaseEvent += OnResetButtonReleased; Put(resetBtn, 510, 365); resetBtn.Visible = false; skipBtn = new TouchButton(); skipBtn.SetSizeRequest(200, 50); skipBtn.text = "Skip"; skipBtn.buttonColor = "seca"; skipBtn.ButtonReleaseEvent += OnSkipButtonReleased; Put(skipBtn, 90, 365); skipBtn.Visible = false; nameLabel = new TouchLabel(); nameLabel.WidthRequest = 700; nameLabel.textSize = 14; nameLabel.textColor = "seca"; nameLabel.textAlignment = TouchAlignment.Center; Put(nameLabel, 50, 65); nameLabel.Show(); stepLabel = new TouchTextBox(); stepLabel.SetSizeRequest(620, 75); stepLabel.textAlignment = TouchAlignment.Center; stepLabel.text = "Please select a test procedure"; Put(stepLabel, 90, 280); stepLabel.Show(); actionLabel = new TouchLabel(); actionLabel.WidthRequest = 200; actionLabel.textAlignment = TouchAlignment.Right; Put(actionLabel, 510, 420); actionLabel.Show(); combo = new TouchComboBox(); foreach (var test in tests) { combo.comboList.Add(test.name); } combo.nonActiveMessage = "Select test"; combo.WidthRequest = 235; combo.ComboChangedEvent += OnComboChanged; Put(combo, 550, 35); combo.Show(); CanFocus = true; KeyPressEvent += EntryKeyPressEvent; ExposeEvent += (o, args) => { GrabFocus(); }; Show(); }
public WaterLevelWindow(params object[] options) { sceneTitle = "Water Level"; ExposeEvent += OnExpose; /******************************************************************************************************/ /* Water Level Groups */ /******************************************************************************************************/ groupName = WaterLevel.firstWaterLevelGroup; if (options.Length >= 3) { var requestedGroup = options[2] as string; if (requestedGroup != null) { if (WaterLevel.WaterLevelGroupNameExists(requestedGroup)) { groupName = requestedGroup; } } } var label = new TouchLabel(); label.text = "Groups"; label.WidthRequest = 118; label.textColor = "seca"; label.textSize = 12; label.textAlignment = TouchAlignment.Left; Put(label, 37, 80); label.Show(); label = new TouchLabel(); label.WidthRequest = 329; label.text = "Level"; label.textColor = "grey3"; label.textAlignment = TouchAlignment.Center; Put(label, 60, 155); label.Show(); levelLabel = new TouchLabel(); levelLabel.WidthRequest = 329; levelLabel.textSize = 20; levelLabel.textAlignment = TouchAlignment.Center; levelLabel.textRender.unitOfMeasurement = UnitsOfMeasurement.Inches; Put(levelLabel, 60, 120); levelLabel.Show(); var globalSettingsBtn = new TouchButton(); globalSettingsBtn.text = "\u2699"; globalSettingsBtn.SetSizeRequest(30, 30); globalSettingsBtn.buttonColor = "pri"; globalSettingsBtn.ButtonReleaseEvent += OnGroupSettingsButtonReleaseEvent; Put(globalSettingsBtn, 358, 77); globalSettingsBtn.Show(); /******************************************************************************************************/ /* ATO Groups */ /******************************************************************************************************/ atoGroupName = AutoTopOff.firstAtoGroup; label = new TouchLabel(); label.text = "ATO"; label.textColor = "seca"; label.textSize = 12; Put(label, 37, 280); label.Show(); atoStateTextBox = new TouchLabel(); atoStateTextBox.WidthRequest = 329; atoStateTextBox.textSize = 20; atoStateTextBox.textAlignment = TouchAlignment.Center; Put(atoStateTextBox, 60, 320); atoStateTextBox.Show(); var atoSettingsBtn = new TouchButton(); atoSettingsBtn.text = "\u2699"; atoSettingsBtn.SetSizeRequest(30, 30); atoSettingsBtn.buttonColor = "pri"; atoSettingsBtn.ButtonReleaseEvent += OnAtoSettingsButtonReleaseEvent; Put(atoSettingsBtn, 358, 277); atoSettingsBtn.Show(); atoClearFailBtn = new TouchButton(); atoClearFailBtn.SetSizeRequest(100, 60); atoClearFailBtn.text = "Reset ATO"; atoClearFailBtn.buttonColor = "compl"; atoClearFailBtn.ButtonReleaseEvent += (o, args) => { if (atoGroupName.IsNotEmpty()) { if (AutoTopOff.GetAtoGroupState(atoGroupName) == AutoTopOffState.Cooldown) { AutoTopOff.ResetCooldownTime(atoGroupName); } else { if (!AutoTopOff.ClearAtoAlarm(atoGroupName)) { MessageBox.Show("Please acknowledge alarms first"); } } } }; Put(atoClearFailBtn, 70, 405); /**************************************************************************************************************/ /* Analog water sensor */ /**************************************************************************************************************/ analogSensorWidget = new WaterLevelSensorWidget(); Put(analogSensorWidget, 415, 77); analogSensorWidget.Show(); analogSensorWidget.sensorCombo.comboList.Clear(); if (groupName.IsNotEmpty()) { var groupsWaterLevelSensors = WaterLevel.GetAllWaterLevelSensorsForWaterLevelGroup(groupName); analogSensorWidget.sensorCombo.comboList.AddRange(groupsWaterLevelSensors); if (groupsWaterLevelSensors.Length > 0) { analogSensorWidget.sensorName = groupsWaterLevelSensors[0]; } else { analogSensorWidget.sensorName = string.Empty; } } analogSensorWidget.sensorCombo.comboList.Add("New level sensor..."); analogSensorWidget.sensorCombo.activeIndex = 0; analogSensorWidget.sensorCombo.QueueDraw(); /**************************************************************************************************************/ /* Float Switches */ /**************************************************************************************************************/ label = new TouchLabel(); label.text = "Probes"; label.textColor = "seca"; label.textSize = 12; Put(label, 415, 280); label.Show(); switchStateLabel = new TouchLabel(); switchStateLabel.text = "Current Switch State"; switchStateLabel.textAlignment = TouchAlignment.Center; switchStateLabel.textColor = "grey3"; switchStateLabel.WidthRequest = 370; Put(switchStateLabel, 415, 355); switchStateTextBox = new TouchLabel(); switchStateTextBox.WidthRequest = 370; switchStateTextBox.textSize = 20; switchStateTextBox.textAlignment = TouchAlignment.Center; Put(switchStateTextBox, 415, 320); switchStateTextBox.Show(); //Type switchTypeLabel = new TouchLabel(); switchTypeLabel.WidthRequest = 370; switchTypeLabel.textAlignment = TouchAlignment.Center; switchTypeLabel.textColor = "grey3"; Put(switchTypeLabel, 415, 370); switchTypeLabel.Show(); var switchSetupBtn = new TouchButton(); switchSetupBtn.text = "\u2699"; switchSetupBtn.SetSizeRequest(30, 30); switchSetupBtn.buttonColor = "pri"; switchSetupBtn.ButtonReleaseEvent += OnFloatSwitchSettingsButtonReleaseEvent; Put(switchSetupBtn, 755, 277); switchSetupBtn.Show(); groupCombo = new TouchComboBox(WaterLevel.GetAllWaterLevelGroupNames()); if (groupName.IsNotEmpty()) { groupCombo.activeText = groupName; } else { groupCombo.activeIndex = 0; } groupCombo.WidthRequest = 200; groupCombo.comboList.Add("New group..."); groupCombo.ComboChangedEvent += OnGroupComboChanged; Put(groupCombo, 153, 77); groupCombo.Show(); atoGroupCombo = new TouchComboBox(AutoTopOff.GetAllAtoGroupNames()); if (atoGroupName.IsNotEmpty()) { atoGroupCombo.activeText = atoGroupName; } else { atoGroupCombo.activeIndex = 0; } atoGroupCombo.WidthRequest = 200; atoGroupCombo.comboList.Add("New ATO..."); atoGroupCombo.ComboChangedEvent += OnAtoGroupComboChanged; Put(atoGroupCombo, 153, 277); atoGroupCombo.Show(); switchCombo = new TouchComboBox(); switchCombo.WidthRequest = 200; if (groupName.IsNotEmpty()) { var groupsFloatSwitches = WaterLevel.GetAllFloatSwitchesForWaterLevelGroup(groupName); switchCombo.comboList.AddRange(groupsFloatSwitches); if (groupsFloatSwitches.Length > 0) { switchName = groupsFloatSwitches[0]; } else { switchName = string.Empty; } } switchCombo.comboList.Add("New switch..."); switchCombo.activeIndex = 0; switchCombo.ComboChangedEvent += OnSwitchComboChanged; Put(switchCombo, 550, 277); switchCombo.Show(); GetGroupData(); GetAtoGroupData(); analogSensorWidget.GetSensorData(); GetSwitchData(); Show(); }
public DigitalInputWindow(params object[] options) : base() { card = Driver.DigitalInput.firstCard; if (card.IsNotEmpty()) { sceneTitle = "Digital Inputs Cards"; } else { sceneTitle = "No Digital Input Cards Added"; } displays = new DigitalDisplay[6]; for (int i = 0; i < 6; ++i) { displays[i] = new DigitalDisplay(); displays[i].ForceButtonReleaseEvent += OnForceRelease; displays[i].StateSelectedChangedEvent += OnSelectorChanged; int x, y; if (i < 3) { x = (i * 150) + 175; y = 125; } else { x = ((i - 3) * 150) + 175; y = 275; } Put(displays[i], x, y); if (card.IsNotEmpty()) { displays[i].Show(); } else { displays[i].Visible = false; } } settingsButton = new TouchButton(); settingsButton.SetSizeRequest(30, 30); settingsButton.buttonColor = "grey4"; settingsButton.text = Convert.ToChar(0x2699).ToString(); settingsButton.ButtonReleaseEvent += OnGlobalSettingsRelease; Put(settingsButton, 755, 35); settingsButton.Show(); combo = new TouchComboBox(Driver.DigitalInput.GetAllCardNames()); combo.comboList.Add("New card..."); if (card.IsNotEmpty()) { combo.activeText = card; } combo.WidthRequest = 200; combo.ComboChangedEvent += OnComboChanged; Put(combo, 550, 35); combo.Show(); GetCardData(); Show(); }
public LightingWindow(params object[] options) : base(false) { sceneTitle = "Lighting"; fixtureName = Devices.Lighting.defaultGadget; if (fixtureName.IsNotEmpty()) { dimmingIsManual = false; } if (options.Length >= 3) { string requestedFixture = options[2] as string; if (requestedFixture != null) { if (Devices.Lighting.CheckGadgetKeyNoThrow(requestedFixture)) { fixtureName = requestedFixture; } } } outletSelectorSwitch = new TouchSelectorSwitch(3); outletSelectorSwitch.WidthRequest = 180; outletSelectorSwitch.sliderColorOptions[1] = "pri"; outletSelectorSwitch.selectedTextColorOptions[1] = "black"; outletSelectorSwitch.sliderColorOptions[2] = "seca"; outletSelectorSwitch.textOptions = new string[] { "Off", "Auto", "On" }; outletSelectorSwitch.SelectorChangedEvent += OnOutletControlSelectorChanged; Put(outletSelectorSwitch, 605, 77); outletSelectorSwitch.Show(); outletStateLabel = new TouchLabel(); outletStateLabel.textAlignment = TouchAlignment.Center; outletStateLabel.WidthRequest = 180; outletStateLabel.textSize = 14; Put(outletStateLabel, 605, 110); outletStateLabel.Show(); dimmingHeader = new TouchLabel(); dimmingHeader.textAlignment = TouchAlignment.Center; dimmingHeader.WidthRequest = 180; dimmingHeader.text = "Dimming Control"; Put(dimmingHeader, 605, 148); dimmingHeader.Show(); modeSelector = new TouchSelectorSwitch(); modeSelector.SetSizeRequest(140, 30); modeSelector.sliderColorOptions[1] = "pri"; modeSelector.selectedTextColorOptions[1] = "black"; modeSelector.textOptions = new string[] { "Manual", "Auto" }; modeSelector.SelectorChangedEvent += OnDimmingModeSelectorChanged; Put(modeSelector, 605, 173); modeSelector.Show(); dimmingProgressBar = new TouchLayeredProgressBar(); dimmingProgressBar.colorProgress = "seca"; dimmingProgressBar.colorProgressSecondary = "pri"; dimmingProgressBar.drawPrimaryWhenEqual = false; dimmingProgressBar.ProgressChangedEvent += OnProgressChanged; dimmingProgressBar.ProgressChangingEvent += OnProgressChanging; dimmingProgressBar.HeightRequest = 280; Put(dimmingProgressBar, 755, 173); dimmingProgressBar.Show(); actualTextBox = new TouchLabel(); actualTextBox.WidthRequest = 140; actualTextBox.textSize = 20; actualTextBox.textColor = "pri"; actualTextBox.textAlignment = TouchAlignment.Center; actualTextBox.textRender.unitOfMeasurement = UnitsOfMeasurement.Percentage; Put(actualTextBox, 605, 209); actualTextBox.Show(); actualLabel = new TouchLabel(); actualLabel.WidthRequest = 140; actualLabel.text = "Current"; actualLabel.textColor = "grey3"; actualLabel.textAlignment = TouchAlignment.Center; Put(actualLabel, 605, 244); actualLabel.Show(); requestedLabel = new TouchLabel(); requestedLabel.WidthRequest = 140; requestedLabel.textSize = 20; requestedLabel.textColor = "seca"; requestedLabel.textAlignment = TouchAlignment.Center; requestedLabel.textRender.unitOfMeasurement = UnitsOfMeasurement.Percentage; Put(requestedLabel, 605, 272); requestedLabel.Show(); requestedTextBox = new TouchTextBox(); requestedTextBox.enableTouch = true; requestedTextBox.TextChangedEvent += (sender, args) => { try { float newLevel = Convert.ToSingle(args.text); if (newLevel < 0.0f) { newLevel = 0.0f; } if (newLevel > 100.0f) { newLevel = 100.0f; } Devices.Lighting.SetDimmingLevel(fixtureName, newLevel); } catch (Exception ex) { MessageBox.Show(ex.Message); args.keepText = false; } }; requestedTextBox.SetSizeRequest(110, 36); requestedTextBox.textSize = 20; requestedTextBox.textColor = "seca"; requestedTextBox.textAlignment = TouchAlignment.Center; requestedTextBox.textRender.unitOfMeasurement = UnitsOfMeasurement.Percentage; requestedTextBox.Visible = false; Put(requestedTextBox, 620, 272); requestedTextBox.Show(); requestedTextLabel = new TouchLabel(); requestedTextLabel.WidthRequest = 140; requestedTextLabel.text = "Requested"; requestedTextLabel.textColor = "grey3"; requestedTextLabel.textAlignment = TouchAlignment.Center; Put(requestedTextLabel, 605, 307); requestedTextLabel.Show(); autoTextBox = new TouchLabel(); autoTextBox.WidthRequest = 140; autoTextBox.Visible = false; autoTextBox.textSize = 20; autoTextBox.textColor = "grey4"; autoTextBox.textAlignment = TouchAlignment.Center; autoTextBox.textRender.unitOfMeasurement = UnitsOfMeasurement.Percentage; Put(autoTextBox, 605, 335); autoTextBox.Show(); autoLabel = new TouchLabel(); autoLabel.WidthRequest = 140; autoLabel.Visible = false; autoLabel.text = "Auto"; autoLabel.textColor = "grey3"; autoLabel.textAlignment = TouchAlignment.Center; Put(autoLabel, 605, 370); autoLabel.Show(); fixtureSettingBtn = new TouchButton(); fixtureSettingBtn.text = Convert.ToChar(0x2699).ToString(); fixtureSettingBtn.SetSizeRequest(30, 30); fixtureSettingBtn.buttonColor = "pri"; fixtureSettingBtn.ButtonReleaseEvent += OnFixtureSettingsButtonReleased; Put(fixtureSettingBtn, 755, 35); fixtureSettingBtn.Show(); lightingStateWidget = new LightingStateWidget(); Put(lightingStateWidget, 55, 77); lightingStateWidget.Show(); combo = new TouchComboBox(Devices.Lighting.GetAllGadgetNames()); combo.comboList.Add("New fixture..."); combo.activeIndex = 0; combo.WidthRequest = 250; combo.ComboChangedEvent += OnComboChanged; Put(combo, 500, 35); combo.Show(); if (fixtureName.IsNotEmpty()) { combo.activeText = fixtureName; } else { combo.activeIndex = 0; } outletSubscriber = new OutputChannelValueSubscriber(OnValueChanged); GetFixtureData(); lightingStateWidget.SetStates(fixtureName); Show(); }
public PowerWindow(params object[] options) : base() { powerStripName = power.firstCard; if (powerStripName.IsNotEmpty()) { sceneTitle = "Power Strip"; } else { sceneTitle = "No Power Strips Added"; } graphics = new PowerWindowGraphics(); Put(graphics, 50, 80); if (powerStripName.IsNotEmpty()) { graphics.Show(); } else { graphics.Visible = false; } int x, y; selectors = new PowerOutletSlider[8]; for (int i = 0; i < 8; ++i) { selectors[i] = new PowerOutletSlider(i); selectors[i].ss.SelectorChangedEvent += OnSelectorChanged; if ((i % 2) == 0) // even numbers top row { x = ((i - (i / 2)) * 185) + 50; y = 85; } else { x = (((i - (i / 2)) - 1) * 185) + 50; y = 275; } Put(selectors[i], x, y); if (powerStripName.IsNotEmpty()) { selectors[i].Show(); var ic = IndividualControl.Empty; ic.Group = powerStripName; ic.Individual = i; selectors[i].Subscribe(ic); } else { selectors[i].Visible = false; } } settingsButton = new TouchButton(); settingsButton.SetSizeRequest(30, 30); settingsButton.buttonColor = "pri"; settingsButton.text = Convert.ToChar(0x2699).ToString(); settingsButton.ButtonReleaseEvent += OnSettingsRelease; Put(settingsButton, 755, 35); settingsButton.Show(); combo = new TouchComboBox(power.GetAllCardNames()); combo.comboList.Add("New power strip..."); combo.activeText = powerStripName; combo.WidthRequest = 200; combo.ComboChangedEvent += OnComboChanged; Put(combo, 550, 35); combo.Show(); GetPowerData(); Show(); }
public TemperatureWindow(params object[] options) { sceneTitle = "Temperature"; ExposeEvent += OnExpose; /******************************************************************************************************/ /* Temperature Groups */ /******************************************************************************************************/ groupName = Temperature.defaultTemperatureGroup; if (options.Length >= 3) { var requestedGroup = options[2] as string; if (requestedGroup != null) { if (Temperature.TemperatureGroupNameExists(requestedGroup)) { groupName = requestedGroup; } } } var label = new TouchLabel(); label.text = "Groups"; label.WidthRequest = 118; label.textColor = "seca"; label.textSize = 12; label.textAlignment = TouchAlignment.Left; Put(label, 30, 80); label.Show(); var tempLabel = new TouchLabel(); tempLabel.WidthRequest = 329; tempLabel.text = "Temperature"; tempLabel.textColor = "grey3"; tempLabel.textAlignment = TouchAlignment.Center; Put(tempLabel, 60, 185); tempLabel.Show(); tempTextBox = new TouchLabel(); tempTextBox.SetSizeRequest(329, 50); tempTextBox.textSize = 36; tempTextBox.textAlignment = TouchAlignment.Center; tempTextBox.textRender.unitOfMeasurement = UnitsOfMeasurement.Degrees; Put(tempTextBox, 60, 130); tempTextBox.Show(); var setpointlabel = new TouchLabel(); setpointlabel.WidthRequest = 116; setpointlabel.text = "Setpoint"; setpointlabel.textColor = "grey3"; setpointlabel.textAlignment = TouchAlignment.Center; Put(setpointlabel, 108, 260); setpointlabel.Show(); tempSetpoint = new TouchLabel(); tempSetpoint.SetSizeRequest(116, 30); tempSetpoint.textSize = 20; tempSetpoint.textAlignment = TouchAlignment.Center; tempSetpoint.textRender.unitOfMeasurement = UnitsOfMeasurement.Degrees; Put(tempSetpoint, 108, 225); tempSetpoint.Show(); var tempDeadbandLabel = new TouchLabel(); tempDeadbandLabel.WidthRequest = 116; tempDeadbandLabel.text = "Deadband"; tempDeadbandLabel.textColor = "grey3"; tempDeadbandLabel.textAlignment = TouchAlignment.Center; Put(tempDeadbandLabel, 224, 260); tempDeadbandLabel.Show(); tempDeadband = new TouchLabel(); tempDeadband.SetSizeRequest(116, 30); tempDeadband.textSize = 20; tempDeadband.textAlignment = TouchAlignment.Center; tempDeadband.textRender.unitOfMeasurement = UnitsOfMeasurement.Degrees; Put(tempDeadband, 224, 225); tempDeadband.Show(); var globalSettingsBtn = new TouchButton(); globalSettingsBtn.text = Convert.ToChar(0x2699).ToString(); globalSettingsBtn.SetSizeRequest(30, 30); globalSettingsBtn.buttonColor = "pri"; globalSettingsBtn.ButtonReleaseEvent += OnTemperatureGroupSettingsButtonReleaseEvent; Put(globalSettingsBtn, 358, 77); globalSettingsBtn.Show(); /******************************************************************************************************/ /* Heaters */ /******************************************************************************************************/ label = new TouchLabel(); label.text = "Heaters"; label.textColor = "seca"; label.textSize = 12; Put(label, 415, 80); label.Show(); heaterLabel = new TouchLabel(); heaterLabel.textAlignment = TouchAlignment.Center; heaterLabel.WidthRequest = 370; heaterLabel.textColor = "secb"; heaterLabel.textSize = 20; Put(heaterLabel, 415, 120); heaterLabel.Show(); var heaterSetupBtn = new TouchButton(); heaterSetupBtn.text = Convert.ToChar(0x2699).ToString(); heaterSetupBtn.SetSizeRequest(30, 30); heaterSetupBtn.buttonColor = "pri"; heaterSetupBtn.ButtonReleaseEvent += OnHeaterSettingsButtonReleaseEvent; Put(heaterSetupBtn, 755, 77); heaterSetupBtn.Show(); /******************************************************************************************************/ /* Temperature Probes */ /******************************************************************************************************/ probeWidget = new TemperatureProbeWidget(); Put(probeWidget, 415, 277); probeWidget.Show(); probeWidget.sensorCombo.comboList.Clear(); if (groupName.IsNotEmpty()) { var groupsTemperatureProbes = Temperature.GetAllTemperatureProbesForTemperatureGroup(groupName); probeWidget.sensorCombo.comboList.AddRange(groupsTemperatureProbes); if (groupsTemperatureProbes.Length > 0) { probeWidget.sensorName = groupsTemperatureProbes[0]; } else { probeWidget.sensorName = string.Empty; } } probeWidget.sensorCombo.comboList.Add("New level sensor..."); probeWidget.sensorCombo.activeIndex = 0; probeWidget.sensorCombo.QueueDraw(); heaterCombo = new TouchComboBox(); if (groupName.IsNotEmpty()) { var heaterNames = Devices.Heater.GetAllHeatersForTemperatureGroup(groupName); if (heaterNames.Length > 0) { heaterCombo.comboList.AddRange(heaterNames); heaterName = heaterNames[0]; } else { heaterName = string.Empty; } } heaterCombo.WidthRequest = 200; heaterCombo.comboList.Add("New heater..."); heaterCombo.ComboChangedEvent += OnHeaterComboChanged; Put(heaterCombo, 550, 77); heaterCombo.Show(); if (heaterName.IsNotEmpty()) { heaterCombo.activeText = heaterName; } else { heaterCombo.activeIndex = 0; } groupCombo = new TouchComboBox(Temperature.GetAllTemperatureGroupNames()); groupCombo.WidthRequest = 200; groupCombo.comboList.Add("New group..."); groupCombo.ComboChangedEvent += OnGroupComboChanged; Put(groupCombo, 153, 77); groupCombo.Show(); if (groupName.IsNotEmpty()) { groupCombo.activeText = groupName; } else { groupCombo.activeIndex = 0; } GetHeaterData(); probeWidget.GetSensorData(); GetGroupData(); Show(); }
public AnalogSensorWidget( string sensorTypeLabel, GenericAnalogSensorCollection sensorCollection, GenericAnalogInputBase analogInputDriver, Type settingsType ) { this.sensorCollection = sensorCollection; this.analogInputDriver = analogInputDriver; if (!settingsType.TypeIs(typeof(GenericAnalogSensorSettings))) { throw new ArgumentException("The settings type must derive GenericAnalogSensorSettings", nameof(settingsType)); } this.settingsType = settingsType; SetSizeRequest(370, 188); var label = new TouchLabel(); label.text = sensorTypeLabel; label.textColor = "seca"; label.textSize = 12; Put(label, 0, 3); label.Show(); var sensorSettingsButton = new TouchButton(); sensorSettingsButton.text = "\u2699"; sensorSettingsButton.SetSizeRequest(30, 30); sensorSettingsButton.buttonColor = "pri"; sensorSettingsButton.ButtonReleaseEvent += OnSensorSettingsButtonReleaseEvent; Put(sensorSettingsButton, 340, 0); sensorSettingsButton.Show(); var b = new TouchButton(); b.text = "Calibrate"; b.SetSizeRequest(100, 60); b.ButtonReleaseEvent += OnCalibrationButtonReleaseEvent; Put(b, 0, 118); b.Show(); sensorLabel = new TouchLabel(); sensorLabel.text = sensorTypeLabel; sensorLabel.textAlignment = TouchAlignment.Center; sensorLabel.textColor = "grey3"; sensorLabel.WidthRequest = 370; Put(sensorLabel, 0, 78); sensorLabel.Show(); sensorStateTextbox = new TouchLabel(); sensorStateTextbox.WidthRequest = 370; sensorStateTextbox.textSize = 20; sensorStateTextbox.textAlignment = TouchAlignment.Center; sensorStateTextbox.textRender.unitOfMeasurement = UnitsOfMeasurement.None; Put(sensorStateTextbox, 0, 43); sensorStateTextbox.Show(); sensorCombo = new TouchComboBox(); sensorCombo.WidthRequest = 200; var allSensors = sensorCollection.GetAllGadgetNames(); if (allSensors.Length > 0) { sensorCombo.comboList.AddRange(allSensors); sensorName = allSensors[0]; } else { sensorName = string.Empty; } sensorCombo.comboList.Add("New sensor..."); sensorCombo.activeIndex = 0; sensorCombo.ComboChangedEvent += OnSensorComboChanged; Put(sensorCombo, 135, 0); sensorCombo.Show(); GetSensorData(); Show(); }
public SerialBusWindow(params object[] options) : base() { sceneTitle = "AquaPic Bus"; var l = new TouchLabel(); l.text = "Name"; l.textAlignment = TouchAlignment.Center; l.WidthRequest = 235; Put(l, 60, 121); l.Show(); l = new TouchLabel(); l.text = "Address"; l.textAlignment = TouchAlignment.Center; l.WidthRequest = 75; Put(l, 303, 121); l.Show(); l = new TouchLabel(); l.text = "Status"; l.textAlignment = TouchAlignment.Center; l.WidthRequest = 295; Put(l, 380, 121); l.Show(); l = new TouchLabel(); l.text = "Response Time"; l.textAlignment = TouchAlignment.Right; l.WidthRequest = 170; Put(l, 605, 121); l.Show(); slaves = new SerialBusSlaveWidget[AquaPicBus.slaveCount]; string[] names = AquaPicBus.slaveNames; int[] addresses = AquaPicBus.slaveAdresses; for (int i = 0; i < slaves.Length; ++i) { slaves[i] = new SerialBusSlaveWidget(); slaves[i].name = names[i]; slaves[i].address = addresses[i]; Put(slaves[i], 65, (i * 35) + 143); slaves[i].Show(); } if (AquaPicBus.slaveCount == 0) { var blankWidget = new SerialBusSlaveWidget(); Put(blankWidget, 65, 143); blankWidget.Show(); } var b = new TouchButton(); b.SetSizeRequest(100, 30); b.text = "Open"; if (AquaPicBus.isOpen) { b.buttonColor = "grey3"; } else { b.ButtonReleaseEvent += OnOpenButtonRelease; } Put(b, 685, 70); b.Show(); c = new TouchComboBox(); if (!AquaPicBus.isOpen) { string[] portNames = SerialPort.GetPortNames(); if (Utils.ExecutingOperatingSystem == Platform.Linux) { var sortedPortNames = new List <string> (); foreach (var name in portNames) { if (name.Contains("USB")) { sortedPortNames.Add(name); } } portNames = sortedPortNames.ToArray(); } c.comboList.AddRange(portNames); c.nonActiveMessage = "Select Port"; } else { c.comboList.Add(AquaPicBus.portName); c.activeText = AquaPicBus.portName; } c.WidthRequest = 300; Put(c, 380, 70); c.Show(); GetSlaveData(); Show(); }
public AddHomeWidgetDialog(Window parent) : base("Add Home Screen Widget", parent, DialogFlags.DestroyWithParent) { Name = "AquaPic.Home.Settings.Widget.Add"; WindowPosition = (WindowPosition)4; SetSizeRequest(600, 320); #if RPI_BUILD Decorated = false; ExposeEvent += (o, args) => { using (var cr = Gdk.CairoHelper.Create(GdkWindow)) { cr.MoveTo(Allocation.Left, Allocation.Top); cr.LineTo(Allocation.Right, Allocation.Top); cr.LineTo(Allocation.Right, Allocation.Bottom); cr.LineTo(Allocation.Left, Allocation.Bottom); cr.ClosePath(); cr.LineWidth = 1.8; TouchColor.SetSource(cr, "grey4"); cr.Stroke(); } }; #endif ModifyBg(StateType.Normal, TouchColor.NewGtkColor("grey0")); foreach (Widget w in Children) { Remove(w); w.Dispose(); } fix = new Fixed(); fix.SetSizeRequest(600, 320); addBtn = new TouchButton(); addBtn.SetSizeRequest(100, 30); addBtn.text = "Add"; addBtn.ButtonReleaseEvent += OnAddButtonReleased; fix.Put(addBtn, 495, 285); addBtn.Show(); cancelButton = new TouchButton(); cancelButton.SetSizeRequest(100, 30); cancelButton.text = "Cancel"; cancelButton.ButtonReleaseEvent += (o, args) => { Destroy(); }; fix.Put(cancelButton, 385, 285); cancelButton.Show(); var widgetLabel = new TouchLabel(); widgetLabel.text = "Home Screen Widgets"; widgetLabel.textAlignment = TouchAlignment.Right; widgetLabel.WidthRequest = 185; fix.Put(widgetLabel, 5, 11); widgetLabel.Show(); nameTextBox = new SettingsTextBox("Name"); nameTextBox.Visible = false; fix.Put(nameTextBox, 5, 40); moduleComboBox = new SettingsComboBox("Module"); moduleComboBox.combo.nonActiveMessage = "Please select module"; moduleComboBox.combo.maxListHeight = 6; moduleComboBox.combo.ComboChangedEvent += OnModuleComboChanged; moduleComboBox.Visible = false; moduleComboBox.ButtonReleaseEvent += (o, args) => SwapTypeComboToTop(); fix.Put(moduleComboBox, 5, 40); nameComboBox = new SettingsComboBox("Name"); nameComboBox.combo.nonActiveMessage = "Please select name"; nameComboBox.combo.maxListHeight = 3; nameComboBox.combo.ComboChangedEvent += OnModuleComboChanged; nameComboBox.Visible = false; nameComboBox.ButtonReleaseEvent += (o, args) => SwapTypeComboToTop(); fix.Put(nameComboBox, 5, 40); groupComboBox = new SettingsComboBox("Group"); groupComboBox.combo.nonActiveMessage = "Please select group"; groupComboBox.combo.maxListHeight = 3; groupComboBox.Visible = false; groupComboBox.ButtonReleaseEvent += (o, args) => SwapTypeComboToTop(); fix.Put(groupComboBox, 305, 40); typeCombo = new TouchComboBox(); typeCombo.comboList.Add("Line Plot"); typeCombo.comboList.Add("Curved Bar Plot"); typeCombo.comboList.Add("Button"); typeCombo.comboList.Add("Timer"); typeCombo.comboList.Add("Bar Plot"); typeCombo.nonActiveMessage = "Select type"; typeCombo.WidthRequest = 400; typeCombo.maxListHeight = 6; typeCombo.ComboChangedEvent += OnTypeComboChanged; fix.Put(typeCombo, 195, 5); typeCombo.Show(); Add(fix); fix.Show(); }