Exemple #1
0
        protected void OnGroupComboChanged(object sender, ComboBoxChangedEventArgs e)
        {
            if (e.activeText == "New group...")
            {
                CallTemperatureGroupSettingsDialog(true);
            }
            else
            {
                groupName = e.activeText;

                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.comboList.Clear();
                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.comboList.Add("New heater...");
                heaterCombo.activeIndex = 0;
                heaterCombo.QueueDraw();
            }

            groupCombo.QueueDraw();
            GetGroupData();
            probeWidget.GetSensorData();
        }
Exemple #2
0
        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();
        }