/// <summary>
        ///   This is the OnPaste routine. If the action is paste,
        ///   it calls the correct paste function above.
        /// </summary>
        /// <param name="sender"> </param>
        /// <param name="e"> </param>
        public void OnPaste( object sender, RoutedEventArgs e )
        {
            var SelectedItem = (TreeViewItem) NavigationControl1.CmdletTreeView.SelectedItem;

            switch ( MainWindow.ClipBoardRecord.TypeName )
            {
                case "cmdlet description info":
                    if ( SelectedItem.DataContext is cmdletDescription )
                    {
                        var copiedinfo = (cmdletDescription) MainWindow.ClipBoardRecord.ClipBoardItem;
                        var selectedCmdlet = (cmdletDescription) SelectedItem.DataContext;
                        selectedCmdlet.ShortDescription = copiedinfo.ShortDescription;
                        selectedCmdlet.LongDescription = copiedinfo.LongDescription;
                        selectedCmdlet.InputType = copiedinfo.InputType;
                        selectedCmdlet.InputDesc = copiedinfo.InputDesc;
                        selectedCmdlet.OutputType = copiedinfo.OutputType;
                        selectedCmdlet.OutputDesc = copiedinfo.OutputDesc;
                        selectedCmdlet.Note = copiedinfo.Note;
                        SelectedItem.DataContext = selectedCmdlet;
                        doDefaultTreeViewSelectionChange();
                    }
                    else
                    {
                        MessageBox.Show(
                                "You have placed " + MainWindow.ClipBoardRecord.TypeName +
                                " type on the tools clip board.\nMake sure to paste it on a matching node type.",
                                "Error pasting copied record",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning );
                    }
                    break;
                case "parameters description info":
                    if ( SelectedItem.DataContext is Collection<parameterDecription> )
                    {
                        var copiedParameters =
                                (Collection<parameterDecription>) MainWindow.ClipBoardRecord.ClipBoardItem;
                        var selectedParameters = (Collection<parameterDecription>) SelectedItem.DataContext;
                        foreach ( parameterDecription param in selectedParameters )
                        {
                            foreach ( parameterDecription copiedparam in copiedParameters )
                            {
                                if ( param.Name ==
                                     copiedparam.Name )
                                {
                                    copyParameterInfo( param, copiedparam );
                                    break;
                                }
                            }
                        }
                        SelectedItem.DataContext = selectedParameters;
                        doDefaultTreeViewSelectionChange();
                    }
                    else
                    {
                        MessageBox.Show(
                                "You have placed " + MainWindow.ClipBoardRecord.TypeName +
                                " type on the tools clip board.\nMake sure to paste it on a matching node type.",
                                "Error pasting copied record",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning );
                    }

                    break;
                case "parameter decription info":
                    if ( SelectedItem.DataContext is parameterDecription )
                    {
                        var copiedParameter = (parameterDecription) MainWindow.ClipBoardRecord.ClipBoardItem;
                        var selectedPrameter = (parameterDecription) SelectedItem.DataContext;
                        copyParameterInfo( selectedPrameter, copiedParameter );
                        SelectedItem.DataContext = selectedPrameter;
                        doDefaultTreeViewSelectionChange();
                    }
                    else
                    {
                        MessageBox.Show(
                                "You have placed " + MainWindow.ClipBoardRecord.TypeName +
                                " type on the tools clip board.\nMake sure to paste it on a matching node type.",
                                "Error pasting copied record",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning );
                    }
                    break;
                case "example info":
                    if ( SelectedItem.DataContext is Collection<example> ||
                         SelectedItem.DataContext is example )
                    {
                        if ( SelectedItem.DataContext is Collection<example> )
                        {
                            var copiedExample = (example) MainWindow.ClipBoardRecord.ClipBoardItem;
                            var selectedExamples = (Collection<example>) SelectedItem.DataContext;
                            var newExample = new example();
                            copyExample( newExample, copiedExample, selectedExamples.Count );
                            selectedExamples.Add( newExample );
                            SelectedItem.DataContext = selectedExamples;
                        }
                        else
                        {
                            var parentNode = (TreeViewItem) SelectedItem.Parent;
                            var ParentExamples = (Collection<example>) parentNode.DataContext;
                            var copiedExample = (example) MainWindow.ClipBoardRecord.ClipBoardItem;
                            var selectedExample = (example) SelectedItem.DataContext;
                            copyExample( selectedExample, copiedExample, ParentExamples.Count );
                            SelectedItem.DataContext = selectedExample;
                        }
                        doDefaultTreeViewSelectionChange();
                    }
                    else
                    {
                        MessageBox.Show(
                                "You have placed " + MainWindow.ClipBoardRecord.TypeName +
                                " type on the tools clip board.\nMake sure to paste it on a matching node type.",
                                "Error pasting copied record",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning );
                    }
                    break;

                case "examples description info":
                    if ( SelectedItem.DataContext is Collection<example> )
                    {
                        var copiedExamples = (Collection<example>) MainWindow.ClipBoardRecord.ClipBoardItem;
                        var selectedExamples = (Collection<example>) SelectedItem.DataContext;
                        foreach ( example copiedExample in copiedExamples )
                        {
                            var newExample = new example();
                            copyExample( newExample, copiedExample, selectedExamples.Count );
                            selectedExamples.Add( newExample );
                        }
                        SelectedItem.DataContext = selectedExamples;

                        doDefaultTreeViewSelectionChange();
                    }
                    else
                    {
                        MessageBox.Show(
                                "You have placed " + MainWindow.ClipBoardRecord.TypeName +
                                " type on the tools clip board.\nMake sure to paste it on a matching node type.",
                                "Error pasting copied record",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning );
                    }
                    break;
                case "related link info":
                    if ( SelectedItem.DataContext is relatedlink ||
                         SelectedItem.DataContext is Collection<relatedlink> )
                    {
                        if ( SelectedItem.DataContext is Collection<relatedlink> )
                        {
                            var copiedLink = (relatedlink) MainWindow.ClipBoardRecord.ClipBoardItem;
                            var selectedLinks = (Collection<relatedlink>) SelectedItem.DataContext;
                            var newrelatedlink = new relatedlink();
                            copyLink( newrelatedlink, copiedLink, selectedLinks.Count );
                            selectedLinks.Add( newrelatedlink );
                            SelectedItem.DataContext = selectedLinks;
                        }
                        else
                        {
                            var parentNode = (TreeViewItem) SelectedItem.Parent;
                            var ParentLinks = (Collection<relatedlink>) parentNode.DataContext;
                            var copiedLink = (relatedlink) MainWindow.ClipBoardRecord.ClipBoardItem;
                            var selectedLink = (relatedlink) SelectedItem.DataContext;
                            copyLink( selectedLink, copiedLink, ParentLinks.Count );
                            SelectedItem.DataContext = selectedLink;
                        }
                        doDefaultTreeViewSelectionChange();
                    }
                    else
                    {
                        MessageBox.Show(
                                "You have placed " + MainWindow.ClipBoardRecord.TypeName +
                                " type on the tools clip board.\nMake sure to paste it on a matching node type.",
                                "Error pasting copied record",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning );
                    }
                    break;

                case "related links info":
                    if ( SelectedItem.DataContext is Collection<relatedlink> )
                    {
                        var copiedLinks = (Collection<relatedlink>) MainWindow.ClipBoardRecord.ClipBoardItem;
                        var selectedLinks = (Collection<relatedlink>) SelectedItem.DataContext;
                        foreach ( relatedlink copiedLink in copiedLinks )
                        {
                            var newLink = new relatedlink();
                            copyLink( newLink, copiedLink, selectedLinks.Count );
                            selectedLinks.Add( newLink );
                        }
                        SelectedItem.DataContext = selectedLinks;
                        doDefaultTreeViewSelectionChange();
                    }
                    else
                    {
                        MessageBox.Show(
                                "You have placed " + MainWindow.ClipBoardRecord.TypeName +
                                " type on the tools clip board.\nMake sure to paste it on a matching node type.",
                                "Error pasting copied record",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning );
                    }
                    break;
            }
        }
 /// <summary>
 ///   Paste one related link at a time
 /// </summary>
 /// <param name="selectedLink"> </param>
 /// <param name="copiedLink"> </param>
 /// <param name="count"> </param>
 public void copyLink( relatedlink selectedLink, relatedlink copiedLink, int count )
 {
     MainWindow.RelatedLinks1.RelatedLinkTextBox.Text = copiedLink.LinkText;
     AddRelatedLink_Click( null, null );
 }
        /// <summary>
        ///   This routine handles the Save button on the Related Link page
        ///   It adds the new record to the tree. 
        ///   If this is already in the tree it updates it with the latest 
        ///   info in the page.
        /// </summary>
        /// <param name="sender"> </param>
        /// <param name="args"> </param>
        public void AddRelatedLink_Click( object sender, RoutedEventArgs args )
        {
            var SelectedNode = (TreeViewItem) NavigationControl1.CmdletTreeView.SelectedItem;
            if ( SelectedNode != null )
            {
                int count = SelectedNode.Items.Count;
                if ( MainWindow.RelatedLinks1.LinkIDTextBox.Text == "" )
                        //This is a new link
                {
                    //Add new related link info.
                    var ParentNode = (TreeViewItem) SelectedNode.Parent;
                    var Cmdletdesc = (cmdletDescription) ParentNode.DataContext;
                    int LinkCount = 0;
                    if ( Cmdletdesc.RelatedLinks != null )
                    {
                        LinkCount = Cmdletdesc.RelatedLinks.Count;
                    }

                    var linkDetails = new relatedlink();
                    linkDetails.LinkText = MainWindow.RelatedLinks1.RelatedLinkTextBox.Text;
                    linkDetails.LinkID = LinkCount;
                    var NewLinkNode = new TreeViewItem();
                    NewLinkNode.DataContext = linkDetails;
                    NewLinkNode.Header = linkDetails.LinkText;
                    if ( Cmdletdesc.RelatedLinks == null )
                    {
                        var Links = new Collection<relatedlink>();
                        Links.Add( linkDetails );
                        Cmdletdesc.RelatedLinks = Links;
                        SelectedNode.DataContext = Links;
                    }
                    else
                    {
                        Cmdletdesc.RelatedLinks.Add( linkDetails );
                    }
                    MainWindow.ResetLinksPage();

                    if ( (String) SelectedNode.Header == "Related Links" )
                    {
                        if ( sender != null )
                        {
                            SelectedNode.Items.Add( NewLinkNode );
                            SelectedNode.IsExpanded = true;
                            var ChildNode = (TreeViewItem) SelectedNode.Items[count];
                            ChildNode.IsSelected = true;
                        }
                        else
                        {
                            SelectedNode.Items.Add( NewLinkNode );
                            SelectedNode.IsExpanded = true;
                        }
                    }
                }

                else //this is an existing link
                {
                    if ( SelectedNode.Header.ToString() == "Related Links" )
                    {
                        //Update link info.
                        var linkDetails = (Collection<relatedlink>) SelectedNode.DataContext;
                        var linkDetail = new relatedlink();
                        linkDetail.LinkText = MainWindow.RelatedLinks1.RelatedLinkTextBox.Text;
                        linkDetails.Add( linkDetail );
                    }
                    else
                    {
                        var linkDetails = (relatedlink) SelectedNode.DataContext;
                        linkDetails.LinkText = MainWindow.RelatedLinks1.RelatedLinkTextBox.Text;
                        SelectedNode.Header = MainWindow.RelatedLinks1.RelatedLinkTextBox.Text;
                    }
                }
            }
        }
        /// <summary>
        ///   This routine removes a related link from the tree.
        /// </summary>
        /// <param name="sender"> </param>
        /// <param name="args"> </param>
        public void DeleteLink_Click( object sender, RoutedEventArgs args )
        {
            if ( RelatedLinks1.LinkIDTextBox.Text == "" )
            {
                //Safe to simply reset the Examples page.
                MainWindow.ResetLinksPage();
            }
            else //We must remove the current record from the Examples list
            {
                var selectedNode = (TreeViewItem) MainWindow.NavControl.CmdletTreeView.SelectedItem;
                var ParentNode = (TreeViewItem) selectedNode.Parent;
                var CmdletNode = (TreeViewItem) ParentNode.Parent;
                ParentNode.IsSelected = true;
                ParentNode.Items.Remove( selectedNode );

                var selectedCmdlet = (cmdletDescription) CmdletNode.DataContext;
                var selectedLink = (relatedlink) selectedNode.DataContext;

                foreach ( cmdletDescription mycmdlet in MainWindow.CmdletsHelps )
                {
                    if ( mycmdlet.CmdletName ==
                         selectedCmdlet.CmdletName )
                    {
                        Collection<relatedlink> myLinks = mycmdlet.RelatedLinks;
                        var linktoRemove = new relatedlink();
                        foreach ( relatedlink mylink in myLinks )
                        {
                            if ( mylink.LinkID ==
                                 selectedLink.LinkID )
                            {
                                linktoRemove = mylink;
                            }
                        }
                        if ( linktoRemove.LinkID.ToString() != null )
                        {
                            mycmdlet.RelatedLinks.Remove( linktoRemove );
                            ParentNode.Items.Remove( selectedNode );
                        }
                    }
                }
            }
        }
        /// <summary>
        ///   This is the static method which Asim helped me with.
        ///   I get all the Cmdlet Mamal info from here.
        ///   I need to pass the cmdletDescription record before adding it to the CmdletHelps collection.
        /// </summary>
        public static cmdletDescription GetExistingHelpInfo( cmdletDescription CmdletHelp,
            String CmdletName,
            String path)
        {
            //String path1 = @"C:\Windows\System32\WindowsPowerShell\v1.0\en-US\Microsoft.PowerShell.Commands.Management.dll-Help.xml";
            var doc = new XmlDocument();
            doc.Load( path );

            var ns = new XmlNamespaceManager( doc.NameTable );
            ns.AddNamespace( "", "http://msh" );
            ns.AddNamespace( "command", "http://schemas.microsoft.com/maml/dev/command/2004/10" );
            ns.AddNamespace( "maml", "http://schemas.microsoft.com/maml/2004/10" );
            ns.AddNamespace( "dev", "http://schemas.microsoft.com/maml/dev/2004/10" );
            XmlNodeList commandNodes = doc.SelectNodes( "//command:command", ns );
            foreach ( XmlNode commandNode in commandNodes )
            {
                XmlNode nameNode = commandNode.SelectSingleNode( "command:details/command:name", ns );
                if ( nameNode.InnerText.Trim().ToLower() ==
                     CmdletName.ToLower() )
                {
                    // MessageBox.Show(commandNode.OuterXml);
                    XmlNode tempNode = null;

                    tempNode = commandNode.SelectSingleNode( "command:details/maml:description", ns );
                    if ( tempNode != null )
                    {
                        CmdletHelp.OldShortDescription = CmdletHelp.ShortDescription = tempNode.InnerText.Trim();
                    }

                    tempNode = commandNode.SelectSingleNode( "maml:description", ns );
                    if ( tempNode != null )
                    {
                        CmdletHelp.OldLongDescription = CmdletHelp.LongDescription = tempNode.InnerText.Trim();
                    }

                    tempNode = commandNode.SelectSingleNode( "command:inputTypes/command:inputType/dev:type/maml:name",
                                                             ns );
                    if ( tempNode != null )
                    {
                        CmdletHelp.OldInputType = CmdletHelp.InputType = tempNode.InnerText.Trim();
                    }

                    tempNode =
                            commandNode.SelectSingleNode(
                                    "command:inputTypes/command:inputType/dev:type/maml:description", ns );
                    if ( tempNode != null )
                    {
                        CmdletHelp.OldInputDesc = CmdletHelp.InputDesc = tempNode.InnerText.Trim();
                    }

                    tempNode =
                            commandNode.SelectSingleNode(
                                    "command:returnValues/command:returnValue/dev:type/maml:name", ns );
                    if ( tempNode != null )
                    {
                        CmdletHelp.OldOutputType = CmdletHelp.OutputType = tempNode.InnerText.Trim();
                    }

                    tempNode =
                            commandNode.SelectSingleNode(
                                    "command:returnValues/command:returnValue/dev:type/maml:description", ns );
                    if ( tempNode != null )
                    {
                        CmdletHelp.OldOutputDesc = CmdletHelp.OutputDesc = tempNode.InnerText.Trim();
                    }

                    tempNode = commandNode.SelectSingleNode( "maml:alertSet/maml:alert", ns );
                    if ( tempNode != null )
                    {
                        CmdletHelp.OldNote = CmdletHelp.Note = tempNode.InnerText.Trim();
                    }

                    XmlNodeList exampleNodes = commandNode.SelectNodes( "command:examples/command:example", ns );

                    int exampleCount = 0;
                    var CmdletExamples = new Collection<example>();
                    foreach ( XmlNode exampleNode in exampleNodes )
                    {
                        var CmdletExample = new example();

                        tempNode = exampleNode.SelectSingleNode( "maml:title", ns );
                        if ( tempNode != null )
                        {
                            CmdletExample.OldExampleName =
                                    CmdletExample.ExampleName = tempNode.InnerText.Trim().Replace( "-", "" );
                            if ( CmdletExample.ExampleName.Length == 0 ||
                                 CmdletExample.ExampleName.Replace( " ", "" ) == "" )
                            {
                                CmdletExample.ExampleName = CmdletExample.OldExampleName = "Unkown";
                            }
                        }

                        CmdletExample.ExampleID = exampleCount;

                        tempNode = exampleNode.SelectSingleNode( "dev:code", ns );
                        if ( tempNode != null )
                        {
                            CmdletExample.OldExampleCmd = CmdletExample.ExampleCmd = tempNode.InnerText.Trim();
                        }

                        tempNode = exampleNode.SelectSingleNode( "dev:remarks", ns );
                        if ( tempNode != null )
                        {
                            int NodeCount = 0;
                            foreach ( XmlNode DescriptionNode in tempNode )
                            {
                                if ( NodeCount == 0 )
                                {
                                    CmdletExample.OldExampleDescription =
                                            CmdletExample.ExampleDescription = DescriptionNode.InnerText.Trim();
                                }
                                else
                                {
                                    CmdletExample.OldExampleOutput += DescriptionNode.InnerText.Trim();
                                    CmdletExample.ExampleOutput = CmdletExample.OldExampleOutput;
                                }
                                NodeCount++;
                            }
                        }

                        tempNode = exampleNode.SelectSingleNode( "command:commandLines", ns );
                        if ( tempNode != null )
                        {
                            CmdletExample.OldExampleOutput += tempNode.InnerText.Trim();
                            CmdletExample.ExampleOutput = CmdletExample.OldExampleOutput;
                        }

                        exampleCount++;

                        CmdletExamples.Add( CmdletExample );
                    }

                    CmdletHelp.Examples = CmdletExamples;

                    var RelatedLinks = new Collection<relatedlink>();
                    XmlNodeList NodeLinks = commandNode.SelectNodes( "maml:relatedLinks/maml:navigationLink", ns );
                    int LinkCount = 0;
                    foreach ( XmlNode linkNode in NodeLinks )
                    {
                        var RelatedLink = new relatedlink();

                        tempNode = linkNode.SelectSingleNode( "maml:linkText", ns );
                        if ( tempNode != null )
                        {
                            RelatedLink.OldLinkText = RelatedLink.LinkText = tempNode.InnerText.Trim();
                            if ( RelatedLink.LinkText.Length == 0 )
                            {
                                RelatedLink.LinkText = RelatedLink.LinkText = "Unkown";
                            }
                        }

                        RelatedLink.LinkID = LinkCount;

                        LinkCount++;

                        RelatedLinks.Add( RelatedLink );
                    }
                    CmdletHelp.RelatedLinks = RelatedLinks;

                    //iterate through parameters
                    XmlNodeList parameterNodes = commandNode.SelectNodes( "command:parameters/command:parameter", ns );
                    if ( CmdletHelp.ParameterDecription != null )
                    {
                        foreach ( parameterDecription CmdletParameter in CmdletHelp.ParameterDecription )
                        {
                            //maml:description
                            foreach ( XmlNode parameterNode in parameterNodes )
                            {
                                tempNode = parameterNode.SelectSingleNode( "maml:name", ns );
                                if ( tempNode != null )
                                {
                                    if ( CmdletParameter.Name.ToLower() ==
                                         tempNode.InnerText.Trim().ToLower() )
                                    {
                                        tempNode = parameterNode.SelectSingleNode( "maml:description", ns );
                                        if ( tempNode != null )
                                        {
                                            CmdletParameter.OldDescription =
                                                    CmdletParameter.NewDescription = tempNode.InnerText.Trim();
                                        }

                                        tempNode = parameterNode.SelectSingleNode( "dev:defaultValue", ns );
                                        if ( tempNode != null )
                                        {
                                            CmdletParameter.DefaultValue =
                                                    CmdletParameter.OldDefaultValue = tempNode.InnerText.Trim();
                                        }

                                        tempNode = parameterNode.SelectSingleNode( "@globbing", ns );

                                        if ( tempNode.Value.ToLower().Trim() == "true" )
                                        {
                                            CmdletParameter.Globbing = CmdletParameter.OldGlobbing = true;
                                        }
                                        else
                                        {
                                            CmdletParameter.Globbing = CmdletParameter.OldGlobbing = false;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    //I do not have code parameters. Get only help ones and mark them in red.

                    foreach ( XmlNode parameterNode in parameterNodes )
                    {
                        Boolean ParameterFound = false;
                        tempNode = parameterNode.SelectSingleNode( "maml:name", ns );
                        String ParameterName = tempNode.InnerText.Trim();
                        if ( CmdletHelp.ParameterDecription != null )
                        {
                            foreach ( parameterDecription CmdletParameter in CmdletHelp.ParameterDecription )
                            {
                                if ( CmdletParameter.Name.ToLower() ==
                                     ParameterName.ToLower() )
                                {
                                    ParameterFound = true;
                                    break;
                                }
                            }
                        }
                        if ( ParameterFound == false )
                        {
                            //Get help parameter.
                            var CmdletParameter = new parameterDecription();
                            CmdletParameter.HelpOnlyParameter = true;
                            MainWindow.ObsoleteInfo = true;
                            tempNode = parameterNode.SelectSingleNode( "maml:name", ns );
                            if ( tempNode != null )
                            {
                                //  if (CmdletParameter.Name.ToLower() == tempNode.InnerText.Trim().ToLower())
                                // {
                                tempNode = parameterNode.SelectSingleNode( "maml:description", ns );
                                if ( tempNode != null )
                                {
                                    CmdletParameter.OldDescription =
                                            CmdletParameter.NewDescription = tempNode.InnerText.Trim();
                                }

                                tempNode = parameterNode.SelectSingleNode( "dev:defaultValue", ns );
                                if ( tempNode != null )
                                {
                                    CmdletParameter.DefaultValue =
                                            CmdletParameter.OldDefaultValue = tempNode.InnerText.Trim();
                                }

                                tempNode = parameterNode.SelectSingleNode( "@globbing", ns );

                                if ( tempNode.Value.ToLower().Trim() == "true" )
                                {
                                    CmdletParameter.Globbing = CmdletParameter.OldGlobbing = true;
                                }
                                else
                                {
                                    CmdletParameter.Globbing = CmdletParameter.OldGlobbing = false;
                                }
                                tempNode = parameterNode.SelectSingleNode( "@pipelineInput", ns );

                                if ( tempNode != null )
                                {
                                    if ( tempNode.Value.ToLower().Trim() == "true (ByPropertyName)" )
                                    {
                                        CmdletParameter.VFPBPN = CmdletParameter.VFPBPN = true;
                                    }
                                    else if ( tempNode.Value.ToLower().Trim() == "true (ByValue, ByPropertyName)" )
                                    {
                                        CmdletParameter.VFPBPN = CmdletParameter.VFPBPN = true;
                                        CmdletParameter.VFP = CmdletParameter.VFP = true;
                                    }
                                    else if ( tempNode.Value.ToLower().Trim() == "true (ByValue)" )
                                    {
                                        CmdletParameter.VFP = CmdletParameter.VFP = true;
                                    }
                                    else
                                    {
                                        CmdletParameter.VFPBPN = CmdletParameter.VFPBPN = false;
                                        CmdletParameter.VFP = CmdletParameter.VFP = false;
                                    }
                                }
                                tempNode = parameterNode.SelectSingleNode( "@position", ns );

                                if ( tempNode != null )
                                {
                                    CmdletParameter.Position = tempNode.Value.ToLower().Trim();
                                }

                                tempNode = parameterNode.SelectSingleNode( "@required", ns );
                                if ( tempNode != null )
                                {
                                    if ( tempNode.Value.ToLower().Trim() == "true" )
                                    {
                                        CmdletParameter.isMandatory = true;
                                    }
                                }
                                tempNode = parameterNode.SelectSingleNode( "dev:type/maml:name", ns );
                                if ( tempNode != null )
                                {
                                    if ( tempNode.InnerText != null )
                                    {
                                        CmdletParameter.ParameterType = tempNode.InnerText.Trim().ToLower();
                                    }
                                }

                                CmdletParameter.Name = ParameterName;
                                CmdletParameter.CmdletName = CmdletName;
                                if ( CmdletHelp.ParameterDecription == null )
                                {
                                    CmdletHelp.ParameterDecription = new Collection<parameterDecription>();
                                }
                                CmdletHelp.ParameterDecription.Add( CmdletParameter );
                            }
                        }
                    }

                    // break;
                }
            }
            return CmdletHelp;
        }
        public XmlWriter createLinksSection( XmlWriter writer, relatedlink result )
        {
            try
            {
                writer.WriteRaw( "		<maml:navigationLink>\r\n" );

                writer.WriteRaw( "			<maml:linkText>" );
                //writer.WriteComment("Related link text");
                writer.WriteRaw( HttpUtility.HtmlEncode( result.LinkText ) );
                writer.WriteRaw( "</maml:linkText>\r\n" );

                //End related links section
                writer.WriteRaw( "			<maml:uri/>\r\n" );
                writer.WriteRaw( "		</maml:navigationLink>\r\n" );
            }
            catch ( Exception ex )
            {
                MessageBox.Show( ex.Message, "Error writing the XML File.", MessageBoxButtons.OK, MessageBoxIcon.Warning );
            }

            return writer;
        }