Exemple #1
0
        private async void gunaGradientButton1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(gunaLineTextBox1.Text) && !string.IsNullOrWhiteSpace(gunaLineTextBox1.Text)) // If the textbox isn't null
            {
                if (!gunaLineTextBox1.Text.Contains("https://") && !gunaLineTextBox1.Text.Contains("http://"))     // If the box doesn't contains https or http
                {
                    gunaLineTextBox1.Text = "https://" + gunaLineTextBox1.Text;                                    // Add the https
                }

                if (await NetworkConnection.IsAvailableTestSiteAsync(gunaLineTextBox1.Text))             // Check if the site is available
                {
                    gunaLabel2.Text = Language.WebSiteNotDownMessage;                                    // Set the text
                    WinFormsHelpers.CenterControlOnForm(gunaLabel2, this, ControlAlignement.Horizontal); // Center
                    gunaPictureBox2.Image = Properties.Resources.check;                                  // Set the image
                }
                else
                {
                    gunaLabel2.Text = Language.WebSiteDownMessage;                                       // Set the text
                    WinFormsHelpers.CenterControlOnForm(gunaLabel2, this, ControlAlignement.Horizontal); // Center
                    gunaPictureBox2.Image = Properties.Resources.cancel;                                 // Set the image
                }
            }
        }