Explorar o código

Styling update.

deadmoon %!s(int64=4) %!d(string=hai) anos
pai
achega
cae2d523a2

+ 3 - 0
CHANGELOG.md

@@ -2,6 +2,9 @@
 
 All notable changes to this project will be documented in this file.
 
+## [6.2] - 2021-02-14
+- New: Nice styling to checkboxes & radios
+
 ## [6.1] - 2021-02-14
 - Improved: Disable Windows Defender
 - Improved: Uninstall OneDrive and removing all leftovers

+ 53 - 0
Optimizer/ColoredControls/ColoredCheckBox.cs

@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace Optimizer
+{
+    public class ColoredCheckBox : CheckBox
+    {
+        protected override void OnCheckedChanged(EventArgs e)
+        {
+            base.OnCheckedChanged(e);
+
+            this.Tag = "themeable";
+
+            // custom theming
+            if (this.Checked)
+            {
+                this.Font = new Font(this.Font, FontStyle.Underline);
+                switch (Options.CurrentOptions.Color)
+                {
+                    case Theme.Caramel:
+                        this.ForeColor = Color.DarkOrange;
+                        break;
+                    case Theme.Lime:
+                        this.ForeColor = Color.LimeGreen;
+                        break;
+                    case Theme.Magma:
+                        this.ForeColor = Color.Tomato;
+                        break;
+                    case Theme.Minimal:
+                        this.ForeColor = Color.Gray;
+                        break;
+                    case Theme.Ocean:
+                        this.ForeColor = Color.DodgerBlue;
+                        break;
+                    case Theme.Zerg:
+                        this.ForeColor = Color.MediumOrchid;
+                        break;
+                }
+            }
+            else
+            {
+                this.Tag = string.Empty;
+                this.ForeColor = Color.White;
+                this.Font = new Font(this.Font, FontStyle.Regular);
+            }
+        }
+    }
+}

+ 52 - 0
Optimizer/ColoredControls/ColoredRadioButton.cs

@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace Optimizer
+{
+    public class ColoredRadioButton : RadioButton
+    {
+        protected override void OnCheckedChanged(EventArgs e)
+        {
+            base.OnCheckedChanged(e);
+
+            // custom theming
+            if (this.Checked)
+            {
+                this.Tag = "themeable";
+                this.Font = new Font(this.Font, FontStyle.Underline);
+
+                switch (Options.CurrentOptions.Color)
+                {
+                    case Theme.Caramel:
+                        this.ForeColor = Color.DarkOrange;
+                        break;
+                    case Theme.Lime:
+                        this.ForeColor = Color.LimeGreen;
+                        break;
+                    case Theme.Magma:
+                        this.ForeColor = Color.Tomato;
+                        break;
+                    case Theme.Minimal:
+                        this.ForeColor = Color.Gray;
+                        break;
+                    case Theme.Ocean:
+                        this.ForeColor = Color.DodgerBlue;
+                        break;
+                    case Theme.Zerg:
+                        this.ForeColor = Color.MediumOrchid;
+                        break;
+                }
+            }
+            else
+            {
+                this.Tag = string.Empty;
+                this.Font = new Font(this.Font, FontStyle.Regular);
+            }
+        }
+    }
+}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 4435 - 4378
Optimizer/MainForm.Designer.cs


+ 10 - 9
Optimizer/MainForm.cs

@@ -10,6 +10,7 @@ using System.Diagnostics;
 using System.Net;
 using System.Threading;
 using System.Linq;
+using System.Drawing;
 
 namespace Optimizer
 {
@@ -310,7 +311,13 @@ namespace Optimizer
 
             ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
 
+            // initial states
             chkOnlyRemovable.Checked = true;
+            checkDefaultIcon.Checked = true;
+            radioProgram.Checked = true;
+            radioTop.Checked = true;
+            c64.Checked = Environment.Is64BitOperatingSystem;
+            c32.Checked = !Environment.Is64BitOperatingSystem;
 
             if (Utilities.CurrentWindowsVersion == WindowsVersion.Unsupported)
             {
@@ -358,9 +365,6 @@ namespace Optimizer
 
             LoadSettings();
 
-            radioProgram.Checked = true;
-            radioTop.Checked = true;
-
             txtVersion.Text = "Version: " + Program.GetCurrentVersionTostring();
             Program.MainForm = this;
 
@@ -382,9 +386,6 @@ namespace Optimizer
                 }
                 txtDownloadFolder.Text = Options.CurrentOptions.AppsFolder;
             }
-
-            c64.Checked = Environment.Is64BitOperatingSystem;
-            c32.Checked = !Environment.Is64BitOperatingSystem;
         }
 
         private void CleanPC()
@@ -2040,14 +2041,14 @@ namespace Optimizer
             foreach (Control c in Utilities.GetSelfAndChildrenRecursive(appsTab))
             {
                 if (c.Name == "cAutoInstall") continue;
-                if (c is CheckBox && ((CheckBox)c).Checked) maxCount++;
+                if (c is ColoredCheckBox && ((ColoredCheckBox)c).Checked) maxCount++;
             }
 
-            CheckBox currentCheck;
+            ColoredCheckBox currentCheck;
             foreach (AppInfo x in apps.Apps)
             {
                 if (string.IsNullOrEmpty(x.Tag)) continue;
-                currentCheck = (CheckBox)appsTab.Controls.Find(x.Tag, true)[0];
+                currentCheck = (ColoredCheckBox)appsTab.Controls.Find(x.Tag, true)[0];
                 if (currentCheck == null) continue;
                 if (!currentCheck.Checked) continue;
 

+ 6 - 0
Optimizer/Optimizer.csproj

@@ -88,6 +88,12 @@
     <Compile Include="ByteSize\ByteSize.cs" />
     <Compile Include="ByteSize\DecimalByteSize.cs" />
     <Compile Include="CleanHelper.cs" />
+    <Compile Include="ColoredControls\ColoredCheckBox.cs">
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="ColoredControls\ColoredRadioButton.cs">
+      <SubType>Component</SubType>
+    </Compile>
     <Compile Include="EdgeForm.cs">
       <SubType>Form</SubType>
     </Compile>

+ 1 - 1
Optimizer/Program.cs

@@ -13,7 +13,7 @@ namespace Optimizer
         // Enter current version here
 
         internal readonly static float Major = 6;
-        internal readonly static float Minor = 1;
+        internal readonly static float Minor = 2;
 
         internal static string GetCurrentVersionTostring()
         {

+ 1 - 1
README.md

@@ -44,5 +44,5 @@ https://github.com/hellzerg/optimizer/blob/master/CHANGELOG.md
 
 ## Details: ##
 
-* Latest version: 6.1
+* Latest version: 6.2
 * Released: February 14, 2021

+ 1 - 1
version.txt

@@ -1 +1 @@
-6.1
+6.2

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio