void ButtonNewVMWizardFinishClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxNewVMName.Text) || string.IsNullOrEmpty(textBoxNewVMCPUCores.Text) || string.IsNullOrEmpty(textBoxNewVMRAM.Text)) { MessageBox.Show("Name, CPU cores and Memory are mandatory fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { ProgramForm programForm = new ProgramForm(); programForm.ExecCommand(ComposeCommands()); this.Close(); } }
void DuplicateVmButtonClick(object sender, EventArgs e) { if (!String.IsNullOrEmpty(textBoxNewVMName.Text)) { string[] command = { "sudo virsh shutdown " + currentVMName + " --mode acpi", "sudo virt-clone --original " + currentVMName + " --name " + textBoxNewVMName.Text + " --auto-clone" }; ProgramForm programForm = new ProgramForm(); programForm.ExecCommand(command); this.Close(); } else { MessageBox.Show("Please, enter name of new VM!", "Error"); } }