Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            VirtualBox.IVirtualBox vb = new VirtualBox.VirtualBoxClass();
            var mc = vb.Machines;

            foreach (var item in mc)
            {
                var machine = (item as IMachine);

                var nm = machine.Name;

                comboBox1.Items.Add(nm);
                if (machine.State == MachineState.MachineState_Running)
                {
                    comboBox1.SelectedItem = nm;
                }
            }

            bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);

            pictureBox1.Image        = bmp;
            pictureBox1.SizeChanged += PictureBox1_SizeChanged;

            gr          = Graphics.FromImage(bmp);
            MouseWheel += Form1_MouseWheel;
        }
Exemplo n.º 2
0
        private void Button7_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(currentMachineName))
            {
                MessageBox.Show("choose machine name first"); return;
            }
            VirtualBox.IVirtualBox vb = new VirtualBox.VirtualBoxClass();
            var mc = vb.FindMachine(currentMachineName);

            session = new VirtualBox.SessionClass();

            machine = mc;
            UpdateSnapshots(mc);
        }
Exemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(currentMachineName))
            {
                MessageBox.Show("choose machine name first"); return;
            }
            VirtualBox.IVirtualBox vb = new VirtualBox.VirtualBoxClass();
            var mc = vb.FindMachine(currentMachineName);

            session = new VirtualBox.SessionClass();


            //s.UnlockMachine();

            var ret = mc.LaunchVMProcess(session, "gui", "");
        }
Exemplo n.º 4
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(currentMachineName))
            {
                MessageBox.Show("choose machine name first"); return;
            }
            VirtualBox.IVirtualBox vb = new VirtualBox.VirtualBoxClass();
            var mc = vb.FindMachine(currentMachineName);

            if (mc.State != MachineState.MachineState_Running)
            {
                MessageBox.Show("run machine first");
                return;
            }
            session = new VirtualBox.SessionClass();
            //s.UnlockMachine();
            machine = mc;
            mc.LockMachine(session, VirtualBox.LockType.LockType_Shared);
            UpdateSnapshots(mc);
        }