コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InfopathTester"/> class.
 /// </summary>
 /// <param name="FormUri">The form URI.</param>
 /// <param name="InfoPathLoginHandler">An InfoPath login handler.</param>
 public InfopathTester(string FormUri, LogonDialogHandler InfoPathLoginHandler)
 {
     CreateNewInfopathAndLoadForm(FormUri, InfoPathLoginHandler, false);
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InfopathTester"/> class.
 /// </summary>
 /// <param name="FormUri">The form URI.</param>
 /// <param name="InfoPathLoginHandler">The info path login handler.</param>
 /// <param name="readOnlyMode">if set to <c>true</c> the form is opened in [read only mode].</param>
 public InfopathTester(string FormUri, LogonDialogHandler InfoPathLoginHandler, bool readOnlyMode)
 {
     CreateNewInfopathAndLoadForm(FormUri, InfoPathLoginHandler, readOnlyMode);
 }
コード例 #3
0
        /// <summary>
        /// Creates the new infopath and load form.
        /// </summary>
        /// <param name="FormUri">The form URI.</param>
        /// <param name="InfoPathLoginHandler">The info path login handler.</param>
        /// <param name="readOnly">if set to <c>true</c> [read only].</param>
        private void CreateNewInfopathAndLoadForm(string FormUri, LogonDialogHandler InfoPathLoginHandler, bool readOnly)
        {
            // Kill off any existing infopath processes
            foreach (Process proc in Process.GetProcessesByName("infopath"))
            {
                proc.Kill();
            }

            InitInfopathAndStartDialogWatcher(new Application());
            SecurityAlertHandler securityHandler = new SecurityAlertHandler();
            ReplaceFormAlertHandler replaceFormHandler = new ReplaceFormAlertHandler();
            DialogWatcher.Add(securityHandler);
            DialogWatcher.Add(replaceFormHandler);
            if (InfoPathLoginHandler != null)
            {
                // remove other logon dialog handlers since only one handler
                // can effectively handle the logon dialog.
                DialogWatcher.RemoveAll(new LogonDialogHandler("a", "b"));

                // Add the (new) logonHandler
                DialogWatcher.Add(InfoPathLoginHandler);
            }
            if (readOnly)
            {
                InternalInfopathXDocument = InfopathApplicationTester.XDocuments.Open(FormUri, (int)XdDocumentVersionMode.xdCanOpenInReadOnlyMode);
            }
            else
            {
                InternalInfopathXDocument = InfopathApplicationTester.XDocuments.Open(FormUri, (int)XdDocumentVersionMode.xdFailOnVersionOlder);
            }

            InternalInfopathXMLDOMDocument = InternalInfopathXDocument.DOM as IXMLDOMDocument2;
            InternalHTMLDOMDocument = IEDom.IEDOMFromhWnd(this.hWnd);
        }