public void Save(IConfigurable instance) { EventCategoryObject eventCategoryObject = instance as EventCategoryObject; if (eventCategoryObject == null) { throw new ArgumentException(); } EventCategorySession.SetCategory(eventCategoryObject); }
public int CompareTo(object value) { EventCategoryObject eventCategoryObject = value as EventCategoryObject; if (eventCategoryObject != null) { return(base.Name.CompareTo(eventCategoryObject.Name)); } throw new ArgumentException("Object is not an EventCategoryObject"); }
private static void SetCategory(EventCategoryObject category) { string text = null; EventCategoryIdentity eventCategoryIdentity = category.Identity as EventCategoryIdentity; RegistryKey categoryRegistryKey = EventCategorySession.GetCategoryRegistryKey(eventCategoryIdentity, true, out text); using (categoryRegistryKey) { if (text == null) { throw new DataSourceOperationException(DataStrings.ExceptionEventCategoryNotFound(eventCategoryIdentity.Category)); } categoryRegistryKey.SetValue(text, (int)category.EventLevel, RegistryValueKind.DWord); } }