Ejemplo n.º 1
0
        private void Rebuild(List <PGPU> pGpuList)
        {
            Program.AssertOnEventThread();
            if (!Visible)
            {
                return;
            }

            shinyBarsContainerPanel.SuspendLayout();

            // Store a list of the current controls. We remove them at the end because it makes less flicker that way.
            var oldControls = new List <Control>(shinyBarsContainerPanel.Controls.Count);

            oldControls.AddRange(shinyBarsContainerPanel.Controls.Cast <Control>());

            bool showingHostLabel = (xenObject is Pool) && xenObject.Connection.Cache.Hosts.Length > 1;

            int           index   = 1;
            XenRef <Host> hostRef = null;

            foreach (PGPU pgpu in pGpuList)
            {
                var host = xenObject.Connection.Resolve(pgpu.host);

                // add host label if needed
                if (showingHostLabel && (hostRef == null || pgpu.host.opaque_ref != hostRef.opaque_ref))
                {
                    AddHostLabel(new Label {
                        Text = String.Format(Messages.GPU_ON_HOST_LABEL, host.Name)
                    }, ref index);
                    hostRef = pgpu.host;
                }

                // add pGPU shiny bar
                var gpuShinyBar = new GpuShinyBar();
                var checkBox    = (pGpuList.Count > 1 && vGpuCapability) ? new CheckBox() : null;
                AddShinyBar(gpuShinyBar, checkBox, ref index);
                gpuShinyBar.Initialize(pgpu);

                pGpus.Add(pgpu, checkBox);
            }

            // Remove old controls
            foreach (Control c in oldControls)
            {
                shinyBarsContainerPanel.Controls.Remove(c);
                c.Dispose();
            }
            shinyBarsContainerPanel.ResumeLayout();
            ReLayout();
        }
Ejemplo n.º 2
0
        public void RefreshGpu(PGPU pGpu)
        {
            Program.AssertOnEventThread();
            if (!Visible)
            {
                return;
            }

            GpuShinyBar gpuShinyBar = FindGpuShinyBar(pGpu);

            if (gpuShinyBar != null)
            {
                gpuShinyBar.Initialize(pGpu);
                gpuShinyBar.Refresh();
            }
        }
Ejemplo n.º 3
0
        private void Rebuild(List<PGPU> pGpuList)
        {
            Program.AssertOnEventThread();
            if (!Visible)
                return;

            shinyBarsContainerPanel.SuspendLayout();

            // Store a list of the current controls. We remove them at the end because it makes less flicker that way.
            var oldControls = new List<Control>(shinyBarsContainerPanel.Controls.Count);
            oldControls.AddRange(shinyBarsContainerPanel.Controls.Cast<Control>());

            bool showingHostLabel = (xenObject is Pool) && xenObject.Connection.Cache.Hosts.Length > 1;

            int index = 1;
            XenRef<Host> hostRef = null;

            foreach (PGPU pgpu in pGpuList)
            {
                var host = xenObject.Connection.Resolve(pgpu.host);

                // add host label if needed
                if (showingHostLabel && (hostRef == null || pgpu.host.opaque_ref != hostRef.opaque_ref))
                {
                    AddHostLabel(new Label { Text = String.Format(Messages.GPU_ON_HOST_LABEL, host.Name)}, ref index);
                    hostRef = pgpu.host;
                }

                // add pGPU shiny bar
                var gpuShinyBar = new GpuShinyBar();
                var checkBox = pGpuList.Count > 1 ? new CheckBox() : null;
                AddShinyBar(gpuShinyBar, checkBox, ref index);
                gpuShinyBar.Initialize(pgpu);

                pGpus.Add(pgpu, checkBox);
            }

            // Remove old controls
            foreach (Control c in oldControls)
            {
                shinyBarsContainerPanel.Controls.Remove(c);
                c.Dispose();
            }
            shinyBarsContainerPanel.ResumeLayout();
            ReLayout();
        }