📄 singleivrform.cs
字号:
this.btnClose.Anchor = AnchorStyles.Top;
this.btnClose.AutoArrangementX = true;
this.btnClose.AutoSizeToImage = false;
this.btnClose.BackColor = Color.Transparent;
this.btnClose.BackgroundImageDisable = null;
this.btnClose.BackgroundImageDown = null;
this.btnClose.BackgroundImageHover = null;
this.btnClose.ChangeSkin = true;
this.btnClose.Location = new System.Drawing.Point(0x146, 0x146);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new Size(0x67, 0x17);
this.btnClose.TabIndex = 10;
this.btnClose.Text = "关闭";
this.btnClose.set_UseVisualStyleBackColor(false);
this.btnClose.Visible = false;
this.btnClose.Click += new EventHandler(this.btnClose_Click);
this.btnCancel.Anchor = AnchorStyles.Top;
this.btnCancel.AutoArrangementX = true;
this.btnCancel.AutoSizeToImage = false;
this.btnCancel.BackColor = Color.Transparent;
this.btnCancel.BackgroundImageDisable = null;
this.btnCancel.BackgroundImageDown = null;
this.btnCancel.BackgroundImageHover = null;
this.btnCancel.ChangeSkin = true;
this.btnCancel.Location = new System.Drawing.Point(0x90, 0x163);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new Size(0x11d, 0x17);
this.btnCancel.TabIndex = 9;
this.btnCancel.Text = "点击这里可以取消通话(120秒后自动取消)";
this.btnCancel.set_UseVisualStyleBackColor(false);
this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
base.set_AutoScaleDimensions(new SizeF(6f, 13f));
base.set_AutoScaleMode(1);
base.BaseHeight = 510;
base.BaseWidth = 0x1db;
base.ClientSize = new Size(0x1db, 510);
base.Controls.Add(this.panel1);
base.Controls.Add(this.btnClose);
base.Controls.Add(this.btnCancel);
base.DisplayLocation = new System.Drawing.Point(0x12, 0x2c);
base.DisplaySize = new Size(0x1db, 510);
base.Icon = (Icon) manager.GetObject("$this.Icon");
base.Name = "SingleIVRForm";
base.set_Padding(new Padding(5, 0x21, 0x13, 8));
base.Text = "手机语聊";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.picWait.EndInit();
base.ResumeLayout(false);
}
protected override void InitIVRDialog()
{
try
{
this.ShowMyInfo();
Imps.Client.Core.Contact contact = base.OwnerDialog.IVRList.get_Item(0).Contact;
this.ShowContactInfo(contact);
base.OwnerDialog.IVRStatusChange += new EventHandler<IVREventArgs>(this, (IntPtr) this.OwnerDialog_IVRStatusChange);
this.picWait.Image = ImpsResources.GetImage("Images.loading1.gif");
this._startTickets = Environment.TickCount;
this.btnCancel.Text = string.Format("点击这里可以取消通话({0}秒后自动取消)", base.WaitTime);
GlobalTimer.Register(new EventHandler(this.ShowInviteTime), this, 5);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
protected override void OnFormClosed(FormClosedEventArgs e)
{
GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
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);
Imps.Client.Core.Contact contact = base.OwnerDialog.IVRList.get_Item(0).Contact;
contact.PersonalInfo.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.Contact_PropertiesChanged);
contact.Presence.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.Contact_Presence_PropertiesChanged);
base.OnFormClosed(e);
}
private void OwnerDialog_IVRStatusChange(object sender, IVREventArgs e)
{
if (GlobalTimer.IsHandlerRegistered(new EventHandler(this.ShowInviteTime)))
{
GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
}
if (!base.OwnerDialog.IsClosed)
{
string status = IMPSEnums.GetEnumDescription<IVRParticipantStatus>(e.IVR.Status);
string inviteInfo = "";
switch (e.IVR.Status)
{
case IVRParticipantStatus.Cancel:
case IVRParticipantStatus.Decline:
inviteInfo = string.Format("{0}拒绝了您的语音邀请!", e.IVR.Contact.DisplayName);
base.OwnerDialog.IsCanceled = true;
this.picWait.Image = ThemeManager.GetImage("IVR_Refuse.png");
break;
case IVRParticipantStatus.Accept:
inviteInfo = string.Format("{0}已经接受邀请,请稍后接听来自{1} 的电话。", e.IVR.Contact.DisplayName, base.CurrentUser.Configuration.SystemSetting.SvcNoSetting.SvcNoIVR.ToString() + base.CurrentUser.Sid);
base.OwnerDialog.StartIVR();
base.OwnerDialog.IsAccepted = true;
this.picWait.Image = ThemeManager.GetImage("IVR_OnThePhone.gif");
break;
case IVRParticipantStatus.OverTime:
base.OwnerDialog.IsOvertime = true;
inviteInfo = "您的邀请已超时,请关闭后重新邀请!";
break;
}
this.FormatForm(status, inviteInfo);
}
}
private void PersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs ev)
{
if (ev.ContainsProperty("Portrait"))
{
ControlHelper.FadeinImage(this.PicOwner, base.CurrentUser.PersonalInfo.Portrait);
}
this.ShowMyNameInfo();
}
private void picContact_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
this.FrameworkWindow.ContactManager.ShowContactDetail(this, (sender as DisplayPortrait).Tag as string);
});
}
private void PicCurrentUser_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
base.FrameworkWindow.ShowOptions(this, "PsGeneral");
});
}
private void Presence_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
{
this.ShowMyNameInfo();
}
private void ShowContactInfo(Imps.Client.Core.Contact contact)
{
this.picContact.Image = contact.PersonalInfo.Portrait;
this.picContact.Tag = contact.Uri.Raw;
this.ShowContactNameInfo(contact);
contact.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.Contact_PropertiesChanged);
contact.Presence.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.Contact_Presence_PropertiesChanged);
}
private void ShowContactNameInfo(Imps.Client.Core.Contact contact)
{
string displayName = contact.DisplayName;
if ((contact.Presence.MoodPhrase != null) && (contact.Presence.MoodPhrase != ""))
{
displayName = displayName + "-" + contact.Presence.MoodPhrase;
}
this.lblContact.Text = displayName;
}
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.btnCancel.Text = string.Format("点击这里可以取消通话({0}秒后自动取消)", base.WaitTime - num);
if ((base.WaitTime - num) <= 0)
{
GlobalTimer.Unregister(new EventHandler(this.ShowInviteTime));
base.OwnerDialog.IVRList.get_Item(0).Status = IVRParticipantStatus.OverTime;
base.OwnerDialog.IsOvertime = true;
}
});
}
private void ShowMyInfo()
{
this.PicOwner.Image = base.CurrentUser.PersonalInfo.Portrait;
this.ShowMyNameInfo();
base.CurrentUser.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.PersonalInfo_PropertiesChanged);
base.CurrentUser.Presence.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.Presence_PropertiesChanged);
}
private void ShowMyNameInfo()
{
string nickname = base.CurrentUser.Nickname;
if ((base.CurrentUser.Presence.MoodPhrase != null) && (base.CurrentUser.Presence.MoodPhrase != ""))
{
nickname = nickname + "-" + ((string) base.CurrentUser.Presence.MoodPhrase);
}
this.lblCurrentUser.Text = nickname;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -