diff options
| author | AShifter <[email protected]> | 2017-10-01 09:53:13 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-10-01 09:53:13 -0600 |
| commit | fa6be3015633dbcf4250c3fe213d284d067016bd (patch) | |
| tree | 55e0f988107830ffb809acef6d5ac8c25722ef7b /ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs | |
| parent | aa44f27eab230f464e9778a4256c330a056a7b3c (diff) | |
| parent | b45df71168d5fa3f817c45194e4019d15b3a2aa0 (diff) | |
| download | shiftos-rewind-fa6be3015633dbcf4250c3fe213d284d067016bd.tar.gz shiftos-rewind-fa6be3015633dbcf4250c3fe213d284d067016bd.tar.bz2 shiftos-rewind-fa6be3015633dbcf4250c3fe213d284d067016bd.zip | |
Merge pull request #6 from AShifter/master
Master
Diffstat (limited to 'ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs')
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs index 697e22e..f9f8f72 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -14,40 +14,31 @@ namespace ShiftOS.Main.ShiftOS.Apps public SelectColor() { InitializeComponent(); - + } private void btnSetColor_Click(object sender, EventArgs e) { + _colorType1 = Int32.Parse(redUpDown.Value.ToString()); + _colorType2 = Int32.Parse(greenUpDown.Value.ToString()); + _colorType3 = Int32.Parse(blueUpDown.Value.ToString()); try { - _colorType1 = Convert.ToInt32(textBox1.Text); - _colorType2 = Convert.ToInt32(textBox2.Text); - _colorType3 = Convert.ToInt32(textBox3.Text); - } - catch(FormatException ex) - { - ShiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.ButtonType.Ok); - } - - if (_colorType1 > 255 || _colorType2 > 255 || _colorType3 > 255) - { - ShiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.ButtonType.Ok); + _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); + //BackColor = _finalColor; + + foreach (var window in ShiftWM.Windows) +{ + window.Invoke(new Action(() => window.top.BackColor = _finalColor)); + } + + ShiftWM.StartInfoboxSession("Success!", $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.", InfoboxTemplate.ButtonType.Ok); } - else + catch (Exception) { - try - { - ShiftWindow sw = new ShiftWindow(); - _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) - { - 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); } + //return _finalColor; } } -} + } |
