コード例 #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);
        }