예제 #1
0
        public void Save(IConfigurable instance)
        {
            EventCategoryObject eventCategoryObject = instance as EventCategoryObject;

            if (eventCategoryObject == null)
            {
                throw new ArgumentException();
            }
            EventCategorySession.SetCategory(eventCategoryObject);
        }
예제 #2
0
        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");
        }
예제 #3
0
        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);
            }
        }