📄 contactinfocardaction.cs
字号:
namespace Imps.Client.Core
{
using Imps.Client.Core.Login;
using System;
using System.Threading;
public sealed class ContactInfoCardAction : LoginAction
{
private const int ContactInfoTimeOut = 0x493e0;
private const string errorMessage = "获取联系人详细信息出现错误";
private bool result;
private AutoResetEvent waitContactInfo;
public ContactInfoCardAction(User user, ILoginListner listner) : base(user, listner)
{
}
public override void Cancel()
{
}
public override void Clear()
{
}
public override void Dispose()
{
}
public override bool Execute()
{
try
{
base.NotifyMessage("开始获取联系人详细信息");
AsyncBizOperation op = new AsyncBizOperation(base.User);
op.ImpsError += new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.op_ImpsError);
op.Successed += new EventHandler(this.op_Successed);
if (this.waitContactInfo == null)
{
this.waitContactInfo = new AutoResetEvent(false);
}
base.User.ContactList.AsyncGetContactsInfoBatchAll(op);
if (!this.waitContactInfo.WaitOne(this.TimeOut, false))
{
base.NotifyLoginFailed("获取联系人详细信息出现错误", ExceptionType.CommonException, null);
}
base.NotifyMessage("获取联系人详细信息结束");
}
catch (ThreadAbortException exception)
{
base.NotifyWarning("获取联系人详细信息出现错误", exception);
}
catch (Exception)
{
base.NotifyLoginFailed("获取联系人详细信息出现错误", ExceptionType.CommonException, null);
}
return this.result;
}
private void op_ImpsError(object sender, ImpsErrorEventArgs e)
{
base.NotifyLoginFailed("获取联系人详细信息出现错误", ExceptionType.CommonException, null);
this.result = false;
this.waitContactInfo.Set();
}
private void op_Successed(object sender, EventArgs e)
{
this.result = true;
this.waitContactInfo.Set();
}
public override void Retry(RetryResult result)
{
base.User.ContactList.RetryGetContactsInfo(result);
}
public override bool LocalCacheHit
{
get
{
return true;
}
}
public override Imps.Client.Core.LoginStage LoginStage
{
get
{
return Imps.Client.Core.LoginStage.GetContactsInfo;
}
}
public override int TimeOut
{
get
{
return 0x493e0;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -