Outlook 插件部署线程

发布于 2024-09-18 09:03:00 字数 442 浏览 2 评论 0 原文

我正在用 C# 开发一个 Outlook 插件,这是我的启动:

private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        //adds the new issueTopMenu
        //Search the menu and delete if found
        RemoveMenubar();

        //adds the panel
        AddPanelToExplorer();

        //Method to create new menu
        AddMenuBar();
    }

我怎样才能在线程上运行它,因为它访问 Web 服务来获取一些数据,当 Outlook 启动时它会冻结,直到它获取数据,我想要消除冻结时间。

i am developing a outlook addin in c#, heres my startup:

private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        //adds the new issueTopMenu
        //Search the menu and delete if found
        RemoveMenubar();

        //adds the panel
        AddPanelToExplorer();

        //Method to create new menu
        AddMenuBar();
    }

How can i do it to run on a thread, because it access to a webservice to get some data, and when outlook start it freezes until it obtain the data, and i want to eleminate that freeze time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枕梦 2024-09-25 09:03:00

Outlook 对象模型使用单线程。因此,即使您的外接程序中有多个线程,如果这些线程正在执行使用 Outlook 对象模型的代码,它将作为单线程应用程序运行。您可以将不使用 Outlook 对象模型的代码(例如访问 Web 服务和获取数据)分开,并在单独的线程中执行此代码。这样你就可以利用多线程。

Outlook Object model uses single thread. so even if you have multiple threads in your add in, if those thread are executing code which uses outlook object model, it will work as a single threaded app. You can seperate the code which does not use outlook object model like accessing the web service and fetching the data and execute this code in a seperate thread. this way you can make use of multi threading.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文