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(); }
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 DeluxeTimerWidget(string name, int row, int column) : base("Timer", name, row, column) { timerIndex = 0; SetSizeRequest(310, 169); timers = new IntervalTimer[3]; for (int i = 0; i < timers.Length; ++i) { timers[i] = IntervalTimer.GetTimer("Timer " + name + " " + (i + 1).ToString()); timers[i].TimerInterumEvent += OnTimerInterum; timers[i].TimerElapsedEvent += OnTimerElapsed; timers[i].TimerStartEvent += OnTimerStartStop; timers[i].TimerStopEvent += OnTimerStartStop; } var box2 = new TimerBackground(310, 139); box2.color = "grey4"; box2.transparency = 0.1f; Put(box2, 0, 30); tabs = new TimerTab[3]; for (int i = 2; i >= 0; --i) { tabs[i] = new TimerTab(i); tabs[i].text = "Timer " + (i + 1).ToString(); tabs[i].ButtonReleaseEvent += OnTabButtonRelease; Put(tabs[i], 90 * i, 0); tabs[i].Show(); } tabs[0].selected = true; var minuteLabel = new TouchLabel(); minuteLabel.text = "Minutes"; minuteLabel.textColor = "grey3"; Put(minuteLabel, 5, 37); minuteLabel.Show(); minutes = new TouchTextBox(); minutes.SetSizeRequest(99, 51); minutes.enableTouch = true; minutes.textSize = 16; minutes.textAlignment = TouchAlignment.Center; minutes.TextChangedEvent += (sender, args) => { try { uint time = Convert.ToUInt32(args.text) * 60; time += Convert.ToUInt32(seconds.text); UpdateTime(time); } catch { args.keepText = false; } }; Put(minutes, 3, 57); minUpDown = new TouchUpDownButtons(); minUpDown.up.ButtonReleaseEvent += (o, args) => { if (!timers[timerIndex].enabled) { uint time = (Convert.ToUInt32(minutes.text) + 1) * 60; time += Convert.ToUInt32(seconds.text); UpdateTime(time); } }; minUpDown.down.ButtonReleaseEvent += (o, args) => { if (!timers[timerIndex].enabled) { if (minutes.text != "0") { uint time = (Convert.ToUInt32(minutes.text) - 1) * 60; time += Convert.ToUInt32(seconds.text); UpdateTime(time); } } }; Put(minUpDown, 3, 113); minUpDown.Show(); var secondsLabel = new TouchLabel(); secondsLabel.text = "Seconds"; secondsLabel.textColor = "grey3"; Put(secondsLabel, 108, 37); secondsLabel.Show(); seconds = new TouchTextBox(); seconds.SetSizeRequest(98, 51); seconds.enableTouch = true; seconds.textAlignment = TouchAlignment.Center; seconds.textSize = 16; seconds.TextChangedEvent += (sender, args) => { try { uint time = Convert.ToUInt32(args.text); if (time < 60) { time += Convert.ToUInt32(minutes.text) * 60; } UpdateTime(time); } catch { args.keepText = false; } }; Put(seconds, 106, 57); secUpDown = new TouchUpDownButtons(); secUpDown.up.ButtonReleaseEvent += (o, args) => { if (!timers[timerIndex].enabled) { uint time = Convert.ToUInt32(minutes.text) * 60; time += Convert.ToUInt32(seconds.text); ++time; UpdateTime(time); } }; secUpDown.down.ButtonReleaseEvent += (o, args) => { if (!timers[timerIndex].enabled) { uint time = Convert.ToUInt32(minutes.text) * 60; time += Convert.ToUInt32(seconds.text); if (time != 0) { --time; UpdateTime(time); } } }; Put(secUpDown, 106, 113); secUpDown.Show(); startStopButton = new TouchButton(); startStopButton.SetSizeRequest(98, 51); startStopButton.ButtonReleaseEvent += OnStartStopButtonRelease; Put(startStopButton, 209, 57); startStopButton.Show(); resetButton = new TouchButton(); resetButton.SetSizeRequest(98, 51); resetButton.text = "Reset"; resetButton.ButtonReleaseEvent += OnResetButtonRelease; Put(resetButton, 209, 113); resetButton.Show(); if (timers[timerIndex].enabled) { UpdateTime(timers[timerIndex].secondsRemaining, false); } else { UpdateTime(timers[timerIndex].totalSeconds, false); } }
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 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); }