private void RunVagrantAction(string action, VagrantMachine machine) { string command; if (action == "up") { command = String.Format("vagrant up{0}", !String.IsNullOrEmpty(machine.Instance.ProviderIdentifier) ? String.Format(" --provider={0}", machine.Instance.ProviderIdentifier) : "virtualbox"); } else if (action == "reload") { command = "vagrant reload"; } else if (action == "suspend") { command = "vagrant suspend"; } else if (action == "halt") { command = "vagrant halt"; } else if (action == "provision") { command = "vagrant provision"; } else if (action == "destroy") { command = "vagrant destroy -f"; } else if (action == "rsync") { command = "vagrant rsync"; } else { return; } Process process = new Process(); process.StartInfo.FileName = "cmd"; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.Arguments = String.Format("/C cd /d {0} && {1} {2}", Util.EscapeShellArg(machine.Instance.Path), command, Util.EscapeShellArg(machine.Name)); TaskOutputWindow outputWindow = new TaskOutputWindow { Task = process, TaskCommand = process.StartInfo.Arguments, TaskAction = command, Target = machine }; outputWindow.Show(); }
public void NativeMenuItemDestroyMachine(VagrantMachine machine) { DialogResult dialogResult = MessageBox.Show("Are you sure you want to destroy this machine?", "Confirm Destructive Action", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { this.PerformAction("destroy", machine); } }
public void PerformVagrantAction(string action, VagrantMachine machine) { if (action == "ssh") { action = String.Format("cd /d {0} && vagrant ssh {1}", Util.EscapeShellArg(machine.Instance.Path), machine.Name); this.RunTerminalCommand(action); } else { this.RunVagrantAction(action, machine); } }
private void PerformAction(string action, VagrantMachine machine) { Delegate.PerformVagrantAction(action, machine); }
public void NativeMenuItemRsyncAutoMachine(VagrantMachine machine) { this.PerformAction("rsync-auto", machine); }
public void NativeMenuItemProvisionMachine(VagrantMachine machine) { this.PerformAction("provision", machine); }
public void NativeMenuItemHaltMachine(VagrantMachine machine) { this.PerformAction("halt", machine); }
public void NativeMenuItemReloadMachine(VagrantMachine machine) { this.PerformAction("reload", machine); }
public void NativeMenuItemSuspendMachine(VagrantMachine machine) { this.PerformAction("suspend", machine); }
public void NativeMenuItemSSHMachine(VagrantMachine machine) { this.PerformAction("ssh", machine); }
public void NativeMenuItemUpMachine(VagrantMachine machine) { this.PerformAction("up", machine); }