示例#1
0
        /// <summary>
        /// Writes child item XML to the provided writer.
        /// </summary>
        /// <param name="folderItem">Parent item.</param>
        /// <param name="xmlWriter">XmlTextWriter to output to.</param>
        private void WriteChildItems(QSetFolderItem folderItem, XmlTextWriter xmlWriter)
        {
            //write all folders
            foreach (QSetItemBase childItem in folderItem.ChildItems)
            {
                if (childItem.GetType() == typeof(QSetFolderItem))
                {
                    QSetFolderItem childFolderItem = (QSetFolderItem)childItem;
                    xmlWriter.WriteStartElement(QSetFolderItem.TypeName);
                    xmlWriter.WriteAttributeString(QSetXmlFileFormat.ItemAttributes.Name, childFolderItem.Name);
                    xmlWriter.WriteAttributeString(QSetXmlFileFormat.ItemAttributes.Guid, childFolderItem.ID.ToString());
                    WriteChildItems(childFolderItem, xmlWriter);
                    xmlWriter.WriteEndElement();
                }
            }

            //write all machines
            foreach (QSetItemBase childItem in folderItem.ChildItems)
            {
                if (childItem.GetType() == typeof(QSetMachineItem))
                {
                    QSetMachineItem childMachineItem = (QSetMachineItem)childItem;
                    xmlWriter.WriteStartElement(QSetMachineItem.TypeName);
                    xmlWriter.WriteAttributeString(QSetXmlFileFormat.ItemAttributes.Name, childMachineItem.Name);
                    xmlWriter.WriteAttributeString(QSetXmlFileFormat.ItemAttributes.Guid, childMachineItem.ID.ToString());
                    WriteChildItems(childMachineItem, xmlWriter);
                    xmlWriter.WriteEndElement();
                }
            }

            //write all queues
            foreach (QSetItemBase childItem in folderItem.ChildItems)
            {
                QSetQueueItem childQueueItem = childItem as QSetQueueItem;
                if (childQueueItem != null)
                {
                    xmlWriter.WriteStartElement(QSetQueueItem.TypeName);
                    xmlWriter.WriteAttributeString(QSetXmlFileFormat.ItemAttributes.Name, childQueueItem.Name);
                    xmlWriter.WriteAttributeString(QSetXmlFileFormat.ItemAttributes.Guid, childQueueItem.ID.ToString());
                    if (childQueueItem.MessageViewerXslt != null && childQueueItem.MessageViewerXslt.Trim().Length > 0)
                    {
                        xmlWriter.WriteAttributeString(QSetXmlFileFormat.QueueElement.Attributes.MessageViewerXslt, childQueueItem.MessageViewerXslt.Trim());
                    }
                    xmlWriter.WriteEndElement();
                }
            }

            //write all web services
            foreach (QSetItemBase childItem in folderItem.ChildItems)
            {
                QSetWebServiceItem childWebServiceItem = childItem as QSetWebServiceItem;
                if (childWebServiceItem != null)
                {
                    xmlWriter.WriteStartElement(QSetWebServiceItem.TypeName);
                    xmlWriter.WriteAttributeString(QSetXmlFileFormat.ItemAttributes.Name, childWebServiceItem.Name);
                    xmlWriter.WriteAttributeString(QSetXmlFileFormat.ItemAttributes.Guid, childWebServiceItem.ID.ToString());
                    xmlWriter.WriteEndElement();
                }
            }
        }
示例#2
0
		/// <summary>
		/// Opens a <see cref="WebServiceClientControl"/> for a <see cref="QSetWebServiceItem"/> if a 
		/// control is not already open, otherwise the existing control is opened.
		/// </summary>
		/// <param name="webServiceItem">Web Service item to open</param>
		public void OpenWebServiceClient(QSetWebServiceItem webServiceItem)
		{
			if (_taskManager.IsItemOpen(webServiceItem))
				_taskManager.BringDocumentToFront(webServiceItem);
			else
				LoadNewWebServiceClientControl(webServiceItem);
		}
示例#3
0
		/// <summary>
		/// Loads a new <see cref="WebServiceClientControl"/> and adds it into the document collection, and opens the document.
		/// </summary>
		/// <param name="webServiceItem"></param>
		private void LoadNewWebServiceClientControl(QSetWebServiceItem webServiceItem)
		{			
			//set up a web service control, and create a dock for it
			WebServiceClientControl webServiceClientControl = new WebServiceClientControl();			
			webServiceClientControl.QSetWebServiceItem = webServiceItem;
			_primaryControls.WebServiceClientControlCollection.Add(webServiceItem.ID.ToString(), webServiceClientControl);

            DockControl newDockControl = new TabbedDocument(_primaryControls.DocumentContainer.Manager, webServiceClientControl, webServiceItem.Name);
            newDockControl.Open();
			newDockControl.Activate();
		}
示例#4
0
		/// <summary>
		/// Adds a new web service client to the Q Set.
		/// </summary>
		public void AddNewWebServiceClient()
		{
			//ensure the q set is selected at a valid position
			if (_primaryControls.QSetExplorer.QSet == null)
				_taskManager.CreateNewQSet();
			if (_primaryControls.QSetExplorer.ActiveItem == null || 
				!(_primaryControls.QSetExplorer.ActiveItem is QSetFolderItem) ||
				_primaryControls.QSetExplorer.ActiveItem is QSetMachineItem)
				_primaryControls.QSetExplorer.ActiveItem = _primaryControls.QSetExplorer.QSet;

			QSetFolderItem parentItem = _primaryControls.QSetExplorer.ActiveItem as QSetFolderItem;

			if (parentItem != null)
			{
				QSetWebServiceItem webServiceItem = new QSetWebServiceItem(_taskManager.GetNextAvailableNewItemName("New Web Service Client", parentItem.ChildItems));
				parentItem.ChildItems.Add(webServiceItem);
				LoadNewWebServiceClientControl(webServiceItem);
			}
		}
示例#5
0
		/// <summary>
		/// Recursively creates all of the child items of a Q Set item.
		/// </summary>
		/// <param name="parentItem">Parent item.</param>
		/// <param name="parentNodeIterator">XPathNodeIterator positioned at the parent item. </param>
		private static void CreateChildItems(QSetFolderItem parentItem, XPathNodeIterator parentNodeIterator)
		{			
			//iterate through all child items
			XPathNodeIterator childNodeIterator = parentNodeIterator.Current.Select("*");
			while (childNodeIterator.MoveNext())
			{
				//get the item details	
				string itemName = childNodeIterator.Current.GetAttribute(QSetXmlFileFormat.ItemAttributes.Name, "");	
				Guid itemGuid = Guid.Empty;
				if (childNodeIterator.Current.GetAttribute(QSetXmlFileFormat.ItemAttributes.Guid, "") != string.Empty)
					itemGuid = new Guid(childNodeIterator.Current.GetAttribute(QSetXmlFileFormat.ItemAttributes.Guid, ""));
				
				//create a new item of the required type, specifying the guid if available				
				QSetItemBase newItem = null;
				if (childNodeIterator.Current.Name == QSetFolderItem.TypeName)
				{
					//create folder
					if (itemGuid == Guid.Empty)
						newItem = new QSetFolderItem(itemName);
					else
						newItem = new QSetFolderItem(itemGuid, itemName);						
				}
				else if (childNodeIterator.Current.Name == QSetMachineItem.TypeName)
				{
					//create machine
					if (itemGuid == Guid.Empty)
						newItem = new QSetMachineItem(itemName);
					else
						newItem = new QSetMachineItem(itemGuid, itemName);
				}
				else if (childNodeIterator.Current.Name == QSetQueueItem.TypeName)
				{
					//create queue
					if (itemGuid == Guid.Empty)
						newItem = new QSetQueueItem(itemName);
					else
						newItem = new QSetQueueItem(itemGuid, itemName);
					if (childNodeIterator.Current.GetAttribute(QSetXmlFileFormat.QueueElement.Attributes.MessageViewerXslt, "") != string.Empty)
						((QSetQueueItem)newItem).MessageViewerXslt = childNodeIterator.Current.GetAttribute(QSetXmlFileFormat.QueueElement.Attributes.MessageViewerXslt, "");
				}
				else if (childNodeIterator.Current.Name == QSetWebServiceItem.TypeName)
				{
					//web service item
					if (itemGuid == Guid.Empty)
						newItem = new QSetWebServiceItem(itemName);
					else
						newItem = new QSetWebServiceItem(itemGuid, itemName);
				}
			
				//apply finaly settings and actions to new item
				if (newItem != null)
				{
					//finish type specific setup
					if (newItem is QSetFolderItem)
					{
						//create child items
						CreateChildItems((QSetFolderItem)newItem, childNodeIterator);
					}

					//final setup common to all item types
					parentItem.ChildItems.Add(newItem);
					newItem.IsDirty = false;			
				}		
			}
		}
示例#6
0
        /// <summary>
        /// Recursively creates all of the child items of a Q Set item.
        /// </summary>
        /// <param name="parentItem">Parent item.</param>
        /// <param name="parentNodeIterator">XPathNodeIterator positioned at the parent item. </param>
        private static void CreateChildItems(QSetFolderItem parentItem, XPathNodeIterator parentNodeIterator)
        {
            //iterate through all child items
            XPathNodeIterator childNodeIterator = parentNodeIterator.Current.Select("*");

            while (childNodeIterator.MoveNext())
            {
                //get the item details
                string itemName = childNodeIterator.Current.GetAttribute(QSetXmlFileFormat.ItemAttributes.Name, "");
                Guid   itemGuid = Guid.Empty;
                if (childNodeIterator.Current.GetAttribute(QSetXmlFileFormat.ItemAttributes.Guid, "") != string.Empty)
                {
                    itemGuid = new Guid(childNodeIterator.Current.GetAttribute(QSetXmlFileFormat.ItemAttributes.Guid, ""));
                }

                //create a new item of the required type, specifying the guid if available
                QSetItemBase newItem = null;
                if (childNodeIterator.Current.Name == QSetFolderItem.TypeName)
                {
                    //create folder
                    if (itemGuid == Guid.Empty)
                    {
                        newItem = new QSetFolderItem(itemName);
                    }
                    else
                    {
                        newItem = new QSetFolderItem(itemGuid, itemName);
                    }
                }
                else if (childNodeIterator.Current.Name == QSetMachineItem.TypeName)
                {
                    //create machine
                    if (itemGuid == Guid.Empty)
                    {
                        newItem = new QSetMachineItem(itemName);
                    }
                    else
                    {
                        newItem = new QSetMachineItem(itemGuid, itemName);
                    }
                }
                else if (childNodeIterator.Current.Name == QSetQueueItem.TypeName)
                {
                    //create queue
                    if (itemGuid == Guid.Empty)
                    {
                        newItem = new QSetQueueItem(itemName);
                    }
                    else
                    {
                        newItem = new QSetQueueItem(itemGuid, itemName);
                    }
                    if (childNodeIterator.Current.GetAttribute(QSetXmlFileFormat.QueueElement.Attributes.MessageViewerXslt, "") != string.Empty)
                    {
                        ((QSetQueueItem)newItem).MessageViewerXslt = childNodeIterator.Current.GetAttribute(QSetXmlFileFormat.QueueElement.Attributes.MessageViewerXslt, "");
                    }
                }
                else if (childNodeIterator.Current.Name == QSetWebServiceItem.TypeName)
                {
                    //web service item
                    if (itemGuid == Guid.Empty)
                    {
                        newItem = new QSetWebServiceItem(itemName);
                    }
                    else
                    {
                        newItem = new QSetWebServiceItem(itemGuid, itemName);
                    }
                }

                //apply finaly settings and actions to new item
                if (newItem != null)
                {
                    //finish type specific setup
                    if (newItem is QSetFolderItem)
                    {
                        //create child items
                        CreateChildItems((QSetFolderItem)newItem, childNodeIterator);
                    }

                    //final setup common to all item types
                    parentItem.ChildItems.Add(newItem);
                    newItem.IsDirty = false;
                }
            }
        }