背景线程上的Microsoft.Lync.Controls? [英] Microsoft.Lync.Controls on a Background Thread?

查看:58
本文介绍了背景线程上的Microsoft.Lync.Controls?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义用户控件,里面有一个带有stackpanel的scrollview。< o :p>< / o:p>

我使用可观察集合中的PresenceIndicator控件填充stackpanel。 < o:p>< / o:p>

问题是需要很长时间"5-7"该控件出现/加载的秒数,使整个应用程序无法加载。我现在通常会添加10-15个联系人。 < o:p>< / o:p>

我尝试过使用BackgroundWorkder,Thread,ContactManager.BeginLookup方法无效。

交叉线程错误或仍然保持UI线程与ContactManager.BeginLookup方法一样。< o:p> ;< / o:p>

是有没有正确的方法加载Lync.Controls而不保留UI线程?< o:p>< / o:p>

谢谢

推荐答案

你必须做确保您的用户已登录

you must make sure that your user is signed in

之后使用ContactManager.Groups获取您的论坛并获取您的联系人

after that use the ContactManager.Groups to get your groups and get your contacts

而不是使用
ContactManager.BeginLookup
p>

Rather than using the ContactManager.BeginLookup something like this

var contacts = new List<Contact>();
var groups = ContactManager.Groups;
foreach (var group in groups)
{
  foreach (var contact in group)
  {
    var currentContact = contact;
    if (!contacts.Any(c => c.Uri == currentContact.Uri))
    {
       contacts.Add(contact);
    }
  }
}


这篇关于背景线程上的Microsoft.Lync.Controls?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆