首页 文章

VSTO outlook AddIn项目中的WPF窗口

提问于
浏览
0

我创建了一个简单的VSTO outlook Add-In项目,只是想在outlook中使用按钮的功能来执行一个显示WPF窗口的VBA代码,

当我运行这个,Com addin项目,使用WinForms它通过Visual Studio通过调试模式显示,并通过执行Outlook并单击运行VBA代码的按钮来执行com插件,但是当我将其更改为WPF Window它从视觉工作室运行得很好,我的意思是我运行项目,它执行了outlook,然后我选择了一个电子邮件并点击了按钮,执行了com插件并显示了WPF表单,但是我试过这个通过运行outlook(没有VS环境)它通过这个错误一遍又一遍,无论我尝试过什么 .

我在以下链接中附加了outlookAddin项目和VBA代码:

https://www.dropbox.com/sh/sbd9upmxthrigha/AACjx2jfmVZKFcqwQfX6SjCJa?dl=0

如果我从现有的(运行WPF表单)替换TCMSCom.cs文件中的此方法

public string OpenConfirmationWizard()
    {

        // run WPF

        TCMSWizard ui = new TCMSWizard();
        ui.ShowDialog();

        // run winforms

        //UserControl1 ui = new UserControl1();
        //ui.ShowDialog();
        return string.Empty;
    }

对此,它将运行winforms

public string OpenConfirmationWizard()
    {
        //TCMSWizard ui = new TCMSWizard();
        //ui.ShowDialog();

        UserControl1 ui = new UserControl1();
        ui.ShowDialog();
        return string.Empty;
    }

链中的第一个异常的堆栈跟踪:位于C:\ Users \ eranm \ Documents \ TFS \ PI-HF_TCMSCOMAddIn \ Features \ TCMSCOMAddIn_Phase1 \ TCMSCOMAddIn中TCMSCOMAddIn.TCMSWizard..ctor()的System.Windows.Window..ctor() \ TCMSWizard.xaml.cs:位于C:\ Users \ eranm \ Documents \ TFS \ PI-HF_TCMSCOMAddIn \ Features \ TCMSCOMAddIn_Phase1 \ TCMSCOMAddIn \ TCMSCom.cs:第22行的TCMSCOMAddIn.TCMSCom.OpenConfirmationWizard()第23行

链中的最后一个异常的堆栈跟踪:位于MS.Internal.FontCache.Util..cctor()的System.Uri.CreateThis(String uri,Boolean dontEscape,UriKind uriKind)

the exceptions messages in chain are like the following:

“'system.windows.window'的类型初始化程序引发异常”

“'System.Windows.FrameworkElement'的类型初始化程序引发了异常 . ”

“'System.Windows.Documents.TextElement'的类型初始化程序引发了异常 . ”

“'MS.Internal.FontCache.Util'的类型初始值设定项引发了异常 . ”

“无效的URI:无法确定URI的格式 . ”

我很感激你帮助解决这个问题

非常感谢,

伊兰

1 回答

  • 1

    好的,错误已修复,

    问题是注册表中环境中的路径变量设置为超过2048个字符 .

相关问题