Beispiel #1
0
        private void harddiskAddBtn_Click(object sender, EventArgs e)
        {
            if (harddiskLstBox.Items.Count < 3)
            {
                ArrayList curDrives = new ArrayList(3);
                ArrayList hardDisks = VirtMach.GetHardDisks();

                foreach (VMHardDrive vmhd in hardDisks)
                {
                    curDrives.Add(vmhd.Drive);
                }

                NewHardDiskForm hdf = new NewHardDiskForm(curDrives);
                hdf.StartPosition = FormStartPosition.CenterParent;
                if (hdf.ShowDialog() == DialogResult.OK)
                {
                    VMHardDrive vmhd = VirtMach.AddHardDisk(hdf.DiskName,
                                                            hdf.QEmuDrive,
                                                            hdf.Path,
                                                            hdf.DiskSize,
                                                            hdf.BootImage);

                    if (vmhd != null)
                    {
                        harddiskLstBox.Items.Add(vmhd);
                    }
                }
            }
            else
            {
                MessageBox.Show("A maximum of 3 disk images is permittted");
            }
        }
Beispiel #2
0
        public VMHardDrive AddHardDisk(string nameIn,
                                       string driveIn,
                                       string pathIn,
                                       int sizeIn,
                                       bool bootImgIn)
        {
            VMHardDrive vmhd = new VMHardDrive();

            if (vmhd.CreateHardDrive(nameIn, driveIn, pathIn, sizeIn, bootImgIn))
            {
                hardDrives.Add(vmhd);
                return(vmhd);
            }

            return(null);
        }
Beispiel #3
0
        private void harddiskRemoveBtn_Click(object sender, EventArgs e)
        {
            int         oldSel = harddiskLstBox.SelectedIndex;
            VMHardDrive vmhd   = (VMHardDrive)harddiskLstBox.SelectedItem;

            DialogResult ret;

            ret = MessageBox.Show("Do you want to delete the image file too?",
                                  "Deleting harddisk",
                                  MessageBoxButtons.YesNoCancel,
                                  MessageBoxIcon.Warning);
            if (ret == DialogResult.Cancel)
            {
                return;
            }
            else if (ret == DialogResult.Yes)
            {
                ;//FIXME: delete the image
            }

            VirtMach.DeleteHardDisk(vmhd);
            harddiskLstBox.Items.Remove(vmhd);
            harddiskLstBox.SelectedIndex = oldSel - 1;
        }
Beispiel #4
0
 public void DeleteHardDisk(VMHardDrive vmhd)
 {
     hardDrives.Remove(vmhd);
     vmhd.DeleteHardDrive(vmhd.DiskID);
 }