Outlook 插件部署线程
我正在用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.