本文整理汇总了C#中Messenger.GetContact方法的典型用法代码示例。如果您正苦于以下问题:C# Messenger.GetContact方法的具体用法?C# Messenger.GetContact怎么用?C# Messenger.GetContact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messenger
的用法示例。
在下文中一共展示了Messenger.GetContact方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
Directory.CreateDirectory(LogDir);
var messenger = new Messenger();
foreach (var contact in EmailAddresses
.Select(emailAddress => messenger.GetContact(emailAddress, messenger.MyServiceId)))
{
Contacts.Add(contact);
Log(contact);
// Don't release the COM object of contact here
// or OnContactStatusChange will not be raised.
}
messenger.OnContactStatusChange += (contact, _) => Log((IMessengerContactAdvanced)contact);
Console.ReadLine();
foreach (var contact in Contacts)
{
Marshal.FinalReleaseComObject(contact);
}
Marshal.FinalReleaseComObject(messenger);
}
示例2: CommunicatorIntegration
public CommunicatorIntegration()
{
try
{
m_Messenger = new Messenger();
}
catch (Exception)
{
throw new CommunicatorNotOpenException();
}
m_ServiceID = m_Messenger.MyServiceId;
try
{
m_Messenger.GetContact("[email protected]", m_ServiceID);
}
catch (Exception)
{
throw new CommunicatorNotLoggedInToRedgateException();
}
m_SubscribedContacts = new Dictionary<string, IMessengerContact>();
m_Messenger.OnContactStatusChange += communicator_OnContactStatusChange;
}