From 9c31cf53bee2fda60abe5b3687c3a8ed8b5e5e5c Mon Sep 17 00:00:00 2001 From: AShifter Date: Sat, 14 Oct 2017 21:45:59 -0600 Subject: Finish Skinning and Serialize Current Skin Almost fixed the contect button glitch and i'm using Newtonsoft.JSON to save skins! --- .../ShiftOS/Apps/ShifterStuff/SelectColor.cs | 6 ++--- .../ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs | 23 ++++++++++++++--- ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs | 29 ++++++++++++++++++++++ 3 files changed, 51 insertions(+), 7 deletions(-) (limited to 'ShiftOS.Main/ShiftOS/Apps') diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs index 7a97915..f26fe4d 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -26,12 +26,12 @@ namespace ShiftOS.Main.ShiftOS.Apps { _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); - /* + foreach (var window in ShiftWM.Windows) { - window.Invoke(new Action(() => window.top.BackColor = _finalColor)); + window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor)); } - */ + ShiftWM.StartInfoboxSession("Success!", $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.", InfoboxTemplate.ButtonType.Ok); } diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs index 47bc115..ac81a5c 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs @@ -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,7 +88,7 @@ // 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; @@ -98,7 +100,7 @@ // 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; @@ -110,7 +112,7 @@ // 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; @@ -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..609b617 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs @@ -3,6 +3,8 @@ using System.Windows.Forms; using ShiftOS.Engine; using ShiftOS.Engine.WindowManager; using System.Drawing; +using System.IO; +using Newtonsoft.Json; namespace ShiftOS.Main.ShiftOS.Apps { @@ -35,6 +37,9 @@ namespace ShiftOS.Main.ShiftOS.Apps 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); } @@ -45,6 +50,9 @@ namespace ShiftOS.Main.ShiftOS.Apps 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); } @@ -80,5 +88,26 @@ namespace ShiftOS.Main.ShiftOS.Apps } } + + 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); + } } } -- cgit v1.2.3