Exemple #1
0
        /// ------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Read-Decider (Online/Offline)
        /// </summary>
        public void DecideArrays(bool startUp = true)
        {
            string path = Supporter.BuildPath(Settings.Default.filePath, Settings.Default.SettingUseJSON);

            if (!Settings.Default.SettingUseLocalFile)
            {
                try
                {
                    Networker.DownloadFile(2, startUp);
                }
                catch (Exception)
                {
                    Settings.Default.SettingUseLocalFile = true;
                    DecideArrays(startUp);
                }
            }

            if (Settings.Default.SettingUseJSON)
            {
                TryReadJSONArrays(path);
            }
            else
            {
                TryReadArrays(path);
            }
        }
Exemple #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();
 }
Exemple #3
0
        private void Check()
        {
            if (Settings.Default.SettingUseLocalFile)
            {
                pictureBoxTokenURLCheck.Image = File.Exists(Settings.Default.filePath) ? Resources.TickSmall : Resources.Exclamation24;
            }
            else
            {
                dataStore.IsFileURLValid      = Networker.CheckFileURL(Settings.Default.fileURL);
                pictureBoxTokenURLCheck.Image = dataStore.IsFileURLValid ? Resources.Tick32 : Resources.Warning32;
                toolTip.SetToolTip(pictureBoxTokenURLCheck, dataStore.IsFileURLValid ? "URL is responding but its not verified that the data is correct!" : "URL isn't responding");
            }

            pictureBoxUserTokenCheck.Image = Settings.Default.userIsLoggedIn ? Resources.Tick32 : Resources.Exclamation24;
            toolTip.SetToolTip(pictureBoxUserTokenCheck, Settings.Default.userIsLoggedIn ? Settings.Default.loginName + " is logged in" : "This field have to be valid in order to send notifications.\r\nPlease type or sign in");
            pictureBoxTokenFileCheck.Image = File.Exists(Settings.Default.filePath) ? Resources.TickSmall : Resources.Exclamation24;
            pictureBoxLogCheck.Image       = File.Exists(Settings.Default.logFilePath) ? Resources.TickSmall : Resources.Exclamation24;
        }
Exemple #4
0
 /// <summary>
 /// Feuert den HTTP-POST
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnStart_Click(object sender, EventArgs e)
 {
     if (dataStore.CheckStatus(true))
     {
         labelProgress.Visible = true;
         labelProgress.Text    = "requesting....";
         bool success = Networker.FireRequest(textBoxTitle.Text, richTextBoxBody.Text, checkBoxHTML.Checked, checkBoxVariables.Checked, comboBoxTokens.SelectedIndex, checkBoxToken.Checked, comboBoxPriority.SelectedIndex, checkBoxPriority.Checked);
         if (success)
         {
             labelProgress.ForeColor = System.Drawing.Color.Green;
             labelProgress.Text      = "Success!";
         }
         else
         {
             labelProgress.ForeColor = System.Drawing.Color.Red;
             labelProgress.Text      = "Request failed";
         }
     }
     ;
 }
Exemple #5
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);
            }
        }
Exemple #6
0
 /// <summary>
 /// Event für das erneute versuchen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ChoiceButton2_Click(object sender, EventArgs e)
 {
     webExceptionDialog.Close();
     Networker.DownloadFile();
 }
Exemple #7
0
 private void textBoxTokenURL_TextChanged(object sender, EventArgs e)
 {
     Networker.CheckFileURL(textBoxTokenURL.Text);
     Check();
 }