Exemple #1
0
 public VMHostViewModel(VMHost host)
     : base()
 {
     this.Host = host;
     this.Name = Host.Name;
     try
     {
         ProcessorsCount = Host.ProcessorsCount;
         CoresCount      = Host.CoresCount;
         TotalMemory     = Host.TotalMemory;
         backThread      = new Timer(new TimerCallback(delegate(object o)
         {
             try
             {
                 this.CpuUsage   = Host.GetProcessorLoad().ToString() + "%";
                 this.FreeMemory = Host.GetFreeMemory();
             }
             finally
             {
             }
         }
                                                       ), null, 0, 1000);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, this.Name, MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemple #2
0
        private bool CanRemoveVMHostTreeNode(object selectedItem)
        {
            bool        canremove = false;
            VMHostGroup group     = this.SelectedItem as VMHostGroup;

            if (group != null)
            {
                if (group.ParentGroup != null)
                {
                    canremove = true;
                }
                return(canremove);
            }
            VMHost host = this.SelectedItem as VMHost;

            if (host != null)
            {
                canremove = true;
            }
            return(canremove);
        }