Finish Skinning and Serialize Current Skin

Almost fixed the contect button glitch and i'm using Newtonsoft.JSON to
save skins!
This commit is contained in:
AShifter 2017-10-14 21:45:59 -06:00
parent c2f59d0b9d
commit 9c31cf53be
11 changed files with 79 additions and 31 deletions

Binary file not shown.

View file

@ -34,6 +34,9 @@
<Reference Include="Magick.NET-Q16-AnyCPU, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
<HintPath>..\packages\Magick.NET-Q16-AnyCPU.7.0.7.300\lib\net40\Magick.NET-Q16-AnyCPU.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />

View file

@ -11,6 +11,9 @@ namespace ShiftOS.Engine.WindowManager
public static Color btnCloseColor = Color.Empty;
public static Color btnMaxColor = Color.Empty;
public static Color btnMinColor = Color.Empty;
public static Color btnCloseHoverColor = Color.Empty;
public static Color btnMaxHoverColor = Color.Empty;
public static Color btnMinHoverColor = Color.Empty;
public static Color leftSideColor = Color.Empty;
public static Color rightSideColor = Color.Empty;
public static Color leftBottomCornerColor = Color.Empty;

View file

@ -161,10 +161,8 @@
this.btnMax.Size = new System.Drawing.Size(21, 21);
this.btnMax.TabIndex = 6;
this.btnMax.TabStop = false;
this.btnMax.MouseDown += new System.Windows.Forms.MouseEventHandler(this.maximizebutton_MouseDown);
this.btnMax.MouseEnter += new System.EventHandler(this.maximizebutton_MouseEnter);
this.btnMax.MouseLeave += new System.EventHandler(this.maximizebutton_MouseLeave);
this.btnMax.MouseUp += new System.Windows.Forms.MouseEventHandler(this.maximizebutton_MouseUp);
//
// btnMin
//
@ -175,10 +173,8 @@
this.btnMin.Size = new System.Drawing.Size(21, 21);
this.btnMin.TabIndex = 5;
this.btnMin.TabStop = false;
this.btnMin.MouseDown += new System.Windows.Forms.MouseEventHandler(this.minimizebutton_MouseDown);
this.btnMin.MouseEnter += new System.EventHandler(this.minimizebutton_MouseEnter);
this.btnMin.MouseLeave += new System.EventHandler(this.minimizebutton_MouseLeave);
this.btnMin.MouseUp += new System.Windows.Forms.MouseEventHandler(this.minimizebutton_MouseUp);
//
// Title
//
@ -203,10 +199,8 @@
this.btnClose.TabIndex = 4;
this.btnClose.TabStop = false;
this.btnClose.Click += new System.EventHandler(this.closebutton_Click);
this.btnClose.MouseDown += new System.Windows.Forms.MouseEventHandler(this.closebutton_MouseDown);
this.btnClose.MouseEnter += new System.EventHandler(this.closebutton_MouseEnter);
this.btnClose.MouseLeave += new System.EventHandler(this.closebutton_MouseLeave);
this.btnClose.MouseUp += new System.Windows.Forms.MouseEventHandler(this.closebutton_MouseUp);
//
// rightSide
//

View file

@ -50,23 +50,25 @@ namespace ShiftOS.Engine.WindowManager
=> this.Close();
private void closebutton_MouseEnter(object sender, EventArgs e)
=> btnClose.BackColor = Color.Gray;
=> btnClose.BackColor = ShiftSkinData.btnCloseHoverColor;
private void closebutton_MouseLeave(object sender, EventArgs e)
=> btnClose.BackColor = Color.Black;
private void closebutton_MouseLeave(object sender, EventArgs e)
=> btnClose.BackColor = ShiftSkinData.btnCloseColor;
private void maximizebutton_MouseEnter(object sender, EventArgs e)
=> btnMax.BackColor = Color.Gray;
=> btnMax.BackColor = ShiftSkinData.btnMaxHoverColor;
private void maximizebutton_MouseLeave(object sender, EventArgs e)
=> btnMax.BackColor = Color.Black;
private void maximizebutton_MouseLeave(object sender, EventArgs e)
=> btnMax.BackColor = ShiftSkinData.btnMaxColor;
private void minimizebutton_MouseEnter(object sender, EventArgs e)
=> btnMin.BackColor = Color.Gray;
private void minimizebutton_MouseEnter(object sender, EventArgs e)
=> btnMin.BackColor = ShiftSkinData.btnMinHoverColor;
private void minimizebutton_MouseLeave(object sender, EventArgs e)
=> btnMin.BackColor = Color.Black;
private void minimizebutton_MouseLeave(object sender, EventArgs e)
=> btnMin.BackColor = ShiftSkinData.btnMinColor;
/*
private void closebutton_MouseDown(object sender, MouseEventArgs e)
=> btnClose.BackColor = Color.Black;
@ -75,15 +77,8 @@ namespace ShiftOS.Engine.WindowManager
private void minimizebutton_MouseDown(object sender, MouseEventArgs e)
=> btnMin.BackColor = Color.Black;
*/
private void minimizebutton_MouseUp(object sender, MouseEventArgs e)
=> btnMin.BackColor = Color.Gray;
private void maximizebutton_MouseUp(object sender, MouseEventArgs e)
=> btnMax.BackColor = Color.Gray;
private void closebutton_MouseUp(object sender, MouseEventArgs e)
=> btnClose.BackColor = Color.Gray;
}
public interface IShiftWindowExtensions

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Magick.NET-Q16-AnyCPU" version="7.0.7.300" targetFramework="net45" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
</packages>

View file

@ -31,6 +31,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -110,6 +113,7 @@
<EmbeddedResource Include="ShiftOS\Desktop.resx">
<DependentUpon>Desktop.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

View file

@ -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);
}

View file

@ -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;
}
}

View file

@ -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);
}
}
}

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
</packages>