📄 psgeneralcontrol.cs
字号:
namespace Imps.Client.Pc.Options
{
using Imps.Client.Core;
using Imps.Client.Pc;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Pc.Utils;
using Imps.Client.Resource;
using Imps.Client.Utils;
using Imps.Common;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
internal class PsGeneralControl : OptionsControlBase
{
private IFrameworkWindow _frameworkWnd;
private XComboBox comboBoxGender;
private IContainer components;
private GroupBox groupBoxMain;
private XLabel label1;
private menu_widget m_menu_edit;
private ToolStripMenuItem m_menuitem_cancel;
private ToolStripMenuItem m_menuitem_copy;
private ToolStripMenuItem m_menuitem_cut;
private ToolStripMenuItem m_menuitem_delete;
private ToolStripMenuItem m_menuitem_paste;
private ToolStripMenuItem m_menuitem_selectall;
private ToolStripSeparator m_menuitem_spt1;
private ToolStripSeparator m_menuitem_spt2;
private ChatEditCtrlManager m_textBoxNicknameMng;
private ChatEditCtrlManager m_txtMoodPharseMng;
private ChatRichTextBox textBoxNickname;
private XTextBox textBoxProfile;
private XTextBox textBoxSid;
private ChatRichTextBox txtMoodPharse;
private XButton xBtnProtrait;
private DisplayPortrait xpbProtrait;
private XTextBox xtbCity;
private XTextBox xtbProvince;
public PsGeneralControl(IFrameworkWindow frameworkWnd)
{
this._frameworkWnd = frameworkWnd;
this.InitializeComponent();
this.textBoxProfile.Visible = false;
try
{
this.init_menu();
this.m_txtMoodPharseMng = new ChatEditCtrlManager(this.txtMoodPharse, false);
this.txtMoodPharse.MouseDown += new MouseEventHandler(this.on_richedit_mousedown);
this.m_txtMoodPharseMng.DefaultTextFont = SystemFonts.DefaultFont;
this.m_txtMoodPharseMng.ConvertString = new DelegateConvert(StringHelper.EncodString);
if (EnvHelper.DynamicGifCtlRegistered)
{
this.m_txtMoodPharseMng.ConvertSympol = true;
}
this.m_txtMoodPharseMng.SympolSize = new Size(14, 14);
this.m_textBoxNicknameMng = new ChatEditCtrlManager(this.textBoxNickname, false);
this.textBoxNickname.MouseDown += new MouseEventHandler(this.on_richedit_mousedown);
this.m_textBoxNicknameMng.DefaultTextFont = SystemFonts.DefaultFont;
this.m_textBoxNicknameMng.ConvertString = new DelegateConvert(StringHelper.EncodString);
if (EnvHelper.DynamicGifCtlRegistered)
{
this.m_textBoxNicknameMng.ConvertSympol = true;
}
this.m_textBoxNicknameMng.SympolSize = new Size(14, 14);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
this.SetLimitation();
this.handleUiEvent();
}
private void ActiveUser_PersonalInfoChanged(object sender, PropertiesChangedEventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWnd, delegate {
if (e.ContainsProperty("Portrait"))
{
ControlHelper.FadeinImage(this.xpbProtrait, this.ActiveUser.PersonalInfo.Portrait);
}
});
}
public override bool CheckUserInput()
{
string str = this.m_textBoxNicknameMng.Text.Trim();
if (str.Length <= 0)
{
BalloonHelper.ShowInputErrorBallon(this.textBoxNickname, StringTable.PersonalInfo.MsgNicknameNotEmpty, StringTable.Options.TitleInvalidInput);
return false;
}
int num = 0x40;
if (str.Length > num)
{
BalloonHelper.ShowInputErrorBallon(this.textBoxNickname, string.Format(StringTable.PersonalInfo.MsgNicknameTooLong, num), StringTable.Options.TitleInvalidInput);
return false;
}
if (str == StringTable.PersonalInfo.NicknameGuest)
{
BalloonHelper.ShowInputErrorBallon(this.textBoxNickname, string.Format(StringTable.PersonalInfo.MsgNicknameReserved, StringTable.PersonalInfo.NicknameGuest), StringTable.Options.TitleInvalidInput);
return false;
}
string str2 = this.m_txtMoodPharseMng.Text.Trim();
num = 0x100;
if (str2.Length > num)
{
BalloonHelper.ShowInputErrorBallon(this.txtMoodPharse, string.Format(StringTable.Presence.MsgMoodPhraseTooLong, num), StringTable.Options.TitleInvalidInput);
return false;
}
num = 0x100;
if (this.textBoxProfile.Text.Length > num)
{
BalloonHelper.ShowInputErrorBallon(this.textBoxProfile, string.Format(StringTable.PersonalInfo.MsgTooLongProfile, num), StringTable.Options.TitleInvalidInput);
return false;
}
return true;
}
public override bool ControlLoad()
{
this.ActiveUser.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this.ActiveUser_PersonalInfoChanged);
return base.ControlLoad();
}
public override bool ControlUnload()
{
this.ActiveUser.PersonalInfo.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this.ActiveUser_PersonalInfoChanged);
return base.ControlUnload();
}
private void handleUiEvent()
{
this.textBoxNickname.TextChanged += new EventHandler(this.uiData_Changed);
this.comboBoxGender.SelectedValueChanged += new EventHandler(this.uiData_Changed);
this.textBoxProfile.TextChanged += new EventHandler(this.uiData_Changed);
this.txtMoodPharse.TextChanged += new EventHandler(this.uiData_Changed);
}
private void init_menu()
{
this.m_menuitem_spt1.Enabled = false;
this.m_menuitem_spt2.Enabled = false;
}
private void InitializeComponent()
{
this.components = new Container();
ComponentResourceManager manager = new ComponentResourceManager(typeof(PsGeneralControl));
this.textBoxSid = new XTextBox();
this.textBoxNickname = new ChatRichTextBox();
this.m_menu_edit = new menu_widget(this.components);
this.m_menuitem_cancel = new ToolStripMenuItem();
this.m_menuitem_spt1 = new ToolStripSeparator();
this.m_menuitem_cut = new ToolStripMenuItem();
this.m_menuitem_copy = new ToolStripMenuItem();
this.m_menuitem_paste = new ToolStripMenuItem();
this.m_menuitem_delete = new ToolStripMenuItem();
this.m_menuitem_spt2 = new ToolStripSeparator();
this.m_menuitem_selectall = new ToolStripMenuItem();
this.xtbProvince = new XTextBox();
this.xtbCity = new XTextBox();
this.textBoxProfile = new XTextBox();
this.comboBoxGender = new XComboBox();
this.groupBoxMain = new GroupBox();
this.xpbProtrait = new DisplayPortrait();
this.txtMoodPharse = new ChatRichTextBox();
this.xBtnProtrait = new XButton();
this.label1 = new XLabel();
XLabel label = new XLabel();
XLabel label2 = new XLabel();
XLabel label3 = new XLabel();
XLabel label4 = new XLabel();
XLabel label5 = new XLabel();
XLabel label6 = new XLabel();
this.m_menu_edit.SuspendLayout();
this.groupBoxMain.SuspendLayout();
base.SuspendLayout();
label.Anchor = AnchorStyles.Right | AnchorStyles.Top;
label.AutoSize = true;
label.BorderColor = Color.Empty;
label.ButtonBorderStyle = ButtonBorderStyle.None;
label.Location = new Point(9, 0x85);
label.Name = "label8";
label.Size = new Size(0x35, 12);
label.TabIndex = 7;
label.Text = "城 市";
label2.AutoSize = true;
label2.BorderColor = Color.Empty;
label2.ButtonBorderStyle = ButtonBorderStyle.None;
label2.Location = new Point(10, 80);
label2.Name = "label6";
label2.Size = new Size(0x35, 12);
label2.TabIndex = 3;
label2.Text = "性 别";
label3.AutoSize = true;
label3.BorderColor = Color.Empty;
label3.ButtonBorderStyle = ButtonBorderStyle.None;
label3.Location = new Point(10, 0x6a);
label3.Name = "label7";
label3.Size = new Size(0x35, 12);
label3.TabIndex = 5;
label3.Text = "省 份";
label4.AutoSize = true;
label4.BorderColor = Color.Empty;
label4.ButtonBorderStyle = ButtonBorderStyle.None;
label4.Location = new Point(0x10, 40);
label4.Name = "label3";
label4.Size = new Size(0x35, 12);
label4.TabIndex = 1;
label4.Text = "Fetion号";
label5.AutoSize = true;
label5.BorderColor = Color.Empty;
label5.ButtonBorderStyle = ButtonBorderStyle.None;
label5.Location = new Point(0x10, 0x42);
label5.Name = "label4";
label5.Size = new Size(0x35, 12);
label5.TabIndex = 2;
label5.Text = "昵 称";
label6.AutoSize = true;
label6.BorderColor = Color.Empty;
label6.ButtonBorderStyle = ButtonBorderStyle.None;
label6.Location = new Point(8, 0x9f);
label6.Name = "label2";
label6.Size = new Size(0x3b, 12);
label6.TabIndex = 9;
label6.Text = "心情短语 ";
this.textBoxSid.BackColor = Color.FromArgb(240, 240, 240);
this.textBoxSid.BorderStyle = BorderStyle.FixedSingle;
this.textBoxSid.Location = new Point(0x4c, 0x19);
this.textBoxSid.Name = "textBoxSid";
this.textBoxSid.ReadOnly = true;
this.textBoxSid.Size = new Size(0x8a, 0x15);
this.textBoxSid.TabIndex = 1;
this.textBoxNickname.BackColor = Color.White;
this.textBoxNickname.BorderColor = Color.Empty;
this.textBoxNickname.BorderStyle = BorderStyle.FixedSingle;
this.textBoxNickname.ContextMenuStrip = this.m_menu_edit;
this.textBoxNickname.Location = new Point(0x4c, 0x33);
this.textBoxNickname.MaxLength = 0x40;
this.textBoxNickname.Multiline = false;
this.textBoxNickname.Name = "textBoxNickname";
this.textBoxNickname.Size = new Size(0x8a, 0x15);
this.textBoxNickname.TabIndex = 2;
this.textBoxNickname.Text = "";
this.textBoxNickname.BorderColor = Color.Silver;
this.m_menu_edit.Items.AddRange(new ToolStripItem[] { this.m_menuitem_cancel, this.m_menuitem_spt1, this.m_menuitem_cut, this.m_menuitem_copy, this.m_menuitem_paste, this.m_menuitem_delete, this.m_menuitem_spt2, this.m_menuitem_selectall });
this.m_menu_edit.Name = "m_menu_edit";
this.m_menu_edit.ShowImageMargin = false;
this.m_menu_edit.Size = new Size(0x80, 170);
this.m_menu_edit.Opening += new CancelEventHandler(this.on_menu_edit_opening);
this.m_menuitem_cancel.Name = "m_menuitem_cancel";
this.m_menuitem_cancel.Size = new Size(0x7f, 0x16);
this.m_menuitem_cancel.Text = "撤消(&U)";
this.m_menuitem_cancel.Click += new EventHandler(this.on_edit_cancel);
this.m_menuitem_spt1.Name = "m_menuitem_spt1";
this.m_menuitem_spt1.Size = new Size(0x7c, 6);
this.m_menuitem_cut.Name = "m_menuitem_cut";
this.m_menuitem_cut.Size = new Size(0x7f, 0x16);
this.m_menuitem_cut.Text = "剪切(&T)";
this.m_menuitem_cut.Click += new EventHandler(this.on_edit_cut);
this.m_menuitem_copy.Name = "m_menuitem_copy";
this.m_menuitem_copy.Size = new Size(0x7f, 0x16);
this.m_menuitem_copy.Text = "复制(&C)";
this.m_menuitem_copy.Click += new EventHandler(this.on_edit_copy);
this.m_menuitem_paste.Name = "m_menuitem_paste";
this.m_menuitem_paste.Size = new Size(0x7f, 0x16);
this.m_menuitem_paste.Text = "粘贴(&P)";
this.m_menuitem_paste.Click += new EventHandler(this.on_edit_paste);
this.m_menuitem_delete.Name = "m_menuitem_delete";
this.m_menuitem_delete.Size = new Size(0x7f, 0x16);
this.m_menuitem_delete.Text = "删除(&D)";
this.m_menuitem_delete.Click += new EventHandler(this.on_edit_delete);
this.m_menuitem_spt2.Name = "m_menuitem_spt2";
this.m_menuitem_spt2.Size = new Size(0x7c, 6);
this.m_menuitem_selectall.Name = "m_menuitem_selectall";
this.m_menuitem_selectall.Size = new Size(0x7f, 0x16);
this.m_menuitem_selectall.Text = "全选(&A)";
this.m_menuitem_selectall.Click += new EventHandler(this.on_edit_selectall);
this.xtbProvince.BackColor = Color.FromArgb(240, 240, 240);
this.xtbProvince.BorderStyle = BorderStyle.FixedSingle;
this.xtbProvince.Location = new Point(0x4c, 0x68);
this.xtbProvince.Name = "xtbProvince";
this.xtbProvince.ReadOnly = true;
this.xtbProvince.Size = new Size(0x8a, 0x15);
this.xtbProvince.TabIndex = 6;
this.xtbCity.Anchor = AnchorStyles.Right | AnchorStyles.Top;
this.xtbCity.BackColor = Color.FromArgb(240, 240, 240);
this.xtbCity.BorderStyle = BorderStyle.FixedSingle;
this.xtbCity.Location = new Point(0x4c, 130);
this.xtbCity.Name = "xtbCity";
this.xtbCity.ReadOnly = true;
this.xtbCity.Size = new Size(0x8a, 0x15);
this.xtbCity.TabIndex = 8;
this.textBoxProfile.AcceptsReturn = true;
this.textBoxProfile.AcceptsTab = true;
this.textBoxProfile.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
this.textBoxProfile.BackColor = Color.White;
this.textBoxProfile.BorderStyle = BorderStyle.FixedSingle;
this.textBoxProfile.Location = new Point(0x4c, 0x103);
this.textBoxProfile.MaxLength = 0x100;
this.textBoxProfile.Multiline = true;
this.textBoxProfile.Name = "textBoxProfile";
this.textBoxProfile.ScrollBars = ScrollBars.Both;
this.textBoxProfile.Size = new Size(0x106, 0x2c);
this.textBoxProfile.TabIndex = 11;
this.textBoxProfile.Visible = false;
this.comboBoxGender.BackColor = Color.White;
this.comboBoxGender.DropDownStyle = ComboBoxStyle.DropDownList;
this.comboBoxGender.FormattingEnabled = true;
this.comboBoxGender.Items.AddRange(new object[] { "男", "女" });
this.comboBoxGender.Location = new Point(0x4c, 0x4d);
this.comboBoxGender.MaxDropDownItems = 2;
this.comboBoxGender.MaxLength = 1;
this.comboBoxGender.Name = "comboBoxGender";
this.comboBoxGender.Size = new Size(0x8a, 20);
this.comboBoxGender.TabIndex = 4;
this.groupBoxMain.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
this.groupBoxMain.Controls.Add(this.xpbProtrait);
this.groupBoxMain.Controls.Add(this.txtMoodPharse);
this.groupBoxMain.Controls.Add(label6);
this.groupBoxMain.Controls.Add(this.xBtnProtrait);
this.groupBoxMain.Controls.Add(label);
this.groupBoxMain.Controls.Add(label2);
this.groupBoxMain.Controls.Add(label3);
this.groupBoxMain.Controls.Add(this.textBoxNickname);
this.groupBoxMain.Controls.Add(this.textBoxProfile);
this.groupBoxMain.Controls.Add(this.textBoxSid);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -