Beispiel #1
0
        private async Task Launch()
        {
            //DeploymentTask task = null;

            ClouderSyncPackage.WriteToOutputWindow("-----\n", "ClouderSync", null, true);

            if (!ConnectEntryData.SettingsExist())
            {
                ShowMessageBox(@"It does not appear that SFTP connection has been configured. Please configure in the next step", "ClouderSync SSH");
                cmdConfigureSSH.ConfigureSSH(this);
                return;
            }
            if (DeploymentTask.GetIsRunning())
            {
                ShowMessageBox(@"It appears that a deployment task is running. Please cancel, or wait, or restart Visual Studio", "ClouderSync SSH");
                return;
            }
            CancellationTokenSource tokenSource = new CancellationTokenSource();
            CancellationToken       token       = tokenSource.Token;

            DeploymentTask task = new DeploymentTask(this);
            await Task.Run(() =>
            {
                task.Execute(tokenSource);
            });
        }
Beispiel #2
0
 /// <summary>
 /// This function is the callback used to execute the command when the menu item is clicked.
 /// See the constructor to see how the menu item is associated with this function using
 /// OleMenuCommandService service and MenuCommand class.
 /// </summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">Event args.</param>
 private void Execute(object sender, EventArgs e)
 {
     if (!DeploymentTask.GetIsRunning())
     {
         Launch();
     }
     else
     {
         Cancel();
     }
 }
Beispiel #3
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs eArgs)
        {
            DeploymentTask task = null;

            if (eArgs.Argument is DeploymentTask)
            {
                task = eArgs.Argument as DeploymentTask;
            }
            if (task != null)
            {
                task.Execute();
            }
            else
            {
                string message = string.Format(CultureInfo.CurrentCulture, "Failed to pass SFTP DeploymentTask {0}", this.GetType().FullName);
                ShowMessageBox(message, "ClouderSync Deploy");
            }
        }
Beispiel #4
0
        protected override void OnBeforeQueryStatus(object sender, EventArgs e)
        {
            var myCommand = sender as OleMenuCommand;

            if (myCommand != null)
            {
                if (myCommand.CommandID.ID == ClouderSyncIDs.cmdidCloudDeploy || myCommand.CommandID.ID == ClouderSyncIDs.cmdidCancelDeploy)
                {
                    if (DeploymentTask.GetIsRunning())
                    {
                        myCommand.Text = @"Cancel deployment over SSH/SFTP";
                    }
                    else
                    {
                        myCommand.Text = @"Deploy over SSH/SFTP";
                    }
                }
            }
        }
Beispiel #5
0
 private void Cancel()
 {
     ClouderSyncPackage.WriteToOutputWindow("\nCancellation requested \n", "ClouderSync", null, false);
     DeploymentTask.Cancel();
 }