Beispiel #1
0
        private void RefreshButtons()
        {
            Program.AssertOnEventThread();
            var VMs = hostService.GetVMs();

            while (buttons.Count > 0)
            {
                VmButton button = buttons[0];
                buttons.RemoveAt(0);
                button.Dispose();
            }

            int totalWidth = 0;

            foreach (XenVM vm in VMs.Values)
            {
                if (vm.Slot == 0) // If uivm
                {
                    // Stash it, and skip.
                    this.uivm = vm;
                    continue;
                } // Ends if uivm

                if (vm.Hidden)
                {
                    continue;
                }
                VmButton button = new VmButton(vm, vm.Image, vm.UUID == hostService.UUID);
                //button.Cursor = Cursors.Hand;

                Controls.Add(button);
                buttons.Add(button);

                totalWidth += button.Width + BUTTON_PADDING;
            }

            totalWidth -= BUTTON_PADDING;

            int x = (Width - totalWidth) / 2;

            foreach (VmButton button in buttons)
            {
                button.Location = new Point(x, BUTTON_TOP_OFFSET);
                x += button.Width + BUTTON_PADDING;
            }
        }
Beispiel #2
0
        private void RefreshButtons()
        {
            Program.AssertOnEventThread();
            var VMs = hostService.GetVMs();

            while (buttons.Count > 0)
            {
                VmButton button = buttons[0];
                buttons.RemoveAt(0);
                button.Dispose();
            }

            int totalWidth = 0;

            foreach (XenVM vm in VMs.Values)
            {
                if (vm.Slot == 0) // If uivm
                {
                    // Stash it, and skip.
                    this.uivm = vm;
                    continue;

                } // Ends if uivm

                if (vm.Hidden)
                {
                    continue;
                }
                VmButton button = new VmButton(vm, vm.Image, vm.UUID == hostService.UUID);
                //button.Cursor = Cursors.Hand;

                Controls.Add(button);
                buttons.Add(button);

                totalWidth += button.Width + BUTTON_PADDING;
            }

            totalWidth -= BUTTON_PADDING;

            int x = (Width - totalWidth) / 2;

            foreach (VmButton button in buttons)
            {
                button.Location = new Point(x, BUTTON_TOP_OFFSET);
                x += button.Width + BUTTON_PADDING;
            }
        }