📄 multiivrform.cs
字号:
this.lstContacts.ShowOneLine = false;
this.lstContacts.Size = new Size(0x17b, 0xc3);
this.lstContacts.TabIndex = 5;
this.PicOwner.BackColor = Color.White;
this.PicOwner.BorderColor = Color.FromArgb(0xa4, 170, 220);
this.PicOwner.Image = (Image) manager.GetObject("PicOwner.Image");
this.PicOwner.Location = new Point(14, 13);
this.PicOwner.Name = "PicOwner";
this.PicOwner.Size = new Size(0x76, 0x76);
this.PicOwner.TabIndex = 0;
this.PicOwner.ToolTipText = "";
this.PicOwner.Click += new EventHandler(this.PicOwner_Click);
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.ClientSize = new Size(0x1bd, 0x1ec);
base.Controls.Add(this.panel1);
base.Icon = (Icon) manager.GetObject("$this.Icon");
this.MaximumSize = new Size(0x1c3, 0x206);
this.MinimumSize = new Size(0x1c3, 0x206);
base.Name = "MultiIVRForm";
base.Padding = new Padding(4);
base.Text = "手机语聊";
base.Controls.SetChildIndex(this.panel1, 0);
base.Controls.SetChildIndex(base.menubar, 0);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
base.ResumeLayout(false);
}
protected override void InitIVRDialog()
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
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.OwnerDialog_IVRStatusChange);
base.CurrentUser.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this.PersonalInfo_PropertiesChanged);
base.CurrentUser.Presence.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this.Presence_PropertiesChanged);
base.CurrentUser.ContactList.ContactsChanged += new EventHandler<ContactsChangedEventArgs>(this.ContactList_ContactsChanged);
this.lstContacts.CancelImage = ImpsResources.GetImage("Images.cancel.png");
this.lstContacts.IVRItemHeight = 80;
for (int j = 0; i < base.OwnerDialog.IVRList.Count; i++)
{
Imps.Client.Core.IVR ivr = base.OwnerDialog.IVRList[i];
IVRListItem item = new IVRListItem(this.lstContacts) {
Description = IMPSEnums.GetEnumDescription<IVRParticipantStatus>(ivr.Status),
Image = ivr.Contact.PersonalInfo.Portrait,
MoodePhrase = ivr.Contact.Presence.MoodPhrase,
Name = ivr.Contact.DisplayName,
ShowCancelButton = true,
Context = ivr
};
this.lstContacts.Items.Add(item);
if (i < (base.OwnerDialog.IVRList.Count - 1))
{
this.lstContacts.Items.Add(new IVRSeperatorItem());
}
}
this.lstContacts.IVRNameClick += new EventHandler<IVRListItemEventArgs>(this.lstContacts_IVRNameClick);
this.lstContacts.IVRImageClick += new EventHandler<IVRListItemEventArgs>(this.lstContacts_IVRImageClick);
this.lstContacts.IVRCancelClick += new EventHandler<IVRListItemEventArgs>(this.lstContacts_IVRCancelClick);
});
}
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 context = e.Item.Context as Imps.Client.Core.IVR;
this.FrameworkWindow.ContactManager.ShowContactDetail(this, context.Contact.Uri.Raw);
});
}
private void lstContacts_IVRNameClick(object sender, IVRListItemEventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
Imps.Client.Core.IVR context = e.Item.Context as Imps.Client.Core.IVR;
this.FrameworkWindow.ContactManager.ShowContactDetail(this, context.Contact.Uri.Raw);
});
}
protected override void OnFormClosed(FormClosedEventArgs e)
{
GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
base.CurrentUser.PersonalInfo.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this.PersonalInfo_PropertiesChanged);
base.CurrentUser.Presence.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this.Presence_PropertiesChanged);
base.CurrentUser.ContactList.ContactsChanged -= new EventHandler<ContactsChangedEventArgs>(this.ContactList_ContactsChanged);
base.OwnerDialog.IVRStatusChange -= new EventHandler<IVREventArgs>(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;
foreach (Imps.Client.Core.IVR ivr in this.OwnerDialog.IVRList)
{
if (ivr.Status == IVRParticipantStatus.Inviting)
{
flag = true;
break;
}
}
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.0)));
this.btnStart.Text = string.Format("开始通话({0}秒后将自动开始)", base.WaitTime - num);
if ((base.WaitTime - num) <= 0)
{
GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
base.OwnerDialog.IsOvertime = true;
foreach (Imps.Client.Core.IVR ivr in base.OwnerDialog.IVRList)
{
if (ivr.Status == IVRParticipantStatus.Inviting)
{
ivr.Status = IVRParticipantStatus.OverTime;
}
}
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 = StringHelper.EncodString(nickname);
}
private bool TryStartIVR()
{
foreach (Imps.Client.Core.IVR ivr in base.OwnerDialog.IVRList)
{
if (ivr.Status != IVRParticipantStatus.Accept)
{
continue;
}
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;
}
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -