Esempio n. 1
0
 public void AddQueryServiceTaskPane(InfoPath.Window _window)
 {
     if (ctpTaskPane == null)
     {
         ctpTaskPane = this.CustomTaskPanes.Add(new InfoPathQueryServiceControl(), "Query Service Control", _window);
     }
     ctpTaskPane.Visible = true;
 }
        private void insertCDE(InfoPath.Application application)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(dataElementCreationControl.LastResult);
                XmlNode srcNode = doc.DocumentElement.SelectSingleNode("/data-element");

                InfoPath.XDocument xDoc = Globals.ThisAddIn.Application.XDocuments[0];

                /*
                 * xDoc.View.GetContextNodes returns 3 objects (2, if root node):
                 * - xDoc.View.GetContextNodes(Type.Missing, Type.Missing)[0] => current node
                 * - xDoc.View.GetContextNodes(Type.Missing, Type.Missing)[1] => immediate parent of current node
                 * - xDoc.View.GetContextNodes(Type.Missing, Type.Missing)[2] => document node
                 */
                InfoPathXml.IXMLDOMNode n = xDoc.View.GetContextNodes(Type.Missing, Type.Missing)[0];

                if (n.baseName != "data-element")
                {
                    MessageBox.Show("No valid context node selected");
                    return;
                }

                string swap = swapNamespace(srcNode);

                InfoPathXml.IXMLDOMDocument dom = xDoc.CreateDOM();
                dom.loadXML(swap);
                InfoPathXml.IXMLDOMNode newNode = dom.selectSingleNode("/*");
                n.parentNode.replaceChild(newNode, n);
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error inserting data element: " + ex.Message);
                return;
            }
        }
Esempio n. 3
0
 void InfoPahtApplicationEvents_WindowDeactivate(InfoPath._XDocument pDocument, InfoPath.Window pWindow)
 {
 }
Esempio n. 4
0
        void InfoPahtApplicationEvents_WindowActivate(InfoPath._XDocument pDocument, InfoPath.Window pWindow)
        {
            mainMenuBar = ((Office.CommandBars)this.Application.ActiveWindow.CommandBars).ActiveMenuBar;
            if (vstoAddInMenu != null)
            {
                vstoAddInMenu.Visible = true;
            }
            else
            {
                AddMenu();
            }

            foreach (Microsoft.Office.Tools.CustomTaskPane taskpane in this.CustomTaskPanes)
            {
                if (taskpane.Title == "Query Service Control")
                {
                    taskpane.Visible = true;
                    return;
                }
            }
            AddQueryServiceTaskPane(this.Application.ActiveWindow);
        }
Esempio n. 5
0
 private void appevents_XDocumentOpen(InfoPath._XDocument pDocument)
 {
     AddMenu();
     RemoveOrphanedTaskPanes();
     if (showTaskPane == true)
     {
         AddQueryServiceTaskPane(this.Application.ActiveWindow);
     }
 }
Esempio n. 6
0
 private void appevents_NewXDocument(InfoPath._XDocument pDocument)
 {
     AddMenu();
     if (showTaskPane == true)
     {
         AddQueryServiceTaskPane(this.Application.ActiveWindow);
     }
 }