Skip to content

Portable Tool for an Ideal Windows Setup

-fixed noty block, refactoring

Greedeksd3ad36ffb687
diff --git a/.Source/GTweak/Core/Model/MainModel.cs b/.Source/GTweak/Core/Model/MainModel.cs
index c77c884c..7db3e04f 100644
--- a/.Source/GTweak/Core/Model/MainModel.cs
+++ b/.Source/GTweak/Core/Model/MainModel.cs
@@ -6,8 +6,8 @@ namespace GTweak.Core.Model
{
internal sealed class InterfaceModel
{
- internal bool BlockForWin10 { get; set; } = true;
- internal bool BlockWithoutLicense { get; set; } = true;
+ internal bool IsBlockWin10 { get; set; }
+ internal bool IsBlockLicense { get; set; }
}
internal sealed class InformationSystemModel
diff --git a/.Source/GTweak/Core/ViewModel/PagesViewModel.cs b/.Source/GTweak/Core/ViewModel/PagesViewModel.cs
index 316fd09a..f7e3ce51 100644
--- a/.Source/GTweak/Core/ViewModel/PagesViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/PagesViewModel.cs
@@ -1,7 +1,7 @@
-using GTweak.Utilities;
-using GTweak.Core.Model;
-using System.Windows;
+using GTweak.Core.Model;
+using GTweak.Utilities;
using GTweak.Utilities.Tweaks;
+using System.Windows;
namespace GTweak.Core.ViewModel
{
@@ -9,31 +9,23 @@ namespace GTweak.Core.ViewModel
internal class InterfaceVM : ViewModelBase
{
private readonly MainModel.InterfaceModel _model;
- public bool SetBlockForWin10
+ public bool IsBlockForWin10
{
- get => _model.BlockForWin10;
- set { _model.BlockForWin10 = value; OnPropertyChanged(); }
+ get => _model.IsBlockWin10;
+ set { _model.IsBlockWin10 = value; OnPropertyChanged(); }
}
- public bool SetBlockWithoutLicense
+ public bool IsBlockWithoutLicense
{
- get => _model.BlockWithoutLicense;
- set { _model.BlockWithoutLicense = value; OnPropertyChanged(); }
+ get => _model.IsBlockLicense;
+ set { _model.IsBlockLicense = value; OnPropertyChanged(); }
}
public InterfaceVM()
{
_model = new MainModel.InterfaceModel();
-
- SetBlockForWin10 = SystemData.СomputerСonfiguration.clientWinVersion.Contains("11");
-
- SetBlockWithoutLicense = WindowsLicense.statusLicense == 1;
-
- if (WindowsLicense.statusLicense != 1)
- {
- App.ViewLang();
- new ViewNotification().Show("", (string)Application.Current.Resources["title1_notification"], (string)Application.Current.Resources["viewlicense_notification"]);
- }
+ IsBlockForWin10 = SystemData.СomputerСonfiguration.clientWinVersion.Contains("11");
+ IsBlockWithoutLicense = WindowsLicense.statusLicense == 1;
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemData.cs b/.Source/GTweak/Utilities/Tweaks/SystemData.cs
index d32c1177..2ba79f60 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemData.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemData.cs
@@ -125,7 +125,7 @@ namespace GTweak.Utilities
internal sealed class СomputerСonfiguration
{
- internal static string clientWinVersion = default;
+ internal static string clientWinVersion = string.Empty;
internal static bool isNoInternetConnection = false, isInternetLimited = false;
private static string _type = string.Empty;
private static readonly EnumerationOptions optionsObj = new EnumerationOptions { ReturnImmediately = true };
diff --git a/.Source/GTweak/Utilities/ViewNotification.cs b/.Source/GTweak/Utilities/ViewNotification.cs
index a14b6bfe..cfd9b42e 100644
--- a/.Source/GTweak/Utilities/ViewNotification.cs
+++ b/.Source/GTweak/Utilities/ViewNotification.cs
@@ -25,7 +25,7 @@ namespace GTweak.Utilities
{
NotificationWindow notificationWindow = new NotificationWindow();
- Parallel.Invoke(() =>
+ Parallel.Invoke(async() =>
{
if (notificationWindow.IsLoaded || isAlreadyLaunch)
return;
@@ -38,7 +38,7 @@ namespace GTweak.Utilities
TextNotice = content,
ActionChoice = action,
};
-
+ await Task.Delay(200);
notificationWindow.Show();
notificationWindow.Closed += (s, e) => { isAlreadyLaunch = false; };
diff --git a/.Source/GTweak/View/ConfidentialityView.xaml.cs b/.Source/GTweak/View/ConfidentialityView.xaml.cs
index 67402b55..e957ea16 100644
--- a/.Source/GTweak/View/ConfidentialityView.xaml.cs
+++ b/.Source/GTweak/View/ConfidentialityView.xaml.cs
@@ -42,7 +42,6 @@ namespace GTweak.View
ToggleButton toggleButton = (ToggleButton)sender;
Parallel.Invoke(() => ConfidentialityTweaks.UseСonfidentiality(toggleButton.Name, toggleButton.State));
- await Task.Delay(200);
switch (toggleButton.Name)
{
case "TglButton8":
diff --git a/.Source/GTweak/View/InterfaceView.xaml b/.Source/GTweak/View/InterfaceView.xaml
index a57e8b79..ba07b579 100644
--- a/.Source/GTweak/View/InterfaceView.xaml
+++ b/.Source/GTweak/View/InterfaceView.xaml
@@ -10,7 +10,7 @@
d:DesignHeight="550" d:DesignWidth="1100"
Style="{StaticResource LaunchPage}" Loaded="Page_Loaded" KeyDown="Page_KeyDown">
<UserControl.DataContext>
- <vm:InterfaceVM />
+ <vm:InterfaceVM/>
</UserControl.DataContext>
<Grid>
@@ -34,9 +34,9 @@
<uc:ToggleButton x:Name="TglButton3" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl3_interface}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
<uc:ToggleButton x:Name="TglButton4" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl4_interface}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
<uc:ToggleButton x:Name="TglButton5" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl5_interface}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
- <uc:ToggleButton x:Name="TglButton6" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl6_interface}" IsEnabled="{Binding SetBlockWithoutLicense}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
- <uc:ToggleButton x:Name="TglButton7" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl7_interface}" IsEnabled="{Binding SetBlockWithoutLicense}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
- <uc:ToggleButton x:Name="TglButton8" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl8_interface}" IsEnabled="{Binding SetBlockWithoutLicense}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
+ <uc:ToggleButton x:Name="TglButton6" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl6_interface}" IsEnabled="{Binding IsBlockWithoutLicense}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
+ <uc:ToggleButton x:Name="TglButton7" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl7_interface}" IsEnabled="{Binding IsBlockWithoutLicense}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
+ <uc:ToggleButton x:Name="TglButton8" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl8_interface}" IsEnabled="{Binding IsBlockWithoutLicense}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
<uc:ToggleButton x:Name="TglButton9" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl9_interface}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
<uc:ToggleButton x:Name="TglButton10" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl10_interface}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
<uc:ToggleButton x:Name="TglButton11" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl11_interface}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
@@ -50,11 +50,11 @@
<Grid Grid.Column="1">
<StackPanel Orientation="Vertical" VerticalAlignment="Top" Width="Auto" Height="Auto">
- <uc:ToggleButton x:Name="TglButton15" Height="25" Width="Auto" Margin="20,15,0,0" DynamicText="{DynamicResource tgl15_interface}" IsEnabled="{Binding SetBlockForWin10}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
- <uc:ToggleButton x:Name="TglButton16" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl16_interface}" IsEnabled="{Binding SetBlockForWin10}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
- <uc:ToggleButton x:Name="TglButton17" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl17_interface}" IsEnabled="{Binding SetBlockForWin10}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
- <uc:ToggleButton x:Name="TglButton18" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl18_interface}" IsEnabled="{Binding SetBlockForWin10}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
- <uc:ToggleButton x:Name="TglButton19" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl19_interface}" IsEnabled="{Binding SetBlockForWin10}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
+ <uc:ToggleButton x:Name="TglButton15" Height="25" Width="Auto" Margin="20,15,0,0" DynamicText="{DynamicResource tgl15_interface}" IsEnabled="{Binding IsBlockForWin10}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
+ <uc:ToggleButton x:Name="TglButton16" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl16_interface}" IsEnabled="{Binding IsBlockForWin10}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
+ <uc:ToggleButton x:Name="TglButton17" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl17_interface}" IsEnabled="{Binding IsBlockForWin10}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
+ <uc:ToggleButton x:Name="TglButton18" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl18_interface}" IsEnabled="{Binding IsBlockForWin10}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
+ <uc:ToggleButton x:Name="TglButton19" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl19_interface}" IsEnabled="{Binding IsBlockForWin10}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
<uc:ToggleButton x:Name="TglButton20" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl20_interface}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
<uc:ToggleButton x:Name="TglButton21" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl21_interface}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
<uc:ToggleButton x:Name="TglButton22" Height="25" Width="Auto" Margin="20,20,0,0" DynamicText="{DynamicResource tgl22_interface}" MouseEnter="Tweak_MouseEnter" MouseLeave="Tweak_MouseLeave" ChangedState="TglButton_ChangedState"/>
diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.cs
index 14c49139..39b1b7ba 100644
--- a/.Source/GTweak/View/InterfaceView.xaml.cs
+++ b/.Source/GTweak/View/InterfaceView.xaml.cs
@@ -18,6 +18,12 @@ namespace GTweak.View
InitializeComponent();
App.LanguageChanged += (s, e) => { WorkWithText.TypeWriteAnimation((string)FindResource("defaultDescription"), TextDescription, TimeSpan.FromMilliseconds(0)); };
+
+ if (WindowsLicense.statusLicense != 1)
+ {
+ App.ViewLang();
+ new ViewNotification().Show("", (string)Application.Current.Resources["title1_notification"], (string)Application.Current.Resources["viewlicense_notification"]);
+ }
}
private void Tweak_MouseEnter(object sender, MouseEventArgs e)
@@ -48,7 +54,7 @@ namespace GTweak.View
private void Tweak_MouseLeave(object sender, MouseEventArgs e)
{
- if(TextViewColor.Visibility==Visibility.Visible)
+ if (TextViewColor.Visibility==Visibility.Visible)
TextViewColor.Visibility=Visibility.Hidden;
if (TextDescription.Text != (string)FindResource("defaultDescription"))
WorkWithText.TypeWriteAnimation((string)FindResource("defaultDescription"), TextDescription, TimeSpan.FromMilliseconds(250));
@@ -59,7 +65,6 @@ namespace GTweak.View
ToggleButton toggleButton = (ToggleButton)sender;
Parallel.Invoke(() => InterfaceTweaks.UseInterface(toggleButton.Name, toggleButton.State));
- await Task.Delay(200);
switch (toggleButton.Name)
{
case "TglButton1":
diff --git a/.Source/GTweak/View/ServicesView.xaml.cs b/.Source/GTweak/View/ServicesView.xaml.cs
index e1ec5723..106f422a 100644
--- a/.Source/GTweak/View/ServicesView.xaml.cs
+++ b/.Source/GTweak/View/ServicesView.xaml.cs
@@ -41,7 +41,6 @@ namespace GTweak.View
ToggleButton toggleButton = (ToggleButton)sender;
Parallel.Invoke(() => ServicesTweaks.UseServices(toggleButton.Name, toggleButton.State));
- await Task.Delay(200);
new ViewNotification().Show("restart");
await Task.Delay(350);
diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.cs
index 988192dc..9872be66 100644
--- a/.Source/GTweak/View/SystemView.xaml.cs
+++ b/.Source/GTweak/View/SystemView.xaml.cs
@@ -62,7 +62,6 @@ namespace GTweak.View
{
Parallel.Invoke(() => SystemTweaks.UseSystem(toggleButton.Name, toggleButton.State));
- await Task.Delay(200);
switch (toggleButton.Name)
{
case "TglButton7":