Exemplo 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));
                }
            }
        }
		private void BuildExceptionTypeNode(ExceptionPolicyNode policyNode, ExceptionTypeData exceptionTypeData)
		{
			ExceptionTypeNode exceptionTypeNode = new ExceptionTypeNode(exceptionTypeData);
			policyNode.AddNode(exceptionTypeNode);				
			foreach (ExceptionHandlerData exceptionHandlerData in exceptionTypeData.ExceptionHandlers)
			{
				BuildExceptionHandlerNode(exceptionTypeNode, exceptionHandlerData);
			}			
		}
 private static ExceptionTypeData CreateExceptionTypeData(ExceptionTypeNode exceptionTypeNode)
 {
     ExceptionTypeData exceptionTypeData = new ExceptionTypeData(exceptionTypeNode.Name, exceptionTypeNode.Type, exceptionTypeNode.PostHandlingAction);
     //List<ConfigurationNode> exceptionHandlers = hierarchy.FindNodesByType(exceptionTypeNode, typeof(ExceptionHandlerNode));
     foreach (ConfigurationNode exceptionHandlerNode in exceptionTypeNode.Nodes)
     {
         exceptionTypeData.ExceptionHandlers.Add(((ExceptionHandlerNode)exceptionHandlerNode).ExceptionHandlerData);
     }
     return exceptionTypeData;
 }
Exemplo n.º 4
0
        private void BuildExceptionTypeNode(ExceptionPolicyNode policyNode, ExceptionTypeData exceptionTypeData)
        {
            ExceptionTypeNode exceptionTypeNode = new ExceptionTypeNode(exceptionTypeData);

            policyNode.AddNode(exceptionTypeNode);
            foreach (ExceptionHandlerData exceptionHandlerData in exceptionTypeData.ExceptionHandlers)
            {
                BuildExceptionHandlerNode(exceptionTypeNode, exceptionHandlerData);
            }
        }
Exemplo n.º 5
0
        private static ExceptionTypeData CreateExceptionTypeData(ExceptionTypeNode exceptionTypeNode)
        {
            ExceptionTypeData exceptionTypeData = new ExceptionTypeData(exceptionTypeNode.Name, exceptionTypeNode.Type, exceptionTypeNode.PostHandlingAction);

            foreach (ConfigurationNode exceptionHandlerNode in exceptionTypeNode.Nodes)
            {
                exceptionTypeData.ExceptionHandlers.Add(((ExceptionHandlerNode)exceptionHandlerNode).ExceptionHandlerData);
            }
            return(exceptionTypeData);
        }
        private static ExceptionTypeData CreateExceptionTypeData(ExceptionTypeNode exceptionTypeNode)
        {
            ExceptionTypeData exceptionTypeData = new ExceptionTypeData(exceptionTypeNode.Name, exceptionTypeNode.Type, exceptionTypeNode.PostHandlingAction);

            //List<ConfigurationNode> exceptionHandlers = hierarchy.FindNodesByType(exceptionTypeNode, typeof(ExceptionHandlerNode));
            foreach (ConfigurationNode exceptionHandlerNode in exceptionTypeNode.Nodes)
            {
                exceptionTypeData.ExceptionHandlers.Add(((ExceptionHandlerNode)exceptionHandlerNode).ExceptionHandlerData);
            }
            return(exceptionTypeData);
        }
Exemplo n.º 7
0
        public void ExceptionTypeNameBecomesName()
        {
            Type exceptionType = typeof(AppDomainUnloadedException);
            string name = "some name";

            ExceptionTypeData data = new ExceptionTypeData();
            data.Type = exceptionType;
            data.Name = name;

            ExceptionTypeNode node = new ExceptionTypeNode(data);
            Assert.AreEqual(exceptionType.Name, node.Name);
        }
Exemplo n.º 8
0
        public void ExceptionTypeDataTest()
        {
            Type exceptionType = typeof(AppDomainUnloadedException);
            PostHandlingAction action = PostHandlingAction.None;

            ExceptionTypeData data = new ExceptionTypeData();
            data.Type = exceptionType;
            data.PostHandlingAction = action;

            ExceptionTypeNode node = new ExceptionTypeNode(data);
            Assert.AreEqual(exceptionType.Name, node.Name);
            Assert.AreEqual(action, node.PostHandlingAction);
        }
        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));
            }
        }
Exemplo n.º 10
0
        private void BuildExceptionHandlerNode(ExceptionTypeNode exceptionTypeNode, ExceptionHandlerData exceptionHandlerData)
        {
            ConfigurationNode exceptionHandlerNode = NodeCreationService.CreateNodeByDataType(exceptionHandlerData.GetType(), new object[] { exceptionHandlerData });

            exceptionTypeNode.AddNode(exceptionHandlerNode);
        }
		private void BuildExceptionHandlerNode(ExceptionTypeNode exceptionTypeNode, ExceptionHandlerData exceptionHandlerData)
		{
			ConfigurationNode exceptionHandlerNode = NodeCreationService.CreateNodeByDataType(exceptionHandlerData.GetType(), new object[] { exceptionHandlerData });
			exceptionTypeNode.AddNode(exceptionHandlerNode);
		}
Exemplo n.º 12
0
 public void ExceptionTypeNodeDefaults()
 {
     ExceptionTypeNode exceptionTypeNode = new ExceptionTypeNode();
     Assert.AreEqual("Exception", exceptionTypeNode.Name);
     Assert.AreEqual(PostHandlingAction.NotifyRethrow, exceptionTypeNode.PostHandlingAction);
 }