private void Repopulate()
        {
            if (_XenObject == null)
            {
                return;
            }
            try
            {
                var perfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(_XenObject);

                for (int i = 0; i < perfmonDefinitions.Length; i++)
                {
                    PerfmonDefinition perfmonDefinition = perfmonDefinitions[i];

                    if (perfmonDefinition.IsCPUUsage)
                    {
                        cpuAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsNetworkUsage)
                    {
                        netAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsDiskUsage)
                    {
                        diskAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsMemoryUsage)
                    {
                        memoryAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsSrUsage)
                    {
                        srAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsDom0MemoryUsage)
                    {
                        dom0MemoryAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsSrPhysicalUtilisation)
                    {
                        physicalUtilisationAlert.Populate(perfmonDefinition);
                    }
                }
            }
            catch { }
        }
        private void Repopulate()
        {
            if (_XenObject == null)
            {
                return;
            }

            try
            {
                var perfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(_XenObject);

                for (int i = 0; i < perfmonDefinitions.Length; i++)
                {
                    PerfmonDefinition perfmonDefinition = perfmonDefinitions[i];

                    if (perfmonDefinition.IsCPUUsage)
                    {
                        cpuAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsNetworkUsage)
                    {
                        netAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsDiskUsage)
                    {
                        diskAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsMemoryUsage)
                    {
                        memoryAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsSrUsage)
                    {
                        srAlert.Populate(perfmonDefinition);
                    }
                    else if (perfmonDefinition.IsSrPhysicalUtilisation)
                    {
                        physicalUtilisationAlert.Populate(perfmonDefinition);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("Unexpected error during populating controls for Alerts. Exception swallowed.", ex); //Adding this to pre-existing empty catch block to log it at least
            }

            // Dom0 memory usage is stored in the other_config of the Dom0 vm not on the host (or any other XenObject)
            try
            {
                var host = _XenObject as Host;
                if (host != null)
                {
                    var dom0 = host.ControlDomainZero;

                    if (dom0 != null)
                    {
                        var controlDomainPerfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(dom0);

                        if (controlDomainPerfmonDefinitions != null)
                        {
                            for (int i = 0; i < controlDomainPerfmonDefinitions.Length; i++)
                            {
                                var def = controlDomainPerfmonDefinitions[i];

                                if (def != null && def.IsDom0MemoryUsage)
                                {
                                    dom0MemoryAlert.Populate(def);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("Unexpected error during populating controls for Dom0 Memory Usage alert. Exception swallowed.", ex);     //Any error here will cause the controls not being populated, but they will be still usable.
            }
        }