diff options
Diffstat (limited to 'ShiftOS.Main/ShiftOS/Apps/ShifterStuff')
4 files changed, 155 insertions, 148 deletions
diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs index a7473a0..5d50bc0 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs @@ -1,4 +1,4 @@ -namespace ShiftOS.Main.ShiftOS.Apps +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff { partial class SelectColor { diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs index f26fe4d..5e335b0 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -1,50 +1,54 @@ using System; using System.Drawing; +using System.Globalization; using System.Windows.Forms; using ShiftOS.Engine.WindowManager; -namespace ShiftOS.Main.ShiftOS.Apps +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff { - public partial class SelectColor : UserControl - { - Color _finalColor; - int _colorType1; - int _colorType2; - int _colorType3; - public SelectColor() - { - InitializeComponent(); - - } - - private Color setColor() - { - _colorType1 = Int32.Parse(redUpDown.Value.ToString()); - _colorType2 = Int32.Parse(greenUpDown.Value.ToString()); - _colorType3 = Int32.Parse(blueUpDown.Value.ToString()); - try - { - _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); - - - foreach (var window in ShiftWM.Windows) -{ - window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor)); - } - - - ShiftWM.StartInfoboxSession("Success!", $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.", InfoboxTemplate.ButtonType.Ok); - } - catch (Exception) - { - ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok); - } - return _finalColor; - } - - private void btnSetColor_Click(object sender, EventArgs e) - { - setColor(); - } - } -} + public partial class SelectColor : UserControl + { + int _colorType1; + int _colorType2; + int _colorType3; + Color _finalColor; + + public SelectColor() + { + InitializeComponent(); + } + + Color SetColor() + { + _colorType1 = int.Parse(redUpDown.Value.ToString(CultureInfo.InvariantCulture)); + _colorType2 = int.Parse(greenUpDown.Value.ToString(CultureInfo.InvariantCulture)); + _colorType3 = int.Parse(blueUpDown.Value.ToString(CultureInfo.InvariantCulture)); + try + { + _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); + + + foreach (var window in ShiftWM.Windows) + { + window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor)); + } + + + ShiftWM.StartInfoboxSession( + "Success!", + $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.", + InfoboxTemplate.ButtonType.Ok); + } + catch (Exception) + { + ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok); + } + return _finalColor; + } + + void btnSetColor_Click(object sender, EventArgs e) + { + SetColor(); + } + } +}
\ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs index ac81a5c..2ed43b4 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs @@ -1,4 +1,4 @@ -namespace ShiftOS.Main.ShiftOS.Apps +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff { partial class Shifter { @@ -94,7 +94,7 @@ this.button4.TabIndex = 4; this.button4.Text = "Set Random Skin"; this.button4.UseVisualStyleBackColor = true; - this.button4.Click += new System.EventHandler(this.setRandomSkin); + this.button4.Click += new System.EventHandler(this.SetRandomSkin); // // button3 // @@ -106,7 +106,7 @@ this.button3.TabIndex = 3; this.button3.Text = "Set Default Skin"; this.button3.UseVisualStyleBackColor = true; - this.button3.Click += new System.EventHandler(this.setDefaultSkin); + this.button3.Click += new System.EventHandler(this.SetDefaultSkin); // // button2 // @@ -118,7 +118,7 @@ this.button2.TabIndex = 2; this.button2.Text = "Set Colorful Skin"; this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.setColorSkin); + this.button2.Click += new System.EventHandler(this.SetColorSkin); // // groupBox1 // diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs index 609b617..df093f0 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs @@ -1,113 +1,116 @@ using System; -using System.Windows.Forms; -using ShiftOS.Engine; -using ShiftOS.Engine.WindowManager; using System.Drawing; using System.IO; +using System.Windows.Forms; using Newtonsoft.Json; +using ShiftOS.Engine.Misc; +using ShiftOS.Engine.WindowManager; +using ShiftOS.Main.Properties; -namespace ShiftOS.Main.ShiftOS.Apps +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff { - public partial class Shifter : UserControl - { - public int colorType; //This is a check to see what option was chosen. - public Shifter() - { - InitializeComponent(); - } + public partial class Shifter : UserControl + { + public int ColorType; //This is a check to see what option was chosen. - private void button1_Click(object sender, EventArgs e) - { - colorType = 1; - ShiftWM.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw.ToIcon()); - } + public Shifter() + { + InitializeComponent(); + } - private void setDefaultSkin(object sender, EventArgs e) - { - setBorderColor(Color.FromArgb(64, 64, 64)); - ShiftSkinData.btnCloseColor = Color.Black; - ShiftSkinData.btnMaxColor = Color.Black; - ShiftSkinData.btnMinColor = Color.Black; - button5_Click(sender, e); - } + void button1_Click(object sender, EventArgs e) + { + ColorType = 1; + ShiftWM.Init(new SelectColor(), "Select a color", Resources.iconColourPicker_fw); + } - private void setColorSkin(object sender, EventArgs e) - { - setBorderColor(Color.Blue); - ShiftSkinData.btnCloseColor = Color.Red; - ShiftSkinData.btnMaxColor = Color.Yellow; - ShiftSkinData.btnMinColor = Color.Green; - ShiftSkinData.btnCloseHoverColor = Color.FromArgb(255, 102, 102); - ShiftSkinData.btnMaxHoverColor = Color.FromArgb(255, 255, 153); - ShiftSkinData.btnMinColor = Color.FromArgb(102, 255, 102); - button5_Click(sender, e); - } + void SetDefaultSkin(object sender, EventArgs e) + { + SetBorderColor(Color.FromArgb(64, 64, 64)); + ShiftSkinData.BtnCloseColor = Color.Black; + ShiftSkinData.BtnMaxColor = Color.Black; + ShiftSkinData.BtnMinColor = Color.Black; + button5_Click(sender, e); + } - private void setRandomSkin(object sender, EventArgs e) - { - Random rnd = new Random(); - setBorderColor(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255))); - ShiftSkinData.btnCloseColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - ShiftSkinData.btnMaxColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - ShiftSkinData.btnMinColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - ShiftSkinData.btnCloseHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - ShiftSkinData.btnMaxHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - ShiftSkinData.btnMinHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - button5_Click(sender, e); - } + void SetColorSkin(object sender, EventArgs e) + { + SetBorderColor(Color.Blue); + ShiftSkinData.BtnCloseColor = Color.Red; + ShiftSkinData.BtnMaxColor = Color.Yellow; + ShiftSkinData.BtnMinColor = Color.Green; + ShiftSkinData.BtnCloseHoverColor = Color.FromArgb(255, 102, 102); + ShiftSkinData.BtnMaxHoverColor = Color.FromArgb(255, 255, 153); + ShiftSkinData.BtnMinColor = Color.FromArgb(102, 255, 102); + button5_Click(sender, e); + } - // SetBorderColor - public void setBorderColor(Color borderColor) - { - ShiftSkinData.leftTopCornerColor = borderColor; - ShiftSkinData.titleBarColor = borderColor; - ShiftSkinData.rightTopCornerColor = borderColor; - ShiftSkinData.leftSideColor = borderColor; - ShiftSkinData.rightSideColor = borderColor; - ShiftSkinData.leftBottomCornerColor = borderColor; - ShiftSkinData.bottomSideColor = borderColor; - ShiftSkinData.rightBottomCornerColor = borderColor; - } + void SetRandomSkin(object sender, EventArgs e) + { + var rnd = new Random(); + SetBorderColor(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255))); + ShiftSkinData.BtnCloseColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + ShiftSkinData.BtnMaxColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + ShiftSkinData.BtnMinColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + ShiftSkinData.BtnCloseHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + ShiftSkinData.BtnMaxHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + ShiftSkinData.BtnMinHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + button5_Click(sender, e); + } - private void button5_Click(object sender, EventArgs e) - { + // SetBorderColor + public void SetBorderColor(Color borderColor) + { + ShiftSkinData.LeftTopCornerColor = borderColor; + ShiftSkinData.TitleBarColor = borderColor; + ShiftSkinData.RightTopCornerColor = borderColor; + ShiftSkinData.LeftSideColor = borderColor; + ShiftSkinData.RightSideColor = borderColor; + ShiftSkinData.LeftBottomCornerColor = borderColor; + ShiftSkinData.BottomSideColor = borderColor; + ShiftSkinData.RightBottomCornerColor = borderColor; + } - foreach (var window in ShiftWM.Windows) - { - window.Invoke(new Action(() => window.titleBar.BackColor = ShiftSkinData.titleBarColor)); - window.Invoke(new Action(() => window.leftTopCorner.BackColor = ShiftSkinData.leftTopCornerColor)); - window.Invoke(new Action(() => window.rightTopCorner.BackColor = ShiftSkinData.rightTopCornerColor)); - window.Invoke(new Action(() => window.leftSide.BackColor = ShiftSkinData.leftSideColor)); - window.Invoke(new Action(() => window.rightSide.BackColor = ShiftSkinData.rightSideColor)); - window.Invoke(new Action(() => window.leftBottomCorner.BackColor = ShiftSkinData.leftBottomCornerColor)); - window.Invoke(new Action(() => window.bottomSide.BackColor = ShiftSkinData.bottomSideColor)); - window.Invoke(new Action(() => window.rightBottomCorner.BackColor = ShiftSkinData.rightBottomCornerColor)); - window.Invoke(new Action(() => window.btnClose.BackColor = ShiftSkinData.btnCloseColor)); - window.Invoke(new Action(() => window.btnMax.BackColor = ShiftSkinData.btnMaxColor)); - window.Invoke(new Action(() => window.btnMin.BackColor = ShiftSkinData.btnMinColor)); - - } - } + void button5_Click(object sender, EventArgs e) + { + foreach (var window in ShiftWM.Windows) + { + window.Invoke(new Action(() => window.titleBar.BackColor = ShiftSkinData.TitleBarColor)); + window.Invoke(new Action(() => window.leftTopCorner.BackColor = ShiftSkinData.LeftTopCornerColor)); + window.Invoke(new Action(() => window.rightTopCorner.BackColor = ShiftSkinData.RightTopCornerColor)); + window.Invoke(new Action(() => window.leftSide.BackColor = ShiftSkinData.LeftSideColor)); + window.Invoke(new Action(() => window.rightSide.BackColor = ShiftSkinData.RightSideColor)); + window.Invoke(new Action(() => window.leftBottomCorner.BackColor = ShiftSkinData.LeftBottomCornerColor)); + window.Invoke(new Action(() => window.bottomSide.BackColor = ShiftSkinData.BottomSideColor)); + window.Invoke(new Action(() => window.rightBottomCorner.BackColor = ShiftSkinData.RightBottomCornerColor)); + window.Invoke(new Action(() => window.btnClose.BackColor = ShiftSkinData.BtnCloseColor)); + window.Invoke(new Action(() => window.btnMax.BackColor = ShiftSkinData.BtnMaxColor)); + window.Invoke(new Action(() => window.btnMin.BackColor = ShiftSkinData.BtnMinColor)); + } + } - private void btnSave_Click(object sender, EventArgs e) - { - Color[] shiftColors = new Color[14]; - shiftColors[0] = ShiftSkinData.leftTopCornerColor; - shiftColors[1] = ShiftSkinData.titleBarColor; - shiftColors[2] = ShiftSkinData.rightTopCornerColor; - shiftColors[3] = ShiftSkinData.leftSideColor; - shiftColors[4] = ShiftSkinData.rightSideColor; - shiftColors[5] = ShiftSkinData.leftBottomCornerColor; - shiftColors[6] = ShiftSkinData.bottomSideColor; - shiftColors[7] = ShiftSkinData.rightBottomCornerColor; - shiftColors[8] = ShiftSkinData.btnCloseColor; - shiftColors[9] = ShiftSkinData.btnMaxColor; - shiftColors[10] = ShiftSkinData.btnMinColor; - shiftColors[11] = ShiftSkinData.btnCloseHoverColor; - shiftColors[12] = ShiftSkinData.btnMaxHoverColor; - shiftColors[13] = ShiftSkinData.btnMinHoverColor; - File.WriteAllText(@"C:\Users\Public\Documents\Skin.json", JsonConvert.SerializeObject(shiftColors)); - ShiftWM.StartInfoboxSession("Saved Skin", "Saved Skin to C:\\Users\\Public\\Documents\\Skin.json", InfoboxTemplate.ButtonType.Ok); - } - } -} + void btnSave_Click(object sender, EventArgs e) + { + var shiftColors = new Color[14]; + shiftColors[0] = ShiftSkinData.LeftTopCornerColor; + shiftColors[1] = ShiftSkinData.TitleBarColor; + shiftColors[2] = ShiftSkinData.RightTopCornerColor; + shiftColors[3] = ShiftSkinData.LeftSideColor; + shiftColors[4] = ShiftSkinData.RightSideColor; + shiftColors[5] = ShiftSkinData.LeftBottomCornerColor; + shiftColors[6] = ShiftSkinData.BottomSideColor; + shiftColors[7] = ShiftSkinData.RightBottomCornerColor; + shiftColors[8] = ShiftSkinData.BtnCloseColor; + shiftColors[9] = ShiftSkinData.BtnMaxColor; + shiftColors[10] = ShiftSkinData.BtnMinColor; + shiftColors[11] = ShiftSkinData.BtnCloseHoverColor; + shiftColors[12] = ShiftSkinData.BtnMaxHoverColor; + shiftColors[13] = ShiftSkinData.BtnMinHoverColor; + File.WriteAllText(@"C:\Users\Public\Documents\Skin.json", JsonConvert.SerializeObject(shiftColors)); + ShiftWM.StartInfoboxSession( + "Saved Skin", + "Saved Skin to C:\\Users\\Public\\Documents\\Skin.json", + InfoboxTemplate.ButtonType.Ok); + } + } +}
\ No newline at end of file |
