//--------------------------------------------------------------------- private void DisplayAlertDescriptionIfApplicable(ManagementPackElement element) { if (!(element is ManagementPackMonitor)) { return; } ManagementPackMonitor monitor = (ManagementPackMonitor)element; m_alertDescriptionTextBox.DocumentText = @"<HTML></HTML>"; if (monitor.AlertSettings != null && monitor.AlertSettings.AlertMessage != null) { string alertDescription; alertDescription = m_managementPack.GetStringResource(monitor.AlertSettings.AlertMessage.Name).Description; if (alertDescription == null) { return; } if (alertDescription.IndexOf("\r\n") == 0) { alertDescription = alertDescription.Remove(0, 2); alertDescription = alertDescription.TrimStart(new char[] { ' ' }); } m_alertDescriptionTextBox.DocumentText = string.Format(@"<HTML><BODY>{0}</BODY></HTML>", alertDescription); } }
public static string GetStringFromManagementPack(string resource) { try { if (projectMP == null) { EnterpriseManagementGroup emg = ConsoleContext.GetConsoleEMG(); projectMP = emg.ManagementPacks.GetManagementPack(new Guid("171d60e8-a0df-e4b2-f032-a5af5c8ebe39")); } return(projectMP.GetStringResource(resource).DisplayName); } catch { return("Localization Error."); } }