Пример #1
0
        protected void OnComboChanged(object sender, ComboBoxChangedEventArgs args)
        {
            if (args.activeText != "New power strip...")
            {
                for (int i = 0; i < selectors.Length; ++i)
                {
                    selectors[i].Unsubscribe();
                }

                powerStripName = args.activeText;
                GetPowerData();

                var ic = IndividualControl.Empty;
                ic.Group = powerStripName;
                for (int i = 0; i < selectors.Length; ++i)
                {
                    ic.Individual = i;
                    selectors[i].Subscribe(ic);
                }
            }
            else
            {
                var parent      = Toplevel as Window;
                var numberInput = new TouchNumberInput(false, parent);
                numberInput.Title = "Address";

                numberInput.TextSetEvent += (o, a) => {
                    a.keepText = CardSettingsHelper.OnAddressSetEvent(a.text, ref powerStripName, Driver.Power);

                    if (a.keepText)
                    {
                        combo.comboList.Insert(combo.comboList.Count - 1, powerStripName);
                        foreach (var sel in selectors)
                        {
                            sel.Visible = true;
                        }
                        graphics.Visible = true;
                        combo.Visible    = false;
                        combo.Visible    = true;
                        sceneTitle       = "Power Strip";
                        GetPowerData();
                    }
                };

                numberInput.Run();
                numberInput.Destroy();

                // The number input was canceled
                if (combo.activeText == "New power strip...")
                {
                    powerStripName   = Driver.Power.firstCard;
                    combo.activeText = powerStripName;
                    GetPowerData();
                }
            }

            QueueDraw();
        }
        protected void OnComboChanged(object sender, ComboBoxChangedEventArgs args)
        {
            if (args.activeText != "New card...")
            {
                card = args.activeText;
                GetCardData();
            }
            else
            {
                var parent      = Toplevel as Window;
                var numberInput = new TouchNumberInput(false, parent);
                numberInput.Title = "Address";

                numberInput.TextSetEvent += (o, a) => {
                    a.keepText = CardSettingsHelper.OnAddressSetEvent(a.text, ref card, Driver.AnalogOutput);

                    if (a.keepText)
                    {
                        combo.comboList.Insert(combo.comboList.Count - 1, card);
                        foreach (var display in displays)
                        {
                            display.Visible = true;
                        }
                        combo.activeText = card;
                        combo.Visible    = false;
                        combo.Visible    = true;
                        sceneTitle       = "Analog Output Cards";
                        GetCardData();
                    }
                };

                numberInput.Run();
                numberInput.Destroy();

                // The number input was canceled
                if (combo.activeText == "New card...")
                {
                    card             = Driver.AnalogOutput.firstCard;
                    combo.activeText = card;
                    GetCardData();
                }
            }

            QueueDraw();
        }
Пример #3
0
        protected void OnStepButtonReleased(object sender, ButtonReleaseEventArgs e)
        {
            if (enableStepButton)
            {
                if (stepButton.text == "Start Timer")
                {
                    timerRunning           = true;
                    timerId                = GLib.Timeout.Add(200, OnUpdateTimer);
                    stepButton.text        = "Next";
                    stepButton.buttonColor = "grey2";
                    enableStepButton       = false;
                    stepButton.QueueDraw();
                }
                else if (stepButton.text == "Enter titration level")
                {
                    var number = 0d;
                    var parent = Toplevel as Window;
                    var t      = new TouchNumberInput(false, parent);
                    t.TextSetEvent += (o, a) => {
                        try {
                            number = Convert.ToDouble(a.text);
                        } catch {
                            a.keepText = false;
                        }
                    };
                    t.Run();
                    t.Destroy();

                    if (actionOption == 1)
                    {
                        tests[testIdx].level1 = number;
                    }
                    else
                    {
                        tests[testIdx].level2 = number;
                    }

                    stepButton.text        = "Next";
                    stepButton.buttonColor = "seca";
                    NextStep();
                }
                else
                {
                    if (testIdx != -1)
                    {
                        if (tests[testIdx].NotStarted)
                        {
                            stepButton.text        = "Next";
                            stepButton.buttonColor = "seca";
                            resetBtn.Visible       = true;
                            resetBtn.QueueDraw();
                        }

                        if (!tests[testIdx].Done)
                        {
                            NextStep();
                        }
                    }
                }
            }
        }