Esempio n. 1
0
        protected override void ExecuteCore(ConfigurationNode node)
        {
            TypeSelectorUI selector = new TypeSelectorUI(
                typeof(Exception),
                typeof(Exception),
                TypeSelectorIncludeFlags.BaseType |
                TypeSelectorIncludeFlags.AbstractTypes);
            DialogResult result = selector.ShowDialog();

            if (result == DialogResult.OK)
            {
                base.ExecuteCore(node);
                ExceptionTypeNode typeNode = (ExceptionTypeNode)ChildNode;
                typeNode.TypeName           = selector.SelectedType.AssemblyQualifiedName;
                typeNode.PostHandlingAction = PostHandlingAction.NotifyRethrow;
                try
                {
                    typeNode.Name = selector.SelectedType.Name;
                }
                catch (InvalidOperationException)
                {
                    typeNode.Remove();
                    UIService.ShowError(SR.DuplicateExceptionTypeErrorMessage(selector.SelectedType.Name));
                }
            }
        }
        protected override void ExecuteCore(ConfigurationNode node)
        {
            Type selectedType = SelectedType;

            if (null == selectedType)
            {
                return;
            }
            base.ExecuteCore(node);
            ExceptionTypeNode typeNode = (ExceptionTypeNode)ChildNode;

            typeNode.PostHandlingAction = PostHandlingAction.NotifyRethrow;
            try
            {
                typeNode.Type = selectedType;
            }
            catch (InvalidOperationException)
            {
                typeNode.Remove();
                UIService.ShowError(string.Format(Resources.Culture, Resources.DuplicateExceptionTypeErrorMessage, selectedType != null ? selectedType.Name : string.Empty));
            }
        }