📄 inviteform.cs
字号:
namespace Imps.Client.Pc
{
using Imps.Client;
using Imps.Client.Core;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Resource;
using Imps.Client.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class InviteForm : XIMDialog
{
private IFrameworkWindow _frameworkWnd;
private InviteControl _inviteControl;
private XButton btnCancel;
private XButton btnOk;
private IContainer components;
private ToolStripMenuItem menuDelete;
private ContextMenuStrip menuOperation;
private Panel plContent;
public InviteForm(IFrameworkWindow framework, string message) : this(framework, message, 0x1f, false, true, null, null)
{
}
public InviteForm(IFrameworkWindow framework, string message, int maxSelectedCount, bool onlyShowOnline) : this(framework, message, maxSelectedCount, onlyShowOnline, true, null, null)
{
}
public InviteForm(IFrameworkWindow framework, string message, int maxSelectedCount, bool onlyShowOnline, bool showGroup, List<Imps.Client.Core.Contact> selectedContacts, List<Imps.Client.Core.Contact> excludeContacts) : this(framework, message, maxSelectedCount, onlyShowOnline, showGroup, selectedContacts, excludeContacts, false)
{
}
public InviteForm(IFrameworkWindow framework, string message, int maxSelectedCount, bool onlyShowOnline, bool showGroup, List<Imps.Client.Core.Contact> selectedContacts, List<Imps.Client.Core.Contact> excludeContacts, bool showSMSOnline) : this(framework, message, maxSelectedCount, onlyShowOnline, showGroup, selectedContacts, excludeContacts, showSMSOnline, false, true, true)
{
}
public InviteForm(IFrameworkWindow framework, string message, int maxSelectedCount, bool onlyShowOnline, bool showGroup, List<Imps.Client.Core.Contact> selectedContacts, List<Imps.Client.Core.Contact> excludeContacts, bool showSMSOnline, bool showSelf, bool ShowJ2ME, bool showSymbianR1)
{
EventHandler<SplitterEventArgs> handler = null;
this.InitializeComponent();
this.btnOk.Enabled = false;
this._frameworkWnd = framework;
this._inviteControl = new InviteControl(framework, selectedContacts, excludeContacts);
this._inviteControl.Dock = DockStyle.Fill;
this._inviteControl.Message = message;
this._inviteControl.MaxSelectedCount = maxSelectedCount;
this._inviteControl.ShowJ2MER1 = ShowJ2ME;
this._inviteControl.ShowSymbianR1 = showSymbianR1;
this._inviteControl.OnlyShowOnline = onlyShowOnline;
this._inviteControl.ShowGroup = showGroup;
this._inviteControl.ShowSelf = showSelf;
this._inviteControl.ShowSMSOnline = showSMSOnline;
if (handler == null)
{
handler = new EventHandler<SplitterEventArgs>(this, (IntPtr) this.<.ctor>b__0);
}
this._inviteControl.SplitterMoved += handler;
this.plContent.set_Padding(new Padding(3));
this.plContent.Controls.Add(this._inviteControl);
this.initComponentRegion();
this.CurrentUser.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this.CurrentUser_StatusChanged);
this._inviteControl.SelectedContactsChanged += new EventHandler(this.inviteControl_SelectedContactsChanged);
}
private void btnOk_Click(object sender, EventArgs e)
{
if (this.SelectedContacts.get_Count() > this._inviteControl.MaxSelectedCount)
{
this._frameworkWnd.UnifiedMessageBox.ShowWarning(this, string.Format(StringTable.Conversation.MsgSelectContactsLimit, this._inviteControl.MaxSelectedCount));
}
else
{
base.DialogResult = DialogResult.OK;
}
}
private void CurrentUser_StatusChanged(object sender, UserSatusChangedEventArgs e)
{
try
{
if (e.NewStatus != UserAccountStatus.Logon)
{
base.Close();
}
}
catch
{
}
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void FormatButtonEnable()
{
try
{
this.btnOk.Enabled = this._inviteControl.SelectedContacts.get_Count() > 0;
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void InitializeComponent()
{
this.components = new Container();
ComponentResourceManager manager = new ComponentResourceManager(typeof(InviteForm));
this.btnOk = new XButton();
this.btnCancel = new XButton();
this.menuOperation = new ContextMenuStrip(this.components);
this.menuDelete = new ToolStripMenuItem();
this.plContent = new Panel();
this.menuOperation.SuspendLayout();
base.SuspendLayout();
this.btnOk.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
this.btnOk.AutoSizeToImage = false;
this.btnOk.BackColor = Color.Transparent;
this.btnOk.BackgroundImageDisable = null;
this.btnOk.BackgroundImageDown = null;
this.btnOk.BackgroundImageHover = null;
this.btnOk.ChangeSkin = true;
this.btnOk.Location = new System.Drawing.Point(0x8f, 0x1e1);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new Size(0x4b, 0x19);
this.btnOk.TabIndex = 3;
this.btnOk.Text = "确定";
this.btnOk.set_UseVisualStyleBackColor(false);
this.btnOk.Click += new EventHandler(this.btnOk_Click);
this.btnCancel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
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.DialogResult = DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(0xe0, 0x1e1);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new Size(0x4b, 0x19);
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "取消";
this.btnCancel.set_UseVisualStyleBackColor(false);
this.menuOperation.get_Items().AddRange(new ToolStripItem[] { this.menuDelete });
this.menuOperation.Name = "menuOperation";
this.menuOperation.Size = new Size(0x63, 0x1a);
this.menuDelete.set_Name("menuDelete");
this.menuDelete.set_Size(new Size(0x62, 0x16));
this.menuDelete.set_Text("删除");
this.plContent.BackColor = Color.Transparent;
this.plContent.Location = new System.Drawing.Point(5, -21);
this.plContent.Name = "plContent";
this.plContent.Size = new Size(0x138, 0x1f0);
this.plContent.TabIndex = 5;
base.set_AutoScaleDimensions(new SizeF(6f, 13f));
base.set_AutoScaleMode(1);
base.BaseHeight = 0x21f;
base.BaseWidth = 0x14e;
base.CancelButton = this.btnCancel;
base.ClientSize = new Size(0x148, 0x205);
base.Controls.Add(this.plContent);
base.Controls.Add(this.btnCancel);
base.Controls.Add(this.btnOk);
base.DisplayLocation = new System.Drawing.Point(0x12, -169);
base.Icon = (Icon) manager.GetObject("$this.Icon");
base.MinimizeBox = false;
this.set_MinimumSize(new Size(300, 450));
base.Name = "InviteForm";
base.set_Padding(new Padding(8));
base.StartPosition = FormStartPosition.CenterParent;
base.Text = "选择联系人";
this.menuOperation.ResumeLayout(false);
base.ResumeLayout(false);
}
private void inviteControl_SelectedContactsChanged(object sender, EventArgs e)
{
this.FormatButtonEnable();
}
private void Localize()
{
this.btnOk.Text = StringTable.Common.TitleConfirm;
this.btnCancel.Text = StringTable.Common.btnCancel;
}
protected override void OnActivated(EventArgs e)
{
if (this._inviteControl.SelectedContacts.get_Count() > 0)
{
this.btnOk.Focus();
}
else
{
this.btnCancel.Focus();
}
base.OnActivated(e);
}
protected override void OnClosed(EventArgs e)
{
this.CurrentUser.StatusChanged -= new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this.CurrentUser_StatusChanged);
base.OnClosed(e);
}
public Imps.Client.Core.User CurrentUser
{
get
{
return this._frameworkWnd.AccountManager.CurrentUser;
}
}
public Imps.Client.Core.Contact SelectedContact
{
get
{
return this._inviteControl.SelectedContact;
}
}
public List<Imps.Client.Core.Contact> SelectedContacts
{
get
{
return this._inviteControl.SelectedContacts;
}
}
public SelectContactsType SelectType
{
get
{
if (this._inviteControl != null)
{
return this._inviteControl.SelectType;
}
return SelectContactsType.None;
}
internal set
{
if (this._inviteControl != null)
{
this._inviteControl.SelectType = value;
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -