📄 singlebeiviteform.cs
字号:
namespace Imps.Client.Pc
{
using Imps.Client.Core;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Resource;
using Imps.Client.Utils;
using Imps.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class SingleBeIviteForm : IVRFormBase
{
private int _startTickets;
private XButton btnAccept;
private XButton btnCancel;
private IContainer components;
private XLabel label2;
private XLabel lblBeInviteUsers;
private XLabel lblChargeInfo;
private XLabel lblInviteInfo;
private XLabel lblSeparator;
private LinkLabel lnkInfoAddress;
private LinkLabel lnkInviteUser;
private IVRListBox lstContacts;
private Panel panel1;
private DisplayPortrait PicContact;
public SingleBeIviteForm(IFrameworkWindow frameworkWnd, Imps.Client.Pc.IVRManager manager, IVRDialog dialog) : base(frameworkWnd, manager, dialog)
{
this.InitializeComponent();
base.Controls.SetChildIndex(this.panel1, 0);
if (dialog.IVRList.get_Count() == 1)
{
this.panel1.Height = 0xbc;
}
this.initComponentRegion();
this.lblChargeInfo.Text = base.ChargeInfo;
this.lblBeInviteUsers.UseMnemonic = false;
this.lblInviteInfo.UseMnemonic = false;
this.lnkInviteUser.UseMnemonic = false;
}
private void btnAccept_Click(object sender, EventArgs e)
{
try
{
base.OwnerDialog.AcceptInvite();
this.FormatForm(string.Format("您已经接受了 {0} 的手机语聊邀请,请稍后接听来自 {1} 的电话。", base.GetContactDisplayName(base.OwnerDialog.InviteContactIVR.Contact.DisplayName), this.ServiceNo));
}
catch (Exception exception)
{
base.Close();
ClientLogger.WriteException(exception);
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
base.Close();
}
private void Contact_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
{
Imps.Client.Core.Contact owner = (sender as Imps.Client.Core.ContactInfo).Owner;
IVRListItem host = this.GetListItem(owner);
if (host != null)
{
if (e.ContainsProperty("Portrait"))
{
ControlHelper.FadeinImage(host, owner.PersonalInfo.Portrait);
}
host.Name = owner.DisplayName;
host.MoodePhrase = owner.Presence.MoodPhrase;
}
}
private void ContactList_ContactsChanged(object sender, ContactsChangedEventArgs e)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
List<ContactChangedEventArgs>.Enumerator enumerator = e.ContactChangedEventArgsCollection.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Imps.Client.Core.Contact contact = enumerator.get_Current().Contact;
IVRListItem listItem = this.GetListItem(contact);
if (listItem != null)
{
Imps.Client.Core.IVR ivr = listItem.Context as Imps.Client.Core.IVR;
if ((ivr != null) && ((ivr.Status == IVRParticipantStatus.Accept) || (ivr.Status == IVRParticipantStatus.Inviting)))
{
listItem.Image = contact.PersonalInfo.Portrait;
}
listItem.Name = contact.DisplayName;
listItem.MoodePhrase = contact.Presence.MoodPhrase;
}
}
}
finally
{
enumerator.Dispose();
}
});
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void FormatForm(string inviteInfo)
{
UiErrorHelper.HandEventSafely(base.FrameworkWindow, delegate {
this.btnAccept.Visible = false;
this.btnCancel.Text = "关闭";
this.lblInviteInfo.ForeColor = Color.DarkOrchid;
this.lblInviteInfo.Text = inviteInfo;
this.lnkInviteUser.Visible = false;
});
}
private void FormatMultiIVR()
{
this.lstContacts.IVRItemHeight = 60;
this.lstContacts.ShowOneLine = true;
for (int i = 0; i < base.OwnerDialog.IVRList.get_Count(); i++)
{
Imps.Client.Core.IVR ivr = base.OwnerDialog.IVRList.get_Item(i);
if (ivr != base.OwnerDialog.InviteContactIVR)
{
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 = false;
item.Context = ivr;
this.lstContacts.Items.Add(item);
ivr.Contact.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.Contact_PropertiesChanged);
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);
}
private IVRListItem GetListItem(Imps.Client.Core.Contact contact)
{
foreach (object obj2 in this.lstContacts.Items)
{
if ((obj2 is IVRListItem) && (((obj2 as IVRListItem).Context as Imps.Client.Core.IVR).Contact == contact))
{
return (obj2 as IVRListItem);
}
}
return null;
}
private void InitializeComponent()
{
ComponentResourceManager manager = new ComponentResourceManager(typeof(SingleBeIviteForm));
this.panel1 = new Panel();
this.label2 = new XLabel();
this.lblChargeInfo = new XLabel();
this.lblBeInviteUsers = new XLabel();
this.lblSeparator = new XLabel();
this.lstContacts = new IVRListBox();
this.PicContact = new DisplayPortrait();
this.lnkInviteUser = new LinkLabel();
this.lblInviteInfo = new XLabel();
this.lnkInfoAddress = new LinkLabel();
this.btnCancel = new XButton();
this.btnAccept = new XButton();
this.panel1.SuspendLayout();
base.SuspendLayout();
this.panel1.BackColor = Color.Transparent;
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.lblChargeInfo);
this.panel1.Controls.Add(this.lblBeInviteUsers);
this.panel1.Controls.Add(this.lblSeparator);
this.panel1.Controls.Add(this.lstContacts);
this.panel1.Controls.Add(this.PicContact);
this.panel1.Controls.Add(this.lnkInviteUser);
this.panel1.Controls.Add(this.lblInviteInfo);
this.panel1.Controls.Add(this.lnkInfoAddress);
this.panel1.Location = new System.Drawing.Point(4, 4);
this.panel1.Name = "panel1";
this.panel1.Size = new Size(0x204, 0x16e);
this.panel1.TabIndex = 0;
this.panel1.Paint += new PaintEventHandler(this.panel1_Paint);
this.label2.BorderColor = Color.Empty;
this.label2.BorderStyle = BorderStyle.Fixed3D;
this.label2.ButtonBorderStyle = ButtonBorderStyle.None;
this.label2.Location = new System.Drawing.Point(12, 0x160);
this.label2.Name = "label2";
this.label2.Size = new Size(470, 2);
this.label2.TabIndex = 0x1c;
this.lblChargeInfo.set_AutoSize(true);
this.lblChargeInfo.BorderColor = Color.Empty;
this.lblChargeInfo.ButtonBorderStyle = ButtonBorderStyle.None;
this.lblChargeInfo.ForeColor = Color.DarkOrchid;
this.lblChargeInfo.Location = new System.Drawing.Point(130, 0x57);
this.lblChargeInfo.Name = "lblChargeInfo";
this.lblChargeInfo.Size = new Size(0x79, 13);
this.lblChargeInfo.TabIndex = 0x1b;
this.lblChargeInfo.Text = "资费请咨询当地10086";
this.lblBeInviteUsers.set_AutoSize(true);
this.lblBeInviteUsers.BorderColor = Color.Empty;
this.lblBeInviteUsers.ButtonBorderStyle = ButtonBorderStyle.None;
this.lblBeInviteUsers.Font = new Font("Microsoft Sans Serif", 9f);
this.lblBeInviteUsers.ForeColor = SystemColors.Desktop;
this.lblBeInviteUsers.Location = new System.Drawing.Point(12, 0xac);
this.lblBeInviteUsers.Name = "lblBeInviteUsers";
this.lblBeInviteUsers.Size = new Size(0x4f, 15);
this.lblBeInviteUsers.TabIndex = 0x1a;
this.lblBeInviteUsers.Text = "其他被邀请人";
this.lblSeparator.BorderColor = Color.Empty;
this.lblSeparator.BorderStyle = BorderStyle.Fixed3D;
this.lblSeparator.ButtonBorderStyle = ButtonBorderStyle.None;
this.lblSeparator.Location = new System.Drawing.Point(0x4e, 0xb5);
this.lblSeparator.Name = "lblSeparator";
this.lblSeparator.Size = new Size(400, 2);
this.lblSeparator.TabIndex = 0x19;
this.lstContacts.BorderStyle = BorderStyle.None;
this.lstContacts.CancelDescription = "取消邀请";
this.lstContacts.CancelImage = (Image) manager.GetObject("lstContacts.CancelImage");
this.lstContacts.DisableColor = Color.FromArgb(0xa4, 170, 220);
this.lstContacts.DrawMode = DrawMode.OwnerDrawVariable;
this.lstContacts.set_FormattingEnabled(true);
this.lstContacts.IVRItemHeight = 80;
this.lstContacts.LnkFont = new Font("Microsoft Sans Serif", 9f, FontStyle.Underline, GraphicsUnit.Point, 0);
this.lstContacts.Location = new System.Drawing.Point(30, 0xc9);
this.lstContacts.MoodPhraseColor = Color.FromArgb(0xa4, 170, 220);
this.lstContacts.MoodPhraseFont = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
this.lstContacts.Name = "lstContacts";
this.lstContacts.SeperatorHeight = 1;
this.lstContacts.ShowOneLine = false;
this.lstContacts.Size = new Size(0x1bf, 0x89);
this.lstContacts.TabIndex = 0x18;
this.PicContact.BackColor = Color.White;
this.PicContact.BorderColor = Color.FromArgb(0xa4, 170, 220);
this.PicContact.Image = (Image) manager.GetObject("PicContact.Image");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -