Пример #1
0
        public static int GetImageIndex16For(object o)
        {
            int num = 1;

            if (o is VmInstance)
            {
                VmInstance instance = (VmInstance)o;
                if (instance.Template)
                {
                    return(13);
                }
                if (instance.PowerState == 0)
                {
                    return(2);
                }
                if (instance.PowerState == 1)
                {
                    return(3);
                }
                if (instance.PowerState == 2)
                {
                    num = 4;
                }
                return(num);
            }
            if (o is WinAPI.SR)
            {
                return(5);
            }
            if (o is ConVpxJobInfo)
            {
                num = 6;
                ConVpxJobInfo info = (ConVpxJobInfo)o;
                if (info.State == 1)
                {
                    return(7);
                }
                if (info.State == 2)
                {
                    return(8);
                }
                if (info.State == 3)
                {
                    return(9);
                }
                if (info.State == 6)
                {
                    return(10);
                }
                if (info.State == 4)
                {
                    return(11);
                }
                if (info.State == 5)
                {
                    num = 12;
                }
            }
            return(num);
        }
Пример #2
0
            public SourceVmRow(VmInstance vm)
            {
                Cells.AddRange(cellCheck, cellVm, cellOs, cellDiskSize);

                Vm = vm;
                cellCheck.Value    = false;
                cellVm.Value       = vm.Template ? string.Format(Messages.CONVERSION_TEMPLATE, vm.Name) : vm.Name;
                cellOs.Value       = vm.OSType;
                cellDiskSize.Value = Util.DiskSizeString(vm.CommittedStorage + vm.UncommittedStorage);
            }
Пример #3
0
        private TreeNode BuildTreeNode(VmInstance vm)
        {
            TreeNode node = null;

            try
            {
                int    imageIndex = Images.GetImageIndex16For(vm);
                string text       = vm.Template ? string.Format(Messages.VM_TEMPLATE_DISPLAY_NAME, vm.Name) : vm.Name;
                node = new TreeNode(text, imageIndex, imageIndex);
            }
            catch
            {
            }
            return(node);
        }
Пример #4
0
 public static Icons GetIconFor(VmInstance vm)
 {
     if (vm.Template)
     {
         return(Icons.VM_Template);
     }
     if (vm.PowerState == 0)
     {
         return(Icons.VM_Off);
     }
     if (vm.PowerState == 1)
     {
         return(Icons.VM_Running);
     }
     if (vm.PowerState == 2)
     {
         return(Icons.VM_Suspended);
     }
     return(Icons.VM_Default);
 }