Exemplo n.º 1
0
        private void optionsToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmMachine frm = new frmMachine();

            frm.ShowDialog();
        }
Exemplo n.º 2
0
        public void getRemoteVM()
        {
            IN_UPGRADE = true;

            ObjectQuery queryObj = new ObjectQuery("SELECT * FROM Msvm_ComputerSystem");

            if (scope == null) scope = getRemoteScope();

            if (scope != null)
            {
                ManagementObjectSearcher vmSearcher = new ManagementObjectSearcher(scope, queryObj);
                ManagementObjectCollection vmCollection = vmSearcher.Get();
                try
                {
                    foreach (ManagementObject vm in vmCollection)
                    {
                        vm_control ctrl = new vm_control();
                        ctrl.frm = frm;
                        ctrl.lblName.Text = vm["ElementName"].ToString();
                        ctrl.lblState.Text = "[" + getState(vm["EnabledState"].ToString()) + "]";
                        ctrl.lblDescription.Text = vm["Description"].ToString();
                        ctrl.imgVM.Image = GetVirtualSystemThumbnailImage(vm["ElementName"].ToString());
                        Dictionary<string, string> infos = getInfo(vm["ElementName"].ToString());
                        if (infos.Count > 0)
                        {
                            if (infos.ContainsKey("106"))
                                ctrl.lblOS.Text = "Sistema: " + infos["106"].ToString();
                            else ctrl.lblOS.Text = "Sistema: na";
                            if (infos.ContainsKey("101"))
                                ctrl.lblProcessorLoad.Text = "CPU: " + infos["101"].ToString() + "%";
                            else ctrl.lblProcessorLoad.Text = "CPU: na";
                        }
                        else
                        {
                            ctrl.lblOS.Text = "Sistema: na";
                            ctrl.lblProcessorLoad.Text = "CPU: na";
                        }

                        this.setControl(ctrl);

                        IN_UPGRADE = false;
                        //  frm.UI_VM_CONTAINER.Controls.Add(ctrl);
                    }
                }
                catch
                {
                    frmMachine opt = new frmMachine();
                    opt.ShowDialog();
                }
            }
            else
            {
                frmMachine opt = new frmMachine();
                opt.ShowDialog();
            }
        }
Exemplo n.º 3
0
        public void getRemoteVM()
        {
            IN_UPGRADE = true;

            ObjectQuery queryObj = new ObjectQuery("SELECT * FROM Msvm_ComputerSystem");

            if (scope == null)
            {
                scope = getRemoteScope();
            }

            if (scope != null)
            {
                ManagementObjectSearcher   vmSearcher   = new ManagementObjectSearcher(scope, queryObj);
                ManagementObjectCollection vmCollection = vmSearcher.Get();
                try
                {
                    foreach (ManagementObject vm in vmCollection)
                    {
                        vm_control ctrl = new vm_control();
                        ctrl.frm                 = frm;
                        ctrl.lblName.Text        = vm["ElementName"].ToString();
                        ctrl.lblState.Text       = "[" + getState(vm["EnabledState"].ToString()) + "]";
                        ctrl.lblDescription.Text = vm["Description"].ToString();
                        ctrl.imgVM.Image         = GetVirtualSystemThumbnailImage(vm["ElementName"].ToString());
                        Dictionary <string, string> infos = getInfo(vm["ElementName"].ToString());
                        if (infos.Count > 0)
                        {
                            if (infos.ContainsKey("106"))
                            {
                                ctrl.lblOS.Text = "Sistema: " + infos["106"].ToString();
                            }
                            else
                            {
                                ctrl.lblOS.Text = "Sistema: na";
                            }
                            if (infos.ContainsKey("101"))
                            {
                                ctrl.lblProcessorLoad.Text = "CPU: " + infos["101"].ToString() + "%";
                            }
                            else
                            {
                                ctrl.lblProcessorLoad.Text = "CPU: na";
                            }
                        }
                        else
                        {
                            ctrl.lblOS.Text            = "Sistema: na";
                            ctrl.lblProcessorLoad.Text = "CPU: na";
                        }

                        this.setControl(ctrl);

                        IN_UPGRADE = false;
                        //  frm.UI_VM_CONTAINER.Controls.Add(ctrl);
                    }
                }
                catch
                {
                    frmMachine opt = new frmMachine();
                    opt.ShowDialog();
                }
            }
            else
            {
                frmMachine opt = new frmMachine();
                opt.ShowDialog();
            }
        }
Exemplo n.º 4
0
 private void optionsToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     frmMachine frm = new frmMachine();
     frm.ShowDialog();
 }