diff --git a/.Source/GTweak/Core/ViewModel/PagesViewModel.cs b/.Source/GTweak/Core/ViewModel/PagesViewModel.cs
index 929441f..625de98 100644
--- a/.Source/GTweak/Core/ViewModel/PagesViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/PagesViewModel.cs
@@ -146,7 +146,7 @@ public InformationSystemVM()
DisplayIpAddress = SystemData.СomputerСonfiguration.СonfigurationData["IpAddress"];
DisplayCountProcess = new SystemData.MonitoringSystem().CountProcess.ToString();
- if (Settings.IsHiddenIpAddress & !SystemData.СomputerСonfiguration.IsConnectionLose & !SystemData.СomputerСonfiguration.IsInternetLimited & !SystemData.СomputerСonfiguration.IsConnectionBlock)
+ if (Settings.IsHiddenIpAddress & SystemData.СomputerСonfiguration.ConnectionStatus == 0)
{
SetBlurValue = 20;
DisplayImageHidden = (DrawingImage)Application.Current.Resources["DI_Show"];
@@ -154,7 +154,7 @@ public InformationSystemVM()
else
{
SetBlurValue = 0;
- DisplayImageHidden = !SystemData.СomputerСonfiguration.IsConnectionLose & !SystemData.СomputerСonfiguration.IsInternetLimited & !SystemData.СomputerСonfiguration.IsConnectionBlock ? (DrawingImage)Application.Current.Resources["DI_Hide"] : default;
+ DisplayImageHidden = SystemData.СomputerСonfiguration.ConnectionStatus == 0 ? (DrawingImage)Application.Current.Resources["DI_Hide"] : default;
}
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemData.cs b/.Source/GTweak/Utilities/Tweaks/SystemData.cs
index 5296ba3..99f7649 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemData.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemData.cs
@@ -2,6 +2,7 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
+using System.Data;
using System.Diagnostics;
using System.Globalization;
using System.IO;
@@ -125,9 +126,15 @@ internal sealed class ClientInternetProtocol
internal sealed class СomputerСonfiguration
{
internal static string WindowsClientVersion { get; set; } = string.Empty;
- internal static bool IsConnectionLose { get; private set; } = false;
- internal static bool IsConnectionBlock { get; private set; } = false;
- internal static bool IsInternetLimited { get; private set; } = false;
+
+ ///
+ /// No connection problems - [0];
+ /// Connection lose - [1];
+ /// Conection block - [2];
+ /// Connection limited - [3].
+ ///
+ internal static byte ConnectionStatus = 0;
+
private static string _type = string.Empty;
private static readonly EnumerationOptions optionsObj = new EnumerationOptions { ReturnImmediately = true };
@@ -277,30 +284,33 @@ internal static void GetUserIP()
catch
{
СonfigurationData["IpAddress"] = (string)Application.Current.Resources["limited_systemInformation"];
- IsInternetLimited = true;
+ ConnectionStatus = 3;
}
finally
{
- if (IsInternetLimited)
- IsInternetLimited = false;
- if (IsConnectionBlock)
- IsConnectionBlock = false;
+ switch (ConnectionStatus)
+ {
+ case 2:
+ case 3:
+ ConnectionStatus = 0;
+ break;
+ }
if (IPAddress.TryParse(clientInternetProtocol.Ip, out _) && !string.IsNullOrEmpty(clientInternetProtocol.Ip) && !string.IsNullOrEmpty(clientInternetProtocol.Country))
{
- IsConnectionLose = false;
+ ConnectionStatus = 0;
СonfigurationData["IpAddress"] = clientInternetProtocol.Ip + " (" + clientInternetProtocol.Country + ")";
}
else
{
- IsConnectionBlock = true;
+ ConnectionStatus = 2;
СonfigurationData["IpAddress"] = (string)Application.Current.Resources["connection_block_systemInformation"];
}
}
}
else
{
- IsConnectionLose = true;
+ ConnectionStatus = 1;
СonfigurationData["IpAddress"] = (string)Application.Current.Resources["connection_lose_systemInformation"];
}
});
diff --git a/.Source/GTweak/View/InformationSystemView.xaml.cs b/.Source/GTweak/View/InformationSystemView.xaml.cs
index 9ccb8d5..d0c1794 100644
--- a/.Source/GTweak/View/InformationSystemView.xaml.cs
+++ b/.Source/GTweak/View/InformationSystemView.xaml.cs
@@ -27,24 +27,19 @@ public InformationSystemView()
App.LanguageChanged += delegate
{
- if (!SystemData.СomputerСonfiguration.IsConnectionLose)
+ switch (SystemData.СomputerСonfiguration.ConnectionStatus)
{
- if (SystemData.СomputerСonfiguration.IsInternetLimited)
- {
- SystemData.СomputerСonfiguration.СonfigurationData["IpAddress"] = (string)FindResource("limited_systemInformation");
- DataContext = new InformationSystemVM();
- }
- else if (SystemData.СomputerСonfiguration.IsConnectionBlock)
- {
+ case 1:
+ SystemData.СomputerСonfiguration.СonfigurationData["IpAddress"] = (string)FindResource("connection_lose_systemInformation");
+ break;
+ case 2:
SystemData.СomputerСonfiguration.СonfigurationData["IpAddress"] = (string)FindResource("connection_block_systemInformation");
- DataContext = new InformationSystemVM();
- }
- }
- else
- {
- SystemData.СomputerСonfiguration.СonfigurationData["IpAddress"] = (string)FindResource("connection_lose_systemInformation");
- DataContext = new InformationSystemVM();
+ break;
+ case 3:
+ SystemData.СomputerСonfiguration.СonfigurationData["IpAddress"] = (string)FindResource("limited_systemInformation");
+ break;
}
+ DataContext = new InformationSystemVM();
};
timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate
diff --git a/.Source/GTweak/Windows/MainWindow.xaml b/.Source/GTweak/Windows/MainWindow.xaml
index 76799c5..01b1fd4 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml
+++ b/.Source/GTweak/Windows/MainWindow.xaml
@@ -192,10 +192,10 @@
-
-
+
+
diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.cs
index 752d851..c13b56b 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs
@@ -20,8 +20,8 @@ public MainWindow()
InitializeComponent();
BtnNotification.StateNA = Settings.IsViewNotification;
- BtnTopMost.StateNA = Topmost = Settings.IsTopMost;
BtnUpdate.StateNA = Settings.IsСheckingUpdate;
+ BtnTopMost.StateNA = Topmost = Settings.IsTopMost;
BtnSoundNtn.IsChecked = Settings.IsSoundNotification;
SliderVolume.Value = Settings.VolumeNotification;
LanguageSelectionMenu.SelectedIndex = Settings.Language == "en" ? 0 : 1;