Example #1
0
        /// <summary>
        /// Prüft die Verbindung zu einer bestimmten Domain und gibt ein Bild (32px) für die Visuelle Darstellung zurück
        /// </summary>
        /// <returns>The connection.</returns>
        private System.Drawing.Bitmap CheckConnection()
        {
            labelPreviewTime.Text = DateTime.Now.ToShortTimeString();
            string host = "google.com" /*"s.geiooo.net"*//*"neustar.us"*/;

            if (Settings.Default.SettingAdvancedPing)
            {
                long ping = Networker.CheckConnectionByPingLatency(host);
                dataStore.PingLatency = ping;
                toolTip.SetToolTip(pictureBoxInternetConnection, string.Format("{0}ms on {1}", ping, host));
                if (ping < 25)
                {
                    return(Resources.WifiSignal3_32);
                }
                else if (ping < 100)
                {
                    return(Resources.WifiSignal2_32);
                }
                else if (ping < 250)
                {
                    return(Resources.WifiSignal1_32);
                }
                else if (ping < 500)
                {
                    return(Resources.WifiSignal0_32);
                }
                else
                {
                    return(Resources.WifiSignalOff);

                    toolTip.SetToolTip(pictureBoxInternetConnection, "No response in >1000ms on " + host);
                }
            }
            else
            {
                return(Networker.CheckConnectionByPing() ? Resources.WifiSignal3_32 : Resources.WifiSignalOff);
            }
        }
Example #2
0
 /// <summary>
 /// Erweiterter Konstruktor
 /// </summary>
 private void Init()
 {
     dataStore = new DataStore();
     if ((ModifierKeys.HasFlag(Keys.RShiftKey) || ModifierKeys.HasFlag(Keys.ControlKey)) && dataStore.CheckStatus() && Networker.CheckConnectionByPing())
     {
         bool success = Networker.FireAutomatedRequest(Settings.Default.defaultTitle, Settings.Default.defaultBody, Settings.Default.defaultHTML, Settings.Default.defaultVariables, Settings.Default.defaultToken, Settings.Default.defaultPriority);
         if (success)
         {
             Close();
             return;
         }
     }
     LoadSettings();
 }