public async Task UploadCode(string robotName, SettingsPageGrid page, bool debug, Project robotProject)
        {
            //TODO: Make debug work. Forcing debug to false for now so code always runs properly.
            debug = false;

            if (page.Netconsole)
            {
                await StartNetConsole();
            }
            string deployedCmd;
            string deployedCmdFrame;
            if (debug)
            {
                deployedCmd = string.Format(DeployProperties.RobotCommandDebug, robotName);
                deployedCmdFrame = DeployProperties.RobotCommandDebugFileName;
            }
            else
            {
                deployedCmd = string.Format(DeployProperties.RobotCommand, robotName);
                deployedCmdFrame = DeployProperties.RobotCommandFileName;
            }

            string args = GetCommandLineArguments(robotProject);

            //Kill the currently running robot program
            await RoboRIOConnection.RunCommand(DeployProperties.KillOnlyCommand, ConnectionUser.LvUser);

            //Combining all other commands, since they should be safe running together.
            List<string> commands = new List<string>();

            //Write the robotCommand file
            commands.Add($"echo {deployedCmd} {args} > {DeployProperties.CommandDir}/{deployedCmdFrame}");
            if (debug)
            {
                //If debug write the debug flag.
                commands.AddRange(DeployProperties.DebugFlagCommand);
            }
            //Add all commands to restart
            commands.AddRange(DeployProperties.DeployKillCommand);
            //run all commands
            await RoboRIOConnection.RunCommands(commands.ToArray(), ConnectionUser.LvUser);

            //Run sync so files are written to disk.
            await RoboRIOConnection.RunCommand("sync", ConnectionUser.LvUser);
        }
        //Uploads code to the robot and then runs it.
        public async Task<bool> DeployCode(string teamNumber, SettingsPageGrid page, bool debug, Project robotProject)
        {

            var writer = OutputWriter.Instance;

            if (robotProject == null)
            {
                writer.WriteLine("Robot Project not valid. Contact RobotDotNet for support.");
                return false;
            }

            //Connect to Robot Async
            OutputWriter.Instance.WriteLine("Attempting to Connect to RoboRIO");
            Task<bool> rioConnectionTask = StartConnectionTask(teamNumber);
            Task delayTask = Task.Delay(10000);

            CodeReturnStruct codeReturn = await BuildAndPrepareCode(debug, robotProject);

            if (codeReturn == null) return false;

            writer.WriteLine("Waiting for Connection to Finish");
            if (await Task.WhenAny(rioConnectionTask, delayTask) == rioConnectionTask)
            {
                //Completed on time
                if (rioConnectionTask.Result)
                {
                    //Connected successfully
                    OutputWriter.Instance.WriteLine("Successfully Connected to RoboRIO.");

                    if (!await CheckMonoInstall())
                    {
                        //TODO: Make this error message better
                        OutputWriter.Instance.WriteLine("Mono not properly installed. Please try reinstalling to Mono Runtime.");
                        return false;
                    }
                    OutputWriter.Instance.WriteLine("Mono correctly installed");

                    OutputWriter.Instance.WriteLine("Checking RoboRIO Image");
                    if (!await CheckRoboRioImage())
                    {
                        OutputWriter.Instance.WriteLine("RoboRIO Image does not match plugin, allowed image versions: " + string.Join(", ", DeployProperties.RoboRioAllowedImages.ToArray()));
                        OutputWriter.Instance.WriteLine("Please follow FIRST's instructions on imaging your RoboRIO, and try again.");
                        return false;
                    }
                    OutputWriter.Instance.WriteLine("RoboRIO Image Correct");
                    //Force making mono directory
                    await CreateMonoDirectory();

                    //DeployAllFiles
                    bool retVal = await DeployRobotFiles(codeReturn.RobotFiles);
                    if (!retVal)
                    {
                        OutputWriter.Instance.WriteLine("File deploy failed.");
                        return false;
                    }
                    OutputWriter.Instance.WriteLine("Successfully Deployed Files. Starting Code.");
                    await UploadCode(codeReturn.RobotExe, page, debug, robotProject);
                    OutputWriter.Instance.WriteLine("Successfully started robot code.");
                    return true;
                }
                else
                {
                    //Failed to connect
                    writer.WriteLine("Failed to Connect to RoboRIO. Exiting.");
                    return false;
                }
            }
            else
            {
                //Timedout
                writer.WriteLine("Failed to Connect to RoboRIO. Exiting.");
                return false;
            }
        }