public SettingsTextBox(string name) : base(name)
 {
     textBox = new TouchTextBox();
     textBox.SetSizeRequest(170, 30);
     textBox.enableTouch = true;
     textBox.name        = name;
     Put(textBox, 120, 0);
     textBox.Show();
 }
示例#2
0
        public AnalogChannelDisplay()
        {
            SetSizeRequest(710, 50);

            label = new TouchLabel();
            label.WidthRequest = 490;
            Put(label, 5, 0);
            label.Show();

            textBox = new TouchTextBox();
            textBox.WidthRequest      = 175;
            textBox.TextChangedEvent += (sender, args) => {
                try {
                    currentValue = Convert.ToSingle(args.text);
                    ValueChanged();
                } catch {
                    ;
                }
            };
            Put(textBox, 0, 20);
            textBox.Show();

            progressBar = new TouchProgressBar(TouchOrientation.Horizontal);
            progressBar.WidthRequest          = 425;
            progressBar.ProgressChangedEvent += (sender, args) => {
                currentValue = args.currentProgress * divisionSteps;
                ValueChanged();
            };
            Put(progressBar, 185, 20);
            progressBar.Show();

            typeLabel               = new TouchLabel();
            typeLabel.Visible       = false;
            typeLabel.WidthRequest  = 200;
            typeLabel.textAlignment = TouchAlignment.Right;
            Put(typeLabel, 500, 0);

            forceButton = new TouchButton();
            forceButton.SetSizeRequest(85, 30);
            forceButton.buttonColor         = "grey4";
            forceButton.text                = "Force";
            forceButton.ButtonReleaseEvent += OnForceReleased;
            Put(forceButton, 620, 20);
            forceButton.Show();

            Show();
        }
示例#3
0
        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();
        }
示例#4
0
        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();
        }
示例#5
0
        public CalibrationDialog(
            string name,
            Window parent,
            GetCalibrationValueHandler GetCalibrationValue,
            CalibrationState startingState = CalibrationState.ZeroValue)
            : base(name + " Calibration", parent, DialogFlags.DestroyWithParent)
        {
            Name           = "AquaPic.Calibration." + name;
            WindowPosition = (WindowPosition)4;
            SetSizeRequest(600, 300);
#if RPI_BUILD
            Decorated = false;

            ExposeEvent += (o, args) => {
                using (Context 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 (var w in Children)
            {
                Remove(w);
                w.Destroy();
            }

            ExposeEvent += OnExpose;

            this.GetCalibrationValue = GetCalibrationValue;
            if ((startingState == CalibrationState.ZeroActual) || (startingState == CalibrationState.ZeroValue))
            {
                calState = startingState;
            }
            else
            {
                calState = CalibrationState.ZeroValue;
            }
            calArgs = new CalibrationArguments();
            forced  = false;
            init    = false;

            fix = new Fixed();
            fix.SetSizeRequest(600, 300);

            tv = new TextView();
            tv.ModifyFont(Pango.FontDescription.FromString("Sans 11"));
            tv.ModifyBase(StateType.Normal, TouchColor.NewGtkColor("grey4"));
            tv.ModifyText(StateType.Normal, TouchColor.NewGtkColor("black"));
            tv.CanFocus = false;
            tv.Editable = false;

            ScrolledWindow sw = new ScrolledWindow();
            sw.SetSizeRequest(580, 225);
            sw.Add(tv);
            tv.Show();
            fix.Put(sw, 10, 25);
            sw.Show();

            var l = new TouchLabel();
            l.text          = name;
            l.WidthRequest  = 600;
            l.textAlignment = TouchAlignment.Center;
            fix.Put(l, 0, 3);
            l.Show();

            valTb = new TouchTextBox();
            valTb.SetSizeRequest(110, 30);
            valTb.textAlignment   = TouchAlignment.Center;
            valTb.backgroundColor = "grey1";
            if (calState == CalibrationState.ZeroActual)
            {
                valTb.text              = "Enter Actual";
                valTb.enableTouch       = true;
                valTb.backgroundColor   = "grey4";
                valTb.TextChangedEvent += OnValueTextBoxTextChanged;
            }
            else
            {
                valTb.text = GetCalibrationValue().ToString("F2");
            }
            fix.Put(valTb, 10, 260);
            valTb.Show();

            actionBtn = new TouchButton();
            actionBtn.SetSizeRequest(150, 30);
            if (calState == CalibrationState.ZeroActual)
            {
                actionBtn.text = "Zero Actual";
            }
            else
            {
                actionBtn.text = "Zero Value";
            }
            actionBtn.ButtonReleaseEvent += OnActionButtonReleaseEvent;
            fix.Put(actionBtn, 440, 260);
            actionBtn.Show();

            var cancelBtn = new TouchButton();
            cancelBtn.SetSizeRequest(100, 30);
            cancelBtn.text                = "Cancel";
            cancelBtn.buttonColor         = "compl";
            cancelBtn.ButtonReleaseEvent += (o, args) => Destroy();
            fix.Put(cancelBtn, 335, 260);
            cancelBtn.Show();

            skipBtn = new TouchButton();
            skipBtn.SetSizeRequest(100, 30);
            skipBtn.text                = "Skip";
            skipBtn.buttonColor         = "seca";
            skipBtn.ButtonReleaseEvent += OnSkipButtonReleaseEvent;
            fix.Put(skipBtn, 230, 260);
            skipBtn.Show();

            var forceBtn = new TouchButton();
            forceBtn.SetSizeRequest(100, 30);
            forceBtn.text                = "Force";
            forceBtn.buttonColor         = "grey3";
            forceBtn.ButtonReleaseEvent += OnForceButtonReleaseEvent;
            fix.Put(forceBtn, 125, 260);
            forceBtn.Show();

            Add(fix);
            fix.Show();

            timerId = GLib.Timeout.Add(1000, OnUpdateTimer);
        }