Skip to content

Portable Tool for an Ideal Windows Setup

-simplified noty call

Greedeks4247c6ae3a46
diff --git a/.Source/GTweak/Utilities/Control/SettingsRepository.cs b/.Source/GTweak/Utilities/Control/SettingsRepository.cs
index 2b2c8eb2..761c023e 100644
--- a/.Source/GTweak/Utilities/Control/SettingsRepository.cs
+++ b/.Source/GTweak/Utilities/Control/SettingsRepository.cs
@@ -8,7 +8,6 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
-using System.Windows;
namespace GTweak.Utilities.Control
{
@@ -102,7 +101,7 @@ namespace GTweak.Utilities.Control
internal static void SaveFileConfig()
{
if (INIManager.IsAllTempDictionaryEmpty)
- new ViewNotification().Show("", "info", (string)Application.Current.Resources["export_warning_notification"]);
+ new ViewNotification().Show("", "info", "export_warning_notification");
else
{
SaveFileDialog saveFileDialog = new SaveFileDialog
@@ -154,10 +153,10 @@ namespace GTweak.Utilities.Control
if (File.ReadLines(StoragePaths.Config).Any(line => line.Contains("TglButton")) || File.ReadLines(StoragePaths.Config).Any(line => line.Contains("Slider")))
new ImportWindow(openFileDialog.SafeFileName).ShowDialog();
else
- new ViewNotification().Show("", "info", (string)Application.Current.Resources["import_empty_notification"]);
+ new ViewNotification().Show("", "info", "import_empty_notification");
}
else
- new ViewNotification().Show("", "info", (string)Application.Current.Resources["import_warning_notification"]);
+ new ViewNotification().Show("", "info", "import_warning_notification");
}
internal static void SelfRemoval()
diff --git a/.Source/GTweak/Utilities/Control/ViewNotification.cs b/.Source/GTweak/Utilities/Control/ViewNotification.cs
index 49c5b307..57e776a4 100644
--- a/.Source/GTweak/Utilities/Control/ViewNotification.cs
+++ b/.Source/GTweak/Utilities/Control/ViewNotification.cs
@@ -27,7 +27,7 @@ namespace GTweak.Utilities.Control
"info" => (string)Application.Current.Resources["title_info_notification"],
_ => string.Empty,
},
- TextNotice = content,
+ TextNotice = (string)Application.Current.Resources[content],
ActionNotice = action,
};
diff --git a/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs b/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs
index f0bdd758..bbf4d2a6 100644
--- a/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs
@@ -7,7 +7,6 @@ using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Threading.Tasks;
-using System.Windows;
namespace GTweak.Utilities.Tweaks
{
@@ -214,7 +213,7 @@ namespace GTweak.Utilities.Tweaks
{
BackgroundQueue backgroundQueue = new BackgroundQueue();
await backgroundQueue.QueueTask(delegate { ClearFileSystemCache(true); EmptyWorkingSetFunction(); ClearTempSystemCache(); });
- new ViewNotification(500).Show("", "info", (string)Application.Current.Resources["clear_ram_notification"]);
+ new ViewNotification(500).Show("", "info", "clear_ram_notification");
}
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/Firewall.cs b/.Source/GTweak/Utilities/Tweaks/Firewall.cs
index 245f14fb..5edda969 100644
--- a/.Source/GTweak/Utilities/Tweaks/Firewall.cs
+++ b/.Source/GTweak/Utilities/Tweaks/Firewall.cs
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
-using System.Windows;
namespace GTweak.Utilities.Tweaks
{
@@ -54,7 +53,7 @@ namespace GTweak.Utilities.Tweaks
ChangeRules(isChoose, executableFiles.Item1, executableFiles.Item2, NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_OUT);
});
}
- catch { new ViewNotification().Show("", "warn", (string)Application.Current.Resources["firewalloff_notification"]); }
+ catch { new ViewNotification().Show("", "warn", "firewalloff_notification"); }
}
@@ -85,7 +84,7 @@ namespace GTweak.Utilities.Tweaks
protected static void BlockSpyDomain(in bool isChoose)
{
try { RulesHosts(isChoose); }
- catch { new ViewNotification().Show("", "warn", (string)Application.Current.Resources["firewalloff_notification"]); }
+ catch { new ViewNotification().Show("", "warn", "firewalloff_notification"); }
}
private static void RulesHosts(in bool isChoose)
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemMaintenance.cs b/.Source/GTweak/Utilities/Tweaks/SystemMaintenance.cs
index 0ddf1a9f..76d2493b 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemMaintenance.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemMaintenance.cs
@@ -30,12 +30,12 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\services\defragsvc", "Start", 4, RegistryValueKind.DWord);
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction", "Enable", "N", RegistryValueKind.String);
- new ViewNotification(300).Show("", "info", (string)Application.Current.Resources["success_defrag_notification"]);
+ new ViewNotification(300).Show("", "info", "success_defrag_notification");
}
- catch { new ViewNotification().Show("", "warn", (string)Application.Current.Resources["error_defrag_notification"]); }
+ catch { new ViewNotification().Show("", "warn", "error_defrag_notification"); }
}
else
- new ViewNotification().Show("", "info", (string)Application.Current.Resources["warn_defrag_notification"]);
+ new ViewNotification().Show("", "info", "warn_defrag_notification");
}
internal static void CreateRestorePoint()
@@ -62,9 +62,9 @@ namespace GTweak.Utilities.Tweaks
OutParams = RestorePoint.InvokeMethod("CreateRestorePoint", InParams, null);
if ((uint)OutParams["ReturnValue"] == 0)
- new ViewNotification(300).Show("", "info", (string)Application.Current.Resources["successpoint_notification"]);
+ new ViewNotification(300).Show("", "info", "successpoint_notification");
else
- new ViewNotification(300).Show("", "warn", (string)Application.Current.Resources["notsuccessfulpoint_notification"]);
+ new ViewNotification(300).Show("", "warn", "notsuccessfulpoint_notification");
isWorkingCreatePoint = false;
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "SystemRestorePointCreationFrequency");
@@ -72,7 +72,7 @@ namespace GTweak.Utilities.Tweaks
catch
{
isWorkingCreatePoint = false;
- new ViewNotification().Show("", "warn", (string)Application.Current.Resources["notsuccessfulpoint_notification"]);
+ new ViewNotification().Show("", "warn", "notsuccessfulpoint_notification");
}
}
@@ -83,7 +83,7 @@ namespace GTweak.Utilities.Tweaks
EnableRecovery();
CommandExecutor.RunCommand("/c rstrui.exe");
}
- catch { new ViewNotification().Show("", "warn", (string)Application.Current.Resources["notsuccessfulrecovery_notification"]); }
+ catch { new ViewNotification().Show("", "warn", "notsuccessfulrecovery_notification"); }
}
internal static void DisableRestorePoint()
@@ -102,7 +102,7 @@ namespace GTweak.Utilities.Tweaks
DisableSR(StoragePaths.SystemDisk + @"\\");
}
else
- new ViewNotification().Show("", "info", (string)Application.Current.Resources["warndisable_recovery_notification"]);
+ new ViewNotification().Show("", "info", "warndisable_recovery_notification");
}
private static void EnableRecovery()
diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
index 695aa074..5c1bf86c 100644
--- a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
+++ b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
@@ -6,7 +6,6 @@ using System.Diagnostics;
using System.Management;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using System.Windows;
namespace GTweak.Utilities.Tweaks
{
@@ -91,9 +90,9 @@ namespace GTweak.Utilities.Tweaks
waitingWindow.Close();
if (IsWindowsActivated)
- new ViewNotification(300).Show("restart", "warn", (string)Application.Current.Resources["successactivate_notification"]);
+ new ViewNotification(300).Show("restart", "warn", "successactivate_notification");
else
- new ViewNotification(300).Show("", "warn", (string)Application.Current.Resources["notsuccessactivate_notification"]);
+ new ViewNotification(300).Show("", "warn", "notsuccessactivate_notification");
}
}
diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.cs
index 6cedff43..6b7f7faf 100644
--- a/.Source/GTweak/View/InterfaceView.xaml.cs
+++ b/.Source/GTweak/View/InterfaceView.xaml.cs
@@ -19,7 +19,7 @@ namespace GTweak.View
InitializeComponent();
if (!WindowsLicense.IsWindowsActivated)
- new ViewNotification().Show("", "info", (string)Application.Current.Resources["viewlicense_notification"]);
+ new ViewNotification().Show("", "info", "viewlicense_notification");
}
private void Tweak_MouseEnter(object sender, MouseEventArgs e)
diff --git a/.Source/GTweak/View/MoreView.xaml.cs b/.Source/GTweak/View/MoreView.xaml.cs
index 65bce23f..550c216c 100644
--- a/.Source/GTweak/View/MoreView.xaml.cs
+++ b/.Source/GTweak/View/MoreView.xaml.cs
@@ -18,10 +18,10 @@ namespace GTweak.View
private void BtnLicenseWindows_ClickButton(object sender, EventArgs e)
{
if (WindowsLicense.IsWindowsActivated)
- new ViewNotification().Show("", "info", (string)FindResource("readyactivate_notification"));
+ new ViewNotification().Show("", "info", "readyactivate_notification");
else
{
- new ViewNotification().Show("", "warn", (string)FindResource("activatewin_notification"));
+ new ViewNotification().Show("", "warn", "activatewin_notification");
WindowsLicense.StartActivation();
}
}
@@ -30,7 +30,7 @@ namespace GTweak.View
{
WaitingWindow waitingWindow = new WaitingWindow();
waitingWindow.Show();
- new ViewNotification().Show("", "info", (string)FindResource("createpoint_notification"));
+ new ViewNotification().Show("", "info", "createpoint_notification");
BackgroundQueue backgroundQueue = new BackgroundQueue();
await backgroundQueue.QueueTask(delegate { SystemMaintenance.CreateRestorePoint(); });
waitingWindow.Close();
@@ -49,7 +49,7 @@ namespace GTweak.View
{
try { SystemMaintenance.DisableRestorePoint(); } catch (Exception ex) { Debug.WriteLine(ex.Message); }
});
- await backgroundQueue.QueueTask(delegate { new ViewNotification(300).Show("", "info", (string)FindResource("disable_recovery_notification")); });
+ await backgroundQueue.QueueTask(delegate { new ViewNotification(300).Show("", "info", "disable_recovery_notification"); });
}
}
}
diff --git a/.Source/GTweak/View/PakagesView.xaml.cs b/.Source/GTweak/View/PakagesView.xaml.cs
index b9e3a454..fc42def5 100644
--- a/.Source/GTweak/View/PakagesView.xaml.cs
+++ b/.Source/GTweak/View/PakagesView.xaml.cs
@@ -94,7 +94,7 @@ namespace GTweak.View
{
timer.Stop();
- new ViewNotification().Show("", "info", (string)FindResource("onedrive_notification"));
+ new ViewNotification().Show("", "info", "onedrive_notification");
BackgroundQueue backgroundQueue = new BackgroundQueue();
await backgroundQueue.QueueTask(async delegate
diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.cs
index 8d620e7a..f8281521 100644
--- a/.Source/GTweak/View/SystemView.xaml.cs
+++ b/.Source/GTweak/View/SystemView.xaml.cs
@@ -59,10 +59,10 @@ namespace GTweak.View
{
SystemTweaks.isTweakWorkingAntivirus = true;
SystemTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);
- new ViewNotification().Show("", "info", (string)FindResource("windefender_notification"));
+ new ViewNotification().Show("", "info", "windefender_notification");
}
else if (SystemTweaks.isTweakWorkingAntivirus)
- new ViewNotification().Show("", "warn", (string)FindResource("warningwindef_notification"));
+ new ViewNotification().Show("", "warn", "warningwindef_notification");
}
}
diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.cs
index aaa12eed..969facec 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs
@@ -100,7 +100,7 @@ namespace GTweak
this.Close();
break;
case true:
- new ViewNotification().Show("", "warn", (string)FindResource("windefclose_notification"));
+ new ViewNotification().Show("", "warn", "windefclose_notification");
break;
}
}
diff --git a/.Source/GTweak/Windows/UpdateWindow.xaml.cs b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
index 867d119e..4f571566 100644
--- a/.Source/GTweak/Windows/UpdateWindow.xaml.cs
+++ b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
@@ -84,7 +84,7 @@ namespace GTweak.Windows
catch
{
this.Close();
- new ViewNotification().Show("", "warn", (string)FindResource("warn_update_notification"));
+ new ViewNotification().Show("", "warn", "warn_update_notification");
}
}
}