diff --git a/Microsoft.Toolkit.Uwp.Connectivity/Network/NetworkHelper.cs b/Microsoft.Toolkit.Uwp.Connectivity/Network/NetworkHelper.cs
index 04115c2dba0..abb1182541c 100644
--- a/Microsoft.Toolkit.Uwp.Connectivity/Network/NetworkHelper.cs
+++ b/Microsoft.Toolkit.Uwp.Connectivity/Network/NetworkHelper.cs
@@ -12,26 +12,11 @@ namespace Microsoft.Toolkit.Uwp.Connectivity
///
public class NetworkHelper
{
- ///
- /// Private singleton field.
- ///
- private static NetworkHelper _instance;
-
///
/// Event raised when the network changes.
///
public event EventHandler NetworkChanged;
- ///
- /// Gets public singleton property.
- ///
- public static NetworkHelper Instance => _instance ?? (_instance = new NetworkHelper());
-
- ///
- /// Gets instance of .
- ///
- public ConnectionInformation ConnectionInformation { get; } = new ConnectionInformation();
-
///
/// Initializes a new instance of the class.
///
@@ -52,6 +37,19 @@ protected NetworkHelper()
NetworkInformation.NetworkStatusChanged -= OnNetworkStatusChanged;
}
+ ///
+ /// Gets public singleton property.
+ ///
+ public static NetworkHelper Instance { get; } = new NetworkHelper();
+
+ ///
+ /// Gets instance of .
+ ///
+ public ConnectionInformation ConnectionInformation { get; }
+
+ ///
+ /// Checks the current connection information and raises if needed.
+ ///
private void UpdateConnectionInformation()
{
lock (ConnectionInformation)
@@ -69,6 +67,9 @@ private void UpdateConnectionInformation()
}
}
+ ///
+ /// Invokes when the current network status changes.
+ ///
private void OnNetworkStatusChanged(object sender)
{
UpdateConnectionInformation();