📄 multiivrform.cs
字号:
this.btnStart.BackColor = Color.Transparent;
this.btnStart.BackgroundImageDisable = null;
this.btnStart.BackgroundImageDown = null;
this.btnStart.BackgroundImageHover = null;
this.btnStart.ChangeSkin = true;
this.btnStart.Location = new System.Drawing.Point(0x5c, 0x1c7);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new Size(170, 0x17);
this.btnStart.TabIndex = 7;
this.btnStart.Text = "开始通话 (60秒后将自动开始)";
this.btnStart.set_UseVisualStyleBackColor(false);
this.btnStart.Click += new EventHandler(this.btnStart_Click);
base.set_AutoScaleDimensions(new SizeF(6f, 13f));
base.set_AutoScaleMode(1);
base.BaseHeight = 0x227;
base.BaseWidth = 0x1da;
base.ClientSize = new Size(0x1da, 0x227);
base.Controls.Add(this.panel1);
base.Controls.Add(this.btnClose);
base.Controls.Add(this.btnCancel);
base.Controls.Add(this.btnStart);
base.DisplayLocation = new System.Drawing.Point(0x12, 0x26);
base.DisplaySize = new Size(0x1da, 0x227);
base.Icon = (Icon) manager.GetObject("$this.Icon");
base.Name = "MultiIVRForm";
base.set_Padding(new Padding(4));
base.Text = "手机语聊";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
base.ResumeLayout(false);
}
protected override void InitIVRDialog()
{
try
{
this.ShowMyInfo();
this.PicOwner.Image = base.CurrentUser.PersonalInfo.Portrait;
this.btnStart.Text = string.Format("开始通话({0}秒后将自动开始)", base.WaitTime);
this._startTickets = Environment.TickCount;
GlobalTimer.Register(new EventHandler(this.ShowInviteTime), this, 10);
base.OwnerDialog.IVRStatusChange += new EventHandler<IVREventArgs>(this, (IntPtr) this.OwnerDialog_IVRStatusChange);
base.CurrentUser.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.PersonalInfo_PropertiesChanged);
base.CurrentUser.Presence.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.Presence_PropertiesChanged);
base.CurrentUser.ContactList.ContactsChanged += new EventHandler<ContactsChangedEventArgs>(this, (IntPtr) this.ContactList_ContactsChanged);
this.lstContacts.CancelImage = Resources.error;
this.lstContacts.IVRItemHeight = 80;
for (int i = 0; i < base.OwnerDialog.IVRList.get_Count(); i++)
{
Imps.Client.Core.IVR ivr = base.OwnerDialog.IVRList.get_Item(i);
IVRListItem item = new IVRListItem(this.lstContacts);
item.Description = IMPSEnums.GetEnumDescription<IVRParticipantStatus>(ivr.Status);
item.Image = ivr.Contact.PersonalInfo.Portrait;
item.MoodePhrase = ivr.Contact.Presence.MoodPhrase;
item.Name = ivr.Contact.DisplayName;
item.ShowCancelButton = true;
item.Context = ivr;
this.lstContacts.Items.Add(item);
if (i < (base.OwnerDialog.IVRList.get_Count() - 1))
{
this.lstContacts.Items.Add(new IVRSeperatorItem());
}
}
this.lstContacts.IVRNameClick += new EventHandler<IVRListItemEventArgs>(this, (IntPtr) this.lstContacts_IVRNameClick);
this.lstContacts.IVRImageClick += new EventHandler<IVRListItemEventArgs>(this, (IntPtr) this.lstContacts_IVRImageClick);
this.lstContacts.IVRCancelClick += new EventHandler<IVRListItemEventArgs>(this, (IntPtr) this.lstContacts_IVRCancelClick);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void lstContacts_IVRCancelClick(object sender, IVRListItemEventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
(e.Item.Context as Imps.Client.Core.IVR).AsyncSendCancel();
});
}
private void lstContacts_IVRImageClick(object sender, IVRListItemEventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
Imps.Client.Core.IVR ivr = e.Item.Context as Imps.Client.Core.IVR;
this.FrameworkWindow.ContactManager.ShowContactDetail(this, ivr.Contact.Uri.Raw);
});
}
private void lstContacts_IVRNameClick(object sender, IVRListItemEventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
Imps.Client.Core.IVR ivr = e.Item.Context as Imps.Client.Core.IVR;
this.FrameworkWindow.ContactManager.ShowContactDetail(this, ivr.Contact.Uri.Raw);
});
}
protected override void OnFormClosed(FormClosedEventArgs e)
{
GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
base.CurrentUser.PersonalInfo.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.PersonalInfo_PropertiesChanged);
base.CurrentUser.Presence.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.Presence_PropertiesChanged);
base.CurrentUser.ContactList.ContactsChanged -= new EventHandler<ContactsChangedEventArgs>(this, (IntPtr) this.ContactList_ContactsChanged);
base.OwnerDialog.IVRStatusChange -= new EventHandler<IVREventArgs>(this, (IntPtr) this.OwnerDialog_IVRStatusChange);
base.OnFormClosed(e);
}
private void OwnerDialog_IVRStatusChange(object sender, IVREventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
foreach (object obj2 in this.lstContacts.Items)
{
if (obj2 is IVRListItem)
{
IVRListItem item = obj2 as IVRListItem;
if (e.IVR == (item.Context as Imps.Client.Core.IVR))
{
item.Description = IMPSEnums.GetEnumDescription<IVRParticipantStatus>(e.IVR.Status);
item.ShowCancelButton = false;
switch (e.IVR.Status)
{
case IVRParticipantStatus.Inviting:
{
continue;
}
case IVRParticipantStatus.Cancel:
case IVRParticipantStatus.Decline:
case IVRParticipantStatus.OverTime:
{
item.Image = ImageHelper.ConvertToGrayscale(item.Image);
item.Disable = true;
continue;
}
case IVRParticipantStatus.Accept:
{
item.DescriptColor = Color.DarkMagenta;
continue;
}
}
}
}
}
bool flag = false;
List<Imps.Client.Core.IVR>.Enumerator enumerator = this.OwnerDialog.IVRList.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
if (enumerator.get_Current().Status == IVRParticipantStatus.Inviting)
{
flag = true;
goto Label_012F;
}
}
}
finally
{
enumerator.Dispose();
}
Label_012F:
if (!flag)
{
if (!this.TryStartIVR())
{
GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
this.FormatForm("所有联系人都取消了手机语聊,请点击关闭结束此次手机语聊!");
}
if (!this.IsDisposed && !this.IsActived)
{
ControlHelper.FlashWindow(this);
}
}
});
}
private void PersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
if (e.ContainsProperty("Portrait"))
{
ControlHelper.FadeinImage(this.PicOwner, this.CurrentUser.PersonalInfo.Portrait);
}
this.ShowMyInfo();
});
}
private void PicOwner_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
base.FrameworkWindow.ShowOptions(this, "PsGeneral");
});
}
private void Presence_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
{
this.ShowMyInfo();
}
private void ShowInviteTime(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
int num = Convert.ToInt32(Math.Round((double) (((double) (Environment.TickCount - this._startTickets)) / 1000)));
this.btnStart.Text = string.Format("开始通话({0}秒后将自动开始)", base.WaitTime - num);
if ((base.WaitTime - num) <= 0)
{
GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
base.OwnerDialog.IsOvertime = true;
List<Imps.Client.Core.IVR>.Enumerator enumerator = base.OwnerDialog.IVRList.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Imps.Client.Core.IVR ivr = enumerator.get_Current();
if (ivr.Status == IVRParticipantStatus.Inviting)
{
ivr.Status = IVRParticipantStatus.OverTime;
}
}
}
finally
{
enumerator.Dispose();
}
if (!this.TryStartIVR())
{
this.FormatForm("您的邀请已超时,请关闭后重新邀请!");
}
}
});
}
private void ShowMyInfo()
{
string nickname = base.CurrentUser.Nickname;
if (base.CurrentUser.Presence.MoodPhrase != "")
{
nickname = nickname + "-" + ((string) base.CurrentUser.Presence.MoodPhrase);
}
this.lblCurrentUser.Text = nickname;
}
private bool TryStartIVR()
{
List<Imps.Client.Core.IVR>.Enumerator enumerator = base.OwnerDialog.IVRList.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
if (enumerator.get_Current().Status == IVRParticipantStatus.Accept)
{
if (!base.OwnerDialog.HasStart)
{
GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
base.OwnerDialog.StartIVR();
base.OwnerDialog.Close();
this.FormatForm(string.Format("请稍后接听来自{0} 的电话", base.CurrentUser.Configuration.SystemSetting.SvcNoSetting.SvcNoIVR.ToString() + base.CurrentUser.Sid.ToString()));
}
return true;
}
}
}
finally
{
enumerator.Dispose();
}
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -