diff options
| author | Alex-TIMEHACK <[email protected]> | 2017-11-18 16:29:54 +0000 |
|---|---|---|
| committer | Alex-TIMEHACK <[email protected]> | 2017-11-18 16:29:54 +0000 |
| commit | 4037be53b29a122732cfc10693e9c0027f606bb0 (patch) | |
| tree | 8533ea9ee0ac8f5f7f696b85cb039f783657ada0 /ShiftOS.Main/ShiftOS/Apps/ShifterStuff | |
| parent | 65b7ac2b8cbc4478f6d31a21f106048aeb075078 (diff) | |
| parent | 97722fbe9d474adffbba0b92e9727c48a8205234 (diff) | |
| download | shiftos-rewind-4037be53b29a122732cfc10693e9c0027f606bb0.tar.gz shiftos-rewind-4037be53b29a122732cfc10693e9c0027f606bb0.tar.bz2 shiftos-rewind-4037be53b29a122732cfc10693e9c0027f606bb0.zip | |
Updated my fork!
Conflicts:
ShiftOS.Engine/ShiftOS.Engine.csproj
ShiftOS.Engine/Terminal/Commands/Hello.cs
ShiftOS.Engine/Terminal/TerminalBackend.cs
ShiftOS.Engine/Terminal/TerminalCommand.cs
ShiftOS.Main/ShiftOS.Main.csproj
ShiftOS.Main/ShiftOS/Apps/Terminal.cs
ShiftOS.Main/ShiftOS/Desktop.cs
Diffstat (limited to 'ShiftOS.Main/ShiftOS/Apps/ShifterStuff')
4 files changed, 176 insertions, 125 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 7a97915..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.top.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 47bc115..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 { @@ -37,6 +37,7 @@ this.groupBox1 = new System.Windows.Forms.GroupBox(); this.button1 = new System.Windows.Forms.Button(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.btnSave = new System.Windows.Forms.Button(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -57,6 +58,7 @@ // // tabPage1 // + this.tabPage1.Controls.Add(this.btnSave); this.tabPage1.Controls.Add(this.button5); this.tabPage1.Controls.Add(this.button4); this.tabPage1.Controls.Add(this.button3); @@ -74,7 +76,7 @@ // this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button5.Font = new System.Drawing.Font("Lucida Console", 8.25F); - this.button5.Location = new System.Drawing.Point(6, 267); + this.button5.Location = new System.Drawing.Point(6, 239); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(314, 23); this.button5.TabIndex = 5; @@ -86,37 +88,37 @@ // this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button4.Font = new System.Drawing.Font("Lucida Console", 8.25F); - this.button4.Location = new System.Drawing.Point(6, 209); + this.button4.Location = new System.Drawing.Point(6, 181); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(314, 23); 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 // this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button3.Font = new System.Drawing.Font("Lucida Console", 8.25F); - this.button3.Location = new System.Drawing.Point(6, 238); + this.button3.Location = new System.Drawing.Point(6, 210); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(155, 23); 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 // this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button2.Font = new System.Drawing.Font("Lucida Console", 8.25F); - this.button2.Location = new System.Drawing.Point(171, 238); + this.button2.Location = new System.Drawing.Point(171, 210); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(149, 23); 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 // @@ -150,6 +152,18 @@ this.tabPage2.Text = "tabPage2"; this.tabPage2.UseVisualStyleBackColor = true; // + // btnSave + // + this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnSave.Font = new System.Drawing.Font("Lucida Console", 8.25F); + this.btnSave.Location = new System.Drawing.Point(6, 267); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(314, 23); + this.btnSave.TabIndex = 6; + this.btnSave.Text = "Save Skin"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // // Shifter // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -175,5 +189,6 @@ private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button btnSave; } } diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs index 177942d..df093f0 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs @@ -1,84 +1,116 @@ using System; +using System.Drawing; +using System.IO; using System.Windows.Forms; -using ShiftOS.Engine; +using Newtonsoft.Json; +using ShiftOS.Engine.Misc; using ShiftOS.Engine.WindowManager; -using System.Drawing; +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. + + public Shifter() + { + InitializeComponent(); + } - private void button1_Click(object sender, EventArgs e) - { - colorType = 1; - ShiftWM.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw.ToIcon()); - } + void button1_Click(object sender, EventArgs e) + { + ColorType = 1; + ShiftWM.Init(new SelectColor(), "Select a color", Resources.iconColourPicker_fw); + } - 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 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 setColorSkin(object sender, EventArgs e) - { - setBorderColor(Color.Blue); - ShiftSkinData.btnCloseColor = Color.Red; - ShiftSkinData.btnMaxColor = Color.Yellow; - ShiftSkinData.btnMinColor = Color.Green; - 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); + } - 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)); - button5_Click(sender, e); - } + 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); + } - // 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; - } + // 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; + } - private void button5_Click(object sender, EventArgs e) - { + 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)); + } + } - 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 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 |
