Пример #1
0
        private void OnConfigureDevice(object o, EventArgs args)
        {
            IVirtualDevice dev = devview.GetSelectedDevice ();

            Dialog dialog = null;

            switch (dev.DeviceType) {
            case VirtualDeviceType.HardDisk:
                VirtualHardDisk disk = (dev as VirtualHardDisk);
                dialog = new HardDiskConfigDialog ((VirtualHardDisk) dev,
                                                   disk.FileName == null || !File.Exists (disk.FileName),
                                                   this);
                break;
            case VirtualDeviceType.Ethernet:
                dialog = new EthernetConfigDialog ((VirtualEthernet) dev, this);
                break;
            case VirtualDeviceType.CdRom:
                dialog = new CdConfigDialog ((VirtualCdDrive) dev, this);
                break;
            default:
                break;
            }

            if (dialog != null) {
                dialog.Response += delegate {
                    devview.QueueDraw ();
                };

                dialog.Show ();
            }
        }
Пример #2
0
        private void OnAddCdDrive(object o, EventArgs args)
        {
            VirtualCdDrive drive = new VirtualCdDrive ("/dev/hdc", 1, 0, DiskBusType.Ide, CdDeviceType.Raw);

            CdConfigDialog dialog = new CdConfigDialog (drive, this);
            dialog.Response += delegate (object b, ResponseArgs rargs) {
                if (rargs.ResponseId == ResponseType.Ok) {
                    machine.AddCdDrive (drive);
                }
            };

            dialog.Show ();
        }