From a25baf08203237fc2eeeb4b7ca720f7d47f8a666 Mon Sep 17 00:00:00 2001 From: John T Date: Wed, 27 Sep 2017 18:32:16 -0400 Subject: added desktop and some small additions and changes to shiftwm --- .../ShiftOS/Apps/ShifterStuff/SelectColor.cs | 39 +++++++++------------- ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs | 11 ++---- 2 files changed, 18 insertions(+), 32 deletions(-) (limited to 'ShiftOS.Main/ShiftOS/Apps/ShifterStuff') diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs index 9062947..697e22e 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -1,11 +1,5 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; using ShiftOS.Engine.WindowManager; @@ -13,11 +7,10 @@ namespace ShiftOS.Main.ShiftOS.Apps { public partial class SelectColor : UserControl { - ShiftWM shiftWM = new ShiftWM(); - Color finalColor; - int colorType1; - int colorType2; - int colorType3; + Color _finalColor; + int _colorType1; + int _colorType2; + int _colorType3; public SelectColor() { InitializeComponent(); @@ -28,31 +21,31 @@ namespace ShiftOS.Main.ShiftOS.Apps { try { - colorType1 = Convert.ToInt32(textBox1.Text); - colorType2 = Convert.ToInt32(textBox2.Text); - colorType3 = Convert.ToInt32(textBox3.Text); + _colorType1 = Convert.ToInt32(textBox1.Text); + _colorType2 = Convert.ToInt32(textBox2.Text); + _colorType3 = Convert.ToInt32(textBox3.Text); } - catch(Exception ex) + catch(FormatException ex) { - shiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.buttonType.OK); + ShiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.ButtonType.Ok); } - if (colorType1 > 255 || colorType2 > 255 || colorType3 > 255) + if (_colorType1 > 255 || _colorType2 > 255 || _colorType3 > 255) { - shiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.buttonType.OK); + ShiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.ButtonType.Ok); } else { try { ShiftWindow sw = new ShiftWindow(); - finalColor = Color.FromArgb(colorType1, colorType2, colorType3); - this.BackColor = finalColor; - shiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + colorType1.ToString() + ", " + colorType2.ToString() + ", " + colorType3.ToString() + ".", InfoboxTemplate.buttonType.OK); + _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); + BackColor = _finalColor; + ShiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + _colorType1.ToString() + ", " + _colorType2.ToString() + ", " + _colorType3.ToString() + ".", InfoboxTemplate.ButtonType.Ok); } - catch (Exception ex) + catch (Exception) { - shiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.buttonType.OK); + ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok); } } } diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs index 74b2079..098920f 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs @@ -1,12 +1,6 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; +using ShiftOS.Engine; using ShiftOS.Engine.WindowManager; namespace ShiftOS.Main.ShiftOS.Apps @@ -14,7 +8,6 @@ namespace ShiftOS.Main.ShiftOS.Apps public partial class Shifter : UserControl { public int colorType; //This is a check to see what option was chosen. - ShiftWM wm = new ShiftWM(); public Shifter() { InitializeComponent(); @@ -23,7 +16,7 @@ namespace ShiftOS.Main.ShiftOS.Apps private void button1_Click(object sender, EventArgs e) { colorType = 1; - wm.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw); + ShiftWM.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw.ToIcon()); } } } -- cgit v1.2.3