Exemplo n.º 1
0
        private void UpdateNetworkUI(Models.ConnectionState newStatus, Models.ConnectionStability newStability)
        {
            // Check for a captive portal if the settings option is enabled
            if (Manager.Settings.Network.CaptivePortalAlert)
            {
                // Attempt to resolve the captive portal detection host
                Manager.CaptivePortalDetector.ResolveCaptivePortalDetectionHost();

                // Make sure to try and detect captive portals if connection stability is unstable/no signal
                if (newStability == Models.ConnectionStability.NoSignal || newStability == Models.ConnectionStability.Unstable)
                {
                    // Initiate captive portal check if not already detected for the current network address
                    if (!Manager.CaptivePortalDetector.CaptivePortalDetected && !string.IsNullOrEmpty(Manager.Settings.Network.CaptivePortalDetectionIp))
                    {
                        Manager.Tunnel.DetectCaptivePortal();
                    }
                }

                // If captive portal is detected for the current network, monitor internet connection to determine if user has logged in to the captive portal or changed networks
                if (Manager.CaptivePortalDetector.CaptivePortalDetected && newStatus == Models.ConnectionState.Unprotected)
                {
                    if (!Manager.CaptivePortalDetector.MonitoringInternetConnection && !Manager.CaptivePortalDetector.CaptivePortalLoggedIn)
                    {
                        Manager.CaptivePortalDetector.MonitorInternetConnectivity();
                    }
                }
                else if (Manager.CaptivePortalDetector.MonitoringInternetConnection)
                {
                    Manager.CaptivePortalDetector.StopMonitorInternetConnectivity();
                }
            }
        }
Exemplo n.º 2
0
        private void UpdateTrayUI(Models.ConnectionState status, Models.ConnectionStability stability)
        {
            if (status != Models.ConnectionState.Protected)
            {
                Manager.TrayIcon.SetDisconnected();
                return;
            }

            if (stability == Models.ConnectionStability.NoSignal)
            {
                Manager.TrayIcon.SetUnstable();
                return;
            }
            else if (stability == Models.ConnectionStability.Unstable)
            {
                Manager.TrayIcon.SetIdle();
                return;
            }

            Manager.TrayIcon.SetConnected();
        }
Exemplo n.º 3
0
 private void UpdateConnectionStabilityUI(Models.ConnectionStability newStability)
 {
     viewModel.Stability = newStability;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Setter for <see cref="VpnStabilityProperty"/>.
 /// </summary>
 /// <param name="d"><see cref="DependencyObject"/>.</param>
 /// <param name="value"><see cref="DependencyProperty"/> value.</param>
 public static void SetVpnStability(DependencyObject d, Models.ConnectionStability value)
 {
     d.SetValue(VpnStabilityProperty, value);
 }