Skip to content
Snippets Groups Projects
Commit 596741ad authored by Stephen D's avatar Stephen D
Browse files

Implemented disconnect button on Arrow Key version, may not work(Can't test)

parent baf9b082
No related branches found
No related tags found
No related merge requests found
......@@ -143,6 +143,7 @@ namespace Arduino_Robot
this.Invoke((MethodInvoker)delegate
{
connectStatus.Text = "Connecting...";
retryConnection.Text = "Connect";
retryConnection.Enabled = false;
});
}
......@@ -158,6 +159,8 @@ namespace Arduino_Robot
this.Invoke((MethodInvoker)delegate
{
connectStatus.Text = "Connected";
retryConnection.Text = "Disconnect";
retryConnection.Enabled = true;
});
}
catch
......@@ -167,6 +170,7 @@ namespace Arduino_Robot
this.Invoke((MethodInvoker)delegate
{
connectStatus.Text = "Error connecting";
retryConnection.Text = "Connected";
retryConnection.Enabled = true;
});
}
......@@ -195,10 +199,18 @@ namespace Arduino_Robot
}
private void retryConnection_Click(object sender, EventArgs e)
{
//Start connection thread
Thread connector = new Thread(new ThreadStart(getConnection));
connector.IsBackground = true;
connector.Start();
if(retryConnection.Text = "Connect")
{
//Start connection thread
Thread connector = new Thread(new ThreadStart(getConnection));
connector.IsBackground = true;
connector.Start();
}
else if(retryConnection.Text = "Disconnect")
{
client.Close();
retryConnection.Text = "Connect";
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment