//--------------------------------------------------------------------- internal static string RetrieveContext( ManagementPackOverride mpOverrride, ManagementGroup managementGroup ) { string context = "Unknown"; if (mpOverrride.ContextInstance == null) { string className; className = GetBestElementName(managementGroup.GetMonitoringClass(mpOverrride.Context.Id)); context = string.Format("All Instances of type {0}", className); } else { PartialMonitoringObject monitoringObject; try { try { monitoringObject = managementGroup.GetPartialMonitoringObject((Guid)mpOverrride.ContextInstance); context = monitoringObject.DisplayName; } catch (Microsoft.EnterpriseManagement.Common.MonitoringException exception) { managementGroup.Reconnect(); monitoringObject = managementGroup.GetMonitoringObject((Guid)mpOverrride.ContextInstance); } } catch (Microsoft.EnterpriseManagement.Common.MonitoringException exception) { MessageBox.Show(exception.Message); } } return(context); }
//--------------------------------------------------------------------- internal static string RetrieveContext( ManagementPackOverride mpOverrride, ManagementGroup managementGroup ) { string context = "Unknown"; if (mpOverrride.ContextInstance == null) { string className; className = GetBestElementName(managementGroup.GetMonitoringClass(mpOverrride.Context.Id)); context = string.Format("All Instances of type {0}", className); } else { PartialMonitoringObject monitoringObject; try { try { monitoringObject = managementGroup.GetPartialMonitoringObject((Guid)mpOverrride.ContextInstance); context = monitoringObject.DisplayName; } catch (Microsoft.EnterpriseManagement.Common.MonitoringException exception) { managementGroup.Reconnect(); monitoringObject = managementGroup.GetMonitoringObject((Guid)mpOverrride.ContextInstance); } } catch (Microsoft.EnterpriseManagement.Common.MonitoringException exception) { MessageBox.Show(exception.Message); } } return (context); }