예제 #1
0
		void IVisitor.Visit(UIOptionGroupType optionGroup)
		{
			using (OptionGroupInstanceReadVisitor ogivisitor = new OptionGroupInstanceReadVisitor(false))
			{
				optionGroup.Accept(ogivisitor);
			}
		}
예제 #2
0
		void IVisitorWithContext.Visit(UIOptionSubCategoryType subCategory, object context)
		{
			XmlNode subCategoryNode = (XmlNode) context;
			subCategory.Name = subCategoryNode.Name;
			subCategory.DisplayText = subCategoryNode.Attributes["DisplayText"].Value;			
			
			foreach (XmlNode node in subCategoryNode.ChildNodes)
			{
				// group nodes can only have one child if the child is just the template default, but the child will not be text
				// for all other nodes the single child will be text
				if (node.ChildNodes.Count > 1 || node.ChildNodes.Count == 1 && !(node.FirstChild is XmlText))	// Group Option Type
				{
					UIOptionGroupType groupOption = new UIOptionGroupType();
					subCategory.Options.Add(groupOption);

					groupOption.CategoryRef = subCategoryNode.ParentNode.Name;
					groupOption.SubCategoryRef = subCategoryNode.Name;
					groupOption.Accept(this, node);
				}
				else
				{
					UIOptionType option = new UIOptionType();					
					subCategory.Options.Add(option);

					option.CategoryRef = subCategoryNode.ParentNode.Name;
					option.SubCategoryRef = subCategoryNode.Name;
					option.Accept(this, node);
				}
			}
		}
예제 #3
0
		void IVisitorWithContext.Visit(UIOptionSubCategoryType subCategory, object context)
		{
			XmlNode subCategoryNode = (XmlNode) context;
			XmlNode categoryNode = subCategoryNode.ParentNode;
			XmlNode rootNode = categoryNode.ParentNode;

			subCategory.Name = subCategoryNode.Attributes["ID"].Value;
			subCategory.DisplayText = subCategoryNode.Attributes["DisplayText"].Value;

			string xpath = "ws:Option[@SubCategoryRef='" + subCategory.Name + "']";
			XmlNamespaceManager nsmgr = new XmlNamespaceManager(rootNode.OwnerDocument.NameTable);
			nsmgr.AddNamespace("ws", "http://schemas.workshare.com/Workshare.OptionMap.xsd");
			XmlNodeList options = rootNode.SelectNodes(xpath, nsmgr);

			foreach (XmlNode node in options)
			{
				UIOptionType option = new UIOptionType();
				subCategory.Options.Add(option);
				option.Accept(this, node);
			}

			xpath = "ws:OptionGroupType[@SubCategoryRef='" + subCategory.Name + "']";
			options = rootNode.SelectNodes(xpath, nsmgr);

			foreach (XmlNode node in options)
			{
				UIOptionGroupType option = new UIOptionGroupType();
				subCategory.Options.Add(option);
				option.Accept(this, node);
			}
		}