示例#1
0
 static void ConnectFailedEvent(object sender, ConnectFailedEventArgs e)
 {
     Console.WriteLine("Connection failed: " + e.Message);
     Console.WriteLine("The tester will now exit.");
     Console.ReadKey();
     Environment.Exit(0);
 }
示例#2
0
        private void OnConnectFailed(object sender, ConnectFailedEventArgs e)
        {
            //Don't display the message if the connection is not relevant anymore
            if (!isConnecting) return;

            //Show the error message and revert the form to the "Enter IP address" state
            MessageBox.Show("Failed to connect to the server. Check that the server IP is entered correctly and that your connection is not being blocked by a firewall." + Environment.NewLine + "(" + e.Message + ")"
                , "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            isConnecting = false;
            btnConnect.Enabled = true;
            lblConnectionProgress.Visible = false;
            txtAddress.Visible = true;
            lblIPAddress.Visible = true;
        }