Skip to content

Commit eb582e7

Browse files
committed
Makes progress bar status label better.
1 parent 7496c61 commit eb582e7

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

FRC-Extension/Buttons/DeployDebugButton.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,16 @@ public override async void ButtonCallback(object sender, EventArgs e)
6262
//Disable the deploy buttons
6363
DisableAllButtons();
6464
DeployManager m = new DeployManager(m_package.PublicGetService(typeof (DTE)) as DTE);
65-
await m.DeployCode(teamNumber, page, m_debugButton, m_robotProject);
65+
bool success = await m.DeployCode(teamNumber, page, m_debugButton, m_robotProject);
6666
EnableAllButtons();
67-
m_output.ProgressBarLabel = "Robot Code Deploy Successful";
67+
if (success)
68+
{
69+
m_output.ProgressBarLabel = "Robot Code Deploy Successful";
70+
}
71+
else
72+
{
73+
m_output.ProgressBarLabel = "Robot Code Deploy Failed";
74+
}
6875
}
6976
catch (SshConnectionException)
7077
{

FRC-Extension/RoboRIOCode/DeployManager.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ public DeployManager(DTE dte)
3030

3131

3232
//Uploads code to the robot and then runs it.
33-
public async Task DeployCode(string teamNumber, SettingsPageGrid page, bool debug, Project robotProject)
33+
public async Task<bool> DeployCode(string teamNumber, SettingsPageGrid page, bool debug, Project robotProject)
3434
{
3535

3636
var writer = OutputWriter.Instance;
3737

3838
if (robotProject == null)
3939
{
4040
writer.WriteLine("Robot Project not valid. Contact RobotDotNet for support.");
41-
return;
41+
return false;
4242
}
4343

4444
//Connect to Robot Async
@@ -48,7 +48,7 @@ public async Task DeployCode(string teamNumber, SettingsPageGrid page, bool debu
4848

4949
CodeReturnStruct codeReturn = await BuildAndPrepareCode(debug, robotProject);
5050

51-
if (codeReturn == null) return;
51+
if (codeReturn == null) return false;
5252

5353
writer.WriteLine("Waiting for Connection to Finish");
5454
if (await Task.WhenAny(rioConnectionTask, delayTask) == rioConnectionTask)
@@ -63,7 +63,7 @@ public async Task DeployCode(string teamNumber, SettingsPageGrid page, bool debu
6363
{
6464
//TODO: Make this error message better
6565
OutputWriter.Instance.WriteLine("Mono not properly installed. Please try reinstalling to Mono Runtime.");
66-
return;
66+
return false;
6767
}
6868
OutputWriter.Instance.WriteLine("Mono correctly installed");
6969

@@ -72,7 +72,7 @@ public async Task DeployCode(string teamNumber, SettingsPageGrid page, bool debu
7272
{
7373
OutputWriter.Instance.WriteLine("RoboRIO Image does not match plugin, allowed image versions: " + string.Join(", ", DeployProperties.RoboRioAllowedImages.ToArray()));
7474
OutputWriter.Instance.WriteLine("Please follow FIRST's instructions on imaging your RoboRIO, and try again.");
75-
return;
75+
return false;
7676
}
7777
OutputWriter.Instance.WriteLine("RoboRIO Image Correct");
7878
//Force making mono directory
@@ -83,22 +83,25 @@ public async Task DeployCode(string teamNumber, SettingsPageGrid page, bool debu
8383
if (!retVal)
8484
{
8585
OutputWriter.Instance.WriteLine("File deploy failed.");
86-
return;
86+
return false;
8787
}
8888
OutputWriter.Instance.WriteLine("Successfully Deployed Files. Starting Code.");
8989
await UploadCode(codeReturn.RobotExe, page, debug, robotProject);
9090
OutputWriter.Instance.WriteLine("Successfully started robot code.");
91+
return true;
9192
}
9293
else
9394
{
9495
//Failed to connect
9596
writer.WriteLine("Failed to Connect to RoboRIO. Exiting.");
97+
return false;
9698
}
9799
}
98100
else
99101
{
100102
//Timedout
101103
writer.WriteLine("Failed to Connect to RoboRIO. Exiting.");
104+
return false;
102105
}
103106
}
104107

0 commit comments

Comments
 (0)