예제 #1
0
        public LinePlotWidget(string name, string group, int row, int column) : base("LinePlot", name, group, row, column)
        {
            SetSizeRequest(310, 82);

            var box1 = new TouchGraphicalBox(310, 82);

            box1.color        = "grey4";
            box1.transparency = 0.1f;
            Put(box1, 0, 0);

            linePlot = new TouchLinePlot();
            Put(linePlot, 59, 3);

            displayLabel = new TouchLabel();
            displayLabel.SetSizeRequest(200, 16);
            displayLabel.text                     = "Plot";
            displayLabel.textColor                = "grey3";
            displayLabel.textAlignment            = TouchAlignment.Left;
            displayLabel.textHorizontallyCentered = true;
            displayLabel.textRender.textWrap      = TouchTextWrap.Shrink;
            Put(displayLabel, 3, 63);

            textBox = new TouchLabel();
            textBox.SetSizeRequest(57, 60);
            textBox.textSize                 = 19;
            textBox.text                     = "0.0";
            textBox.textColor                = "pri";
            textBox.textAlignment            = TouchAlignment.Center;
            textBox.textHorizontallyCentered = true;
            textBox.textRender.textWrap      = TouchTextWrap.Shrink;
            Put(textBox, 1, 3);

            ShowAll();
        }
        public CurvedBarPlotWidget(string name, string group, int row, int column) : base("CurvedBarPlot", name, group, row, column)
        {
            SetSizeRequest(205, 169);

            var box = new TouchGraphicalBox(205, 169);

            box.color        = "grey4";
            box.transparency = 0.1f;
            Put(box, 0, 0);

            label                     = new TouchLabel();
            label.text                = "Plot";
            label.textColor           = "grey3";
            label.WidthRequest        = 199;
            label.textAlignment       = TouchAlignment.Center;
            label.textRender.textWrap = TouchTextWrap.Shrink;
            Put(label, 3, 80);

            bar = new TouchCurvedProgressBar();
            bar.backgroundColor   = "grey3";
            bar.backgroundColor.A = 0.15f;
            bar.curveStyle        = CurveStyle.ThreeQuarterCurve;
            bar.SetSizeRequest(199, 163);
            Put(bar, 3, 3);

            fullScale = 100.0f;

            textBox = new TouchLabel();
            textBox.SetSizeRequest(199, 30);
            textBox.textSize      = 20;
            textBox.text          = "0.0";
            textBox.textColor     = "pri";
            textBox.textAlignment = TouchAlignment.Center;
            Put(textBox, 3, 130);
        }
        public SettingsWidget(string name)
        {
            SetSizeRequest(290, 30);

            optionalSetting = false;

            label = new TouchLabel();
            label.SetSizeRequest(115, 30);
            label.textAlignment            = TouchAlignment.Right;
            label.textRender.textWrap      = TouchTextWrap.Shrink;
            label.textHorizontallyCentered = true;
            label.text = name;
            Put(label, 0, 0);
            label.Show();

            Show();
        }
        public WaterLevelLinePlot(string group, int row, int column) : base("Water Level", group, row, column)
        {
            text = "No Water Level";
            unitOfMeasurement = UnitsOfMeasurement.Inches;

            label = new TouchLabel();
            label.SetSizeRequest(152, 16);
            label.textColor                = "compl";
            label.textAlignment            = TouchAlignment.Right;
            label.textHorizontallyCentered = true;
            Put(label, 155, 63);

            this.group = group;
            if (WaterLevel.CheckWaterLevelGroupKeyNoThrow(this.group))
            {
                var dataLogger = WaterLevel.GetWaterLevelGroupDataLogger(this.group);
                linePlot.LinkDataLogger(dataLogger);

                Destroyed += (obj, args) => {
                    linePlot.UnLinkDataLogger(dataLogger);
                };

                text = string.Format("{0} Water Level", this.group);

                WidgetReleaseEvent += (o, args) => {
                    AquaPicGui.AquaPicUserInterface.ChangeScreens("Water Level", Toplevel, AquaPicGui.AquaPicUserInterface.currentScene, this.group);
                };
            }
            else
            {
                this.group = string.Empty;
            }

            linePlot.rangeMargin = 1;
            linePlot.eventColors.Add("probe disconnected", new TouchColor("secb", 0.25));
            linePlot.eventColors.Add("ato started", new TouchColor("seca", 0.5));
            linePlot.eventColors.Add("ato stopped", new TouchColor("secc", 0.5));
            linePlot.eventColors.Add("low alarm", new TouchColor("compl", 0.25));
            linePlot.eventColors.Add("high alarm", new TouchColor("compl", 0.25));
            linePlot.eventColors.Add("disconnected alarm", new TouchColor("compl", 0.25));
        }
        public DigitalDisplay()
        {
            SetSizeRequest(120, 140);

            label = new TouchLabel();
            label.WidthRequest        = 120;
            label.textAlignment       = TouchAlignment.Center;
            label.textRender.textWrap = TouchTextWrap.Shrink;
            label.textColor           = "grey3";
            Put(label, 0, 35);

            textBox               = new TouchLabel();
            textBox.text          = "Open";
            textBox.textColor     = "seca";
            textBox.textAlignment = TouchAlignment.Center;
            textBox.textSize      = 20;
            textBox.SetSizeRequest(120, 30);
            Put(textBox, 0, 0);

            button                     = new TouchButton();
            button.text                = "Force";
            button.buttonColor         = "grey3";
            button.ButtonReleaseEvent += OnForceReleased;
            button.SetSizeRequest(120, 30);
            Put(button, 0, 55);

            selector = new TouchSelectorSwitch(2);
            selector.SetSizeRequest(120, 30);
            selector.sliderSize            = MySliderSize.Large;
            selector.textOptions[0]        = "Open";
            selector.textOptions[1]        = "Closed";
            selector.sliderColorOptions[0] = "grey2";
            selector.sliderColorOptions[1] = "pri";
            selector.SelectorChangedEvent += OnSelectorChange;
            selector.Visible = false;
            Put(selector, 0, 90);

            Show();
        }
        public PhProbeLinePlot(string group, int row, int column) : base("pH Probe", group, row, column)
        {
            text = "No pH Probe";
            unitOfMeasurement    = UnitsOfMeasurement.None;
            linePlot.rangeMargin = 0.2;

            label = new TouchLabel();
            label.SetSizeRequest(152, 16);
            label.textColor                = "compl";
            label.textAlignment            = TouchAlignment.Right;
            label.textHorizontallyCentered = true;
            Put(label, 155, 63);

            this.group = group;
            if (Sensors.PhProbes.CheckGadgetKeyNoThrow(this.group))
            {
                var dataLogger = Sensors.PhProbes.GetPhProbeDataLogger(this.group);
                linePlot.LinkDataLogger(dataLogger);

                Destroyed += (obj, args) => {
                    linePlot.UnLinkDataLogger(dataLogger);
                };

                text = string.Format("{0} pH", this.group);

                WidgetReleaseEvent += (o, args) => {
                    AquaPicGui.AquaPicUserInterface.ChangeScreens("Sensors", Toplevel, AquaPicGui.AquaPicUserInterface.currentScene, this.group);
                };
            }
            else
            {
                this.group = string.Empty;
            }

            linePlot.rangeMargin = 1;
            linePlot.eventColors.Add("probe disconnected", new TouchColor("secb", 0.25));
            linePlot.eventColors.Add("disconnected alarm", new TouchColor("compl", 0.25));
        }
예제 #7
0
        public BarPlotWidget(string name, string group, int row, int column) : base("BarPlot", name, group, row, column)
        {
            SetSizeRequest(100, 169);

            var box = new TouchGraphicalBox(100, 169);

            box.color        = "grey4";
            box.transparency = 0.1f;
            Put(box, 0, 0);

            nameLabel                        = new TouchLabel();
            nameLabel.text                   = "Plot";
            nameLabel.textColor              = "grey3";
            nameLabel.HeightRequest          = 151;
            nameLabel.WidthRequest           = 5;
            nameLabel.textAlignment          = TouchAlignment.Center;
            nameLabel.textRender.textWrap    = TouchTextWrap.Shrink;
            nameLabel.textRender.orientation = TouchOrientation.Vertical;
            Put(nameLabel, 82, 9);

            bar = new TouchProgressBar();
            bar.colorBackground   = "grey3";
            bar.colorBackground.A = 0.15f;
            bar.SetSizeRequest(26, 161);
            Put(bar, 56, 4);

            fullScale = 100.0f;

            textBox = new TouchLabel();
            textBox.SetSizeRequest(53, 30);
            textBox.textSize      = 14;
            textBox.text          = "0.0";
            textBox.textColor     = "pri";
            textBox.textAlignment = TouchAlignment.Center;
            Put(textBox, 0, 49);
        }
예제 #8
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();
        }