/// <summary>
        /// Fills the note according current settings
        /// </summary>
        public void SetDialog()
        {
            if (HtmlDocument != null)
            {
                HtmlDocument = null;
                ThisExtension.ROHTMLReleaseDocument();
            }
            HtmlDocument = ThisExtension.ROHTMLDocument();

            if (File.Exists(DocumentPath))
            {
                try
                {
                    File.Delete(DocumentPath);
                }
                catch
                {
                }
            }

            Guid g = System.Guid.NewGuid();

            DocumentPath = GetTempPath() + "\\" + g.ToString() + ".mht";

            HtmlDocument.Body.AddHeader(1, "Pyramid parameters");
            string textH = ThisExtension.Units.DisplayTextFromBase(ThisMainExtension.Data.H, Autodesk.REX.Framework.EUnitType.Dimensions_StructureDim, true);

            HtmlDocument.Body.AddValue2("H", textH);
            string textB = ThisExtension.Units.DisplayTextFromBase(ThisMainExtension.Data.B, Autodesk.REX.Framework.EUnitType.Dimensions_StructureDim, true);

            HtmlDocument.Body.AddValue2("B", textB);

            HtmlDocument.SaveAsSingleFile(DocumentPath);
            webBrowser.Navigate(new Uri(DocumentPath));
        }
        /// <summary>
        /// Fills the note.
        /// </summary>
        public void FillNote()
        {
            if (HtmlDocument != null)
            {
                HtmlDocument = null;
                ThisExtension.ROHTMLReleaseDocument();
            }

            HtmlDocument = ThisExtension.ROHTMLDocument();

            FillHeaderNote();

            if (ThisMainExtension.Data.IdMode)
            {
                if (ThisMainExtension.Data.SelectedElement != null)
                {
                    AddElementToNote(ThisMainExtension.Data.SelectedElement);
                }
            }
            else
            {
                FillGeneralInformation();

                foreach (Node categoryNode in ThisMainExtension.Data.MainNode.Nodes.Values)
                {
                    if (!ThisMainExtension.Data.SelectedCategories.Contains(categoryNode))
                    {
                        continue;
                    }

                    AddCategoryToNote(categoryNode);

                    foreach (Node elementNode in categoryNode.Nodes.Values)
                    {
                        AddElementToNote(elementNode);
                    }
                }
            }

            if (File.Exists(DocumentPath))
            {
                try
                {
                    File.Delete(DocumentPath);
                }
                catch
                {
                }
            }

            Guid g = System.Guid.NewGuid();

            DocumentPath = GetTempPath() + "\\" + g.ToString() + ".mht";

            HtmlDocument.SaveAsSingleFile(DocumentPath);
            webBrowser.Navigate(new Uri(DocumentPath));
        }
        /// <summary>
        /// Handles the Click event of the ToolStripButtonSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void ToolStripButtonSave_Click(object sender, RoutedEventArgs e)
        {
            if (HtmlDocument == null)
            {
                return;
            }

            Microsoft.Win32.SaveFileDialog SaveFileDialog = new Microsoft.Win32.SaveFileDialog();

            SaveFileDialog.Filter          = "MHT (*.mht) file|*.mht|HTML (*.html) file|*.html;";
            SaveFileDialog.OverwritePrompt = true;

            if (SaveFileDialog.ShowDialog(ThisExtension.GetWindowForParent()) == true)
            {
                if (System.IO.Path.GetExtension(SaveFileDialog.FileName).ToLower() == ".mht")
                {
                    HtmlDocument.SaveAsSingleFile(SaveFileDialog.FileName);
                }
                else
                {
                    HtmlDocument.Save(SaveFileDialog.FileName);
                }
            }
        }