示例#1
0
文件: Form1.cs 项目: fel88/VboxClient
        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;
        }
示例#2
0
文件: Form1.cs 项目: fel88/VboxClient
        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);
        }
示例#3
0
文件: Form1.cs 项目: fel88/VboxClient
        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", "");
        }
示例#4
0
文件: Form1.cs 项目: fel88/VboxClient
        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);
        }