📄 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 System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class InviteForm : XIMDialog
{
private IFrameworkWindow _frameworkWnd;
private XButton btnCancel;
private XButton btnOk;
private IContainer components;
private InviteControl inviteControl;
private ToolStripMenuItem menuDelete;
private ContextMenuStrip menuOperation;
private Panel panel2;
private Panel plContent;
private Panel pnlMain;
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) : base(FormBorderStyle.Sizable)
{
EventHandler<SplitterEventArgs> handler = null;
this.InitializeComponent();
this.initComponentRegion();
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 = delegate {
this.inviteControl.SetTreeFocus();
};
}
this.inviteControl.SplitterMoved += handler;
this.plContent.Padding = new Padding(3);
this.plContent.Controls.Add(this.inviteControl);
base.Icon = ImpsIcons.Logo;
this.CurrentUser.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this.CurrentUser_StatusChanged);
}
private void btnOk_Click(object sender, EventArgs e)
{
if (this.SelectedContacts.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 InitializeComponent()
{
this.components = new Container();
this.btnOk = new XButton();
this.btnCancel = new XButton();
this.menuOperation = new ContextMenuStrip(this.components);
this.menuDelete = new ToolStripMenuItem();
this.plContent = new Panel();
this.panel2 = new Panel();
this.pnlMain = new Panel();
this.menuOperation.SuspendLayout();
this.panel2.SuspendLayout();
this.pnlMain.SuspendLayout();
base.SuspendLayout();
base.menubar.Location = new Point(3, 30);
this.btnOk.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
this.btnOk.Location = new Point(0x77, 13);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new Size(0x4b, 0x19);
this.btnOk.TabIndex = 3;
this.btnOk.Text = "确认";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new EventHandler(this.btnOk_Click);
this.btnCancel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
this.btnCancel.DialogResult = DialogResult.Cancel;
this.btnCancel.Location = new Point(200, 13);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new Size(0x4b, 0x19);
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = true;
this.menuOperation.Items.AddRange(new ToolStripItem[] { this.menuDelete });
this.menuOperation.Name = "menuOperation";
this.menuOperation.Size = new Size(0x63, 0x1a);
this.menuDelete.Name = "menuDelete";
this.menuDelete.Size = new Size(0x62, 0x16);
this.menuDelete.Text = "删除";
this.plContent.BackColor = Color.Transparent;
this.plContent.Dock = DockStyle.Fill;
this.plContent.Location = new Point(0, 0);
this.plContent.Name = "plContent";
this.plContent.Size = new Size(0x116, 0x1c7);
this.plContent.TabIndex = 5;
this.panel2.BackColor = Color.Transparent;
this.panel2.Controls.Add(this.btnCancel);
this.panel2.Controls.Add(this.btnOk);
this.panel2.Dock = DockStyle.Bottom;
this.panel2.Location = new Point(0, 0x1c7);
this.panel2.Name = "panel2";
this.panel2.Size = new Size(0x116, 0x29);
this.panel2.TabIndex = 6;
this.pnlMain.BackColor = Color.Transparent;
this.pnlMain.Controls.Add(this.plContent);
this.pnlMain.Controls.Add(this.panel2);
this.pnlMain.Dock = DockStyle.Fill;
this.pnlMain.Location = new Point(8, 8);
this.pnlMain.Name = "pnlMain";
this.pnlMain.Size = new Size(0x116, 0x1f0);
this.pnlMain.TabIndex = 7;
base.AcceptButton = this.btnOk;
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.CancelButton = this.btnCancel;
base.ClientSize = new Size(0x126, 0x200);
base.Controls.Add(this.pnlMain);
base.MinimizeBox = false;
this.MinimumSize = new Size(300, 450);
base.Name = "InviteForm";
base.Padding = new Padding(8);
base.StartPosition = FormStartPosition.Manual;
base.Text = "选择联系人";
base.Controls.SetChildIndex(this.pnlMain, 0);
base.Controls.SetChildIndex(base.menubar, 0);
this.menuOperation.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.pnlMain.ResumeLayout(false);
base.ResumeLayout(false);
}
private void Localize()
{
this.btnOk.Text = StringTable.Common.TitleConfirm;
this.btnCancel.Text = StringTable.Common.btnCancel;
}
protected override void OnClosed(EventArgs e)
{
this.CurrentUser.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this.CurrentUser_StatusChanged);
}
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;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -