Beispiel #1
0
        static void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                InternetAvailable = true;

                InternetConnected?.Invoke(true);
            }
            else
            {
                // System.Windows.Forms.MessageBox.Show(e.Error.Message);
            }
        }
Beispiel #2
0
        public bool IsConnected()
        {
            // Attempt to reconnect regularly
            if (!_isConnected && IsInternetConnected())
            {
                Task.Run(async() =>
                {
                    if (await Connect())
                    {
                        InternetConnected?.Invoke();
                    }
                });
            }

            return(_isConnected);
        }