Beispiel #1
0
        void LoginButtonClick(object sender, EventArgs e)
        {
            if (textBoxHostname.Text == "" || textBoxUsername.Text == "" || textBoxPassword.Text == "")
            {
                MessageBox.Show("Please, fill all fields!", "Error");
            }
            else
            {
                ConnectionVariables connVars = new ConnectionVariables();
                connVars.SetConnectionInfo(textBoxHostname.Text, textBoxUsername.Text, textBoxPassword.Text);
                Form ProgramForm = new ProgramForm();

                string path = @"connection.ini";
                if (!File.Exists(path))
                {
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        sw.WriteLine(textBoxHostname.Text);
                        sw.WriteLine(textBoxUsername.Text);
                    }
                }
                else
                {
                    File.Delete(path);
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        sw.WriteLine(textBoxHostname.Text);
                        sw.WriteLine(textBoxUsername.Text);
                    }
                }
                this.Hide();

                ProgramForm.Show();
            }
        }
Beispiel #2
0
 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();
     }
 }
Beispiel #3
0
 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");
     }
 }