diff options
| author | Alex-TIMEHACK <[email protected]> | 2017-10-14 16:31:58 +0100 |
|---|---|---|
| committer | Alex-TIMEHACK <[email protected]> | 2017-10-14 16:31:58 +0100 |
| commit | 5d1004015d797892181b1181a6772bb358871f83 (patch) | |
| tree | 8346a1cd8d2539cf84841c6318e35d734f96c88f /ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs | |
| parent | 59a7eabcbe37d44a1cd4a9b742ce99f423a42ff7 (diff) | |
| parent | db714a32b91ae577f256347c71137a7a41dfca37 (diff) | |
| download | shiftos-rewind-5d1004015d797892181b1181a6772bb358871f83.tar.gz shiftos-rewind-5d1004015d797892181b1181a6772bb358871f83.tar.bz2 shiftos-rewind-5d1004015d797892181b1181a6772bb358871f83.zip | |
Updated fork
Conflicts:
.vs/ShiftOS/v15/sqlite3/storage.ide
Diffstat (limited to 'ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs')
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs index 697e22e..7a97915 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -14,40 +14,37 @@ namespace ShiftOS.Main.ShiftOS.Apps public SelectColor() { InitializeComponent(); - + } - private void btnSetColor_Click(object sender, EventArgs e) + private Color setColor() { + _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); + + /* + 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; + } + + private void btnSetColor_Click(object sender, EventArgs e) + { + setColor(); } } } |
