1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
using System;
using System.Drawing;
using System.Windows.Forms;
using ShiftOS.Engine.WindowManager;
namespace ShiftOS.Main.ShiftOS.Apps
{
public partial class SelectColor : UserControl
{
Color _finalColor;
int _colorType1;
int _colorType2;
int _colorType3;
public SelectColor()
{
InitializeComponent();
}
private void btnSetColor_Click(object sender, EventArgs e)
{
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, InfoboxTemplate.ErrorIcon.Critical);
}
if (_colorType1 > 255 || _colorType2 > 255 || _colorType3 > 255)
{
ShiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.ButtonType.Ok, InfoboxTemplate.ErrorIcon.Critical);
}
else
{
try
{
ShiftWindow sw = new ShiftWindow();
_finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3);
ShiftWM.SetTitleBarColor(_finalColor);
ShiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + _colorType1.ToString() + ", " + _colorType2.ToString() + ", " + _colorType3.ToString() + ".", InfoboxTemplate.ButtonType.Ok, InfoboxTemplate.ErrorIcon.Info);
}
catch (Exception)
{
ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok, InfoboxTemplate.ErrorIcon.Critical);
}
}
}
}
}
|