📄 compactprofile.cs
字号:
namespace Imps.Client.Pc.Provsion2
{
using Imps.Client;
using Imps.Client.Core;
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;
public class CompactProfile : ProvsionControlBase
{
private EventHandler<ProfileRetrivedEventArgs> _profileRetrivedHandler;
private EventHandler<HttpAppEventArgs> _profileUpdateHanlder;
private EventHandler<SsiLoginEventArgs> _ssiLoginHandler;
private EventHandler<SysCfgEventArgs> _sysCfgAvaildHanlder;
private XButton btnDetailProfile;
private IContainer components;
private XLabel lbCongrantulations;
private XLabel lbLoading;
private XLabel lblSeperate;
private XLabel lbNickName;
private XLabel lbProfile;
private XLabel lbSex;
private PictureBox pbLoading;
private Panel pnlGender;
private RadioButton rbBoy;
private RadioButton rbGirl;
private XTextBox txtNickName;
public CompactProfile(ProvisionWizard host) : base(host)
{
this.InitializeComponent();
this.LoadResource();
this.AttachEventHandler();
base.Disposed += new EventHandler(this.CompactProfile_Disposed);
this.Init();
}
private void AttachEventHandler()
{
this._profileRetrivedHandler = new EventHandler<ProfileRetrivedEventArgs>(this.Provisioning_OnProfileRetrived);
Imps.Client.Core.Provisioning.OnProfileRetrived += this._profileRetrivedHandler;
this._ssiLoginHandler = new EventHandler<SsiLoginEventArgs>(this.Provisioning_OnSsiLogin);
Imps.Client.Core.Provisioning.OnSsiLogin += this._ssiLoginHandler;
this._profileUpdateHanlder = new EventHandler<HttpAppEventArgs>(this.Provisioning_OnPorfileUpdated);
Imps.Client.Core.Provisioning.OnPorfileUpdated += this._profileUpdateHanlder;
this._sysCfgAvaildHanlder = new EventHandler<SysCfgEventArgs>(this.Provisioning_OnNewSysCfgRecived);
Imps.Client.Core.Provisioning.OnSysCfgRecived += this._sysCfgAvaildHanlder;
}
private void btnDetailProfile_Click(object sender, EventArgs e)
{
if (this.GetValidData())
{
new InitProfile(base._host.ProvsionData).ShowDialog(base._host);
this.ShowInfo();
}
}
private bool CheckData()
{
this.txtNickName.Text = this.txtNickName.Text.Trim();
if (string.IsNullOrEmpty(this.txtNickName.Text))
{
BalloonHelper.ShowBallon(this.txtNickName, "请设置您的昵称!", "错误!", 0x3e8);
return false;
}
if (!ContentFilter.Instance.IsValidNickName(this.txtNickName.Text))
{
BalloonHelper.ShowBallon(this.txtNickName, string.Format("昵称不能为{0}!", this.txtNickName.Text), "错误!", 0x3e8);
return false;
}
return true;
}
private void CompactProfile_Disposed(object sender, EventArgs e)
{
this.DetachEventHandler();
}
public override void DetachEventHandler()
{
if (this._profileRetrivedHandler != null)
{
Imps.Client.Core.Provisioning.OnProfileRetrived -= this._profileRetrivedHandler;
}
if (this._profileUpdateHanlder != null)
{
Imps.Client.Core.Provisioning.OnPorfileUpdated -= this._profileUpdateHanlder;
}
if (this._ssiLoginHandler != null)
{
Imps.Client.Core.Provisioning.OnSsiLogin -= this._ssiLoginHandler;
}
if (this._sysCfgAvaildHanlder != null)
{
Imps.Client.Core.Provisioning.OnSysCfgRecived -= this._sysCfgAvaildHanlder;
}
}
protected override void DisableAllControls()
{
this.txtNickName.Enabled = false;
this.pnlGender.Enabled = false;
this.btnDetailProfile.Enabled = false;
base._host.DisableAllButtons();
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
public override bool GetValidData()
{
if (!this.CheckData())
{
return false;
}
if (this.rbGirl.Checked)
{
base._host.ProvsionData.ProvsionUserInfo.Gender.ProposedValue = Gender.Female;
}
if (this.rbBoy.Checked)
{
base._host.ProvsionData.ProvsionUserInfo.Gender.ProposedValue = Gender.Male;
}
base._host.ProvsionData.ProvsionUserInfo.NickName.ProposedValue = this.txtNickName.Text;
return true;
}
private void Init()
{
base._tipMessage = string.Empty;
this.lbCongrantulations.Text = string.Format(this.lbCongrantulations.Text, AppDictionary.ShortEnglishName, AppDictionary.ShortEnglishName, base._host.ProvsionData.ProvsionUserInfo.Sid);
this.txtNickName.Text = (string) base._host.ProvsionData.ProvsionUserInfo.NickName;
this.rbBoy.Checked = base._host.ProvsionData.ProvsionUserInfo.Gender == 1;
this.rbGirl.Checked = base._host.ProvsionData.ProvsionUserInfo.Gender == 2;
base._cancelMessage = "您尚未完成个人资料填写,确实要跳过此步骤吗?";
if (!base._host.ProvsionData.IsFreshUser)
{
this.pbLoading.Image = ImpsResources.GetImage("Images.loading.gif");
this.lbLoading.Visible = true;
base._host.LoadSysCfg();
this.DisableAllControls();
}
else
{
this.lbLoading.Visible = false;
base._host.ProvsionData.Flag.IsOldProfileRetrived = true;
}
base._host.frmWnd.AccountManager.FillUserIdAndPassword(base._host.ProvsionData.MobileNo, base._host.ProvsionData.Password, false);
ControlHelper.ForceControlImeHangul(this.txtNickName);
}
private void InitializeComponent()
{
this.lblSeperate = new XLabel();
this.lbProfile = new XLabel();
this.lbCongrantulations = new XLabel();
this.lbNickName = new XLabel();
this.lbSex = new XLabel();
this.txtNickName = new XTextBox();
this.rbBoy = new RadioButton();
this.rbGirl = new RadioButton();
this.btnDetailProfile = new XButton();
this.pnlGender = new Panel();
this.pbLoading = new PictureBox();
this.lbLoading = new XLabel();
this.pnlGender.SuspendLayout();
((ISupportInitialize) this.pbLoading).BeginInit();
base.SuspendLayout();
this.lblSeperate.AutoEllipsis = false;
this.lblSeperate.BorderColor = Color.Black;
this.lblSeperate.BorderStyle = BorderStyle.Fixed3D;
this.lblSeperate.ButtonBorderStyle = ButtonBorderStyle.Solid;
this.lblSeperate.Location = new Point(0x44, 0x6f);
this.lblSeperate.Name = "lblSeperate";
this.lblSeperate.Size = new Size(300, 2);
this.lblSeperate.TabIndex = 2;
this.lblSeperate.TextAlign = ContentAlignment.TopLeft;
this.lblSeperate.UseMnemonic = false;
this.lbProfile.AutoEllipsis = false;
this.lbProfile.AutoSize = true;
this.lbProfile.BorderColor = Color.Black;
this.lbProfile.BorderStyle = BorderStyle.None;
this.lbProfile.ButtonBorderStyle = ButtonBorderStyle.Solid;
this.lbProfile.Location = new Point(4, 0x69);
this.lbProfile.Name = "lbProfile";
this.lbProfile.Size = new Size(0x39, 13);
this.lbProfile.TabIndex = 1;
this.lbProfile.Text = "个人身份";
this.lbProfile.TextAlign = ContentAlignment.TopLeft;
this.lbProfile.UseMnemonic = false;
this.lbCongrantulations.AutoEllipsis = false;
this.lbCongrantulations.BorderColor = Color.Black;
this.lbCongrantulations.BorderStyle = BorderStyle.None;
this.lbCongrantulations.ButtonBorderStyle = ButtonBorderStyle.Solid;
this.lbCongrantulations.Location = new Point(0x10, 15);
this.lbCongrantulations.Name = "lbCongrantulations";
this.lbCongrantulations.Size = new Size(0x13f, 0x4d);
this.lbCongrantulations.TabIndex = 0;
this.lbCongrantulations.Text = "欢迎!您已经开通了{0}服务。\r\n\r\n{1}号为{2}。\r\n\r\n为了您能够更好地享受我们的服务,请填写您的个人资料。";
this.lbCongrantulations.TextAlign = ContentAlignment.TopLeft;
this.lbCongrantulations.UseMnemonic = false;
this.lbNickName.AutoEllipsis = false;
this.lbNickName.AutoSize = true;
this.lbNickName.BorderColor = Color.Black;
this.lbNickName.BorderStyle = BorderStyle.None;
this.lbNickName.ButtonBorderStyle = ButtonBorderStyle.Solid;
this.lbNickName.Location = new Point(0x10, 0x84);
this.lbNickName.Name = "lbNickName";
this.lbNickName.Size = new Size(0x2d, 13);
this.lbNickName.TabIndex = 3;
this.lbNickName.Text = "昵 称";
this.lbNickName.TextAlign = ContentAlignment.TopLeft;
this.lbNickName.UseMnemonic = false;
this.lbSex.AutoEllipsis = false;
this.lbSex.AutoSize = true;
this.lbSex.BorderColor = Color.Black;
this.lbSex.BorderStyle = BorderStyle.None;
this.lbSex.ButtonBorderStyle = ButtonBorderStyle.Solid;
this.lbSex.Location = new Point(0x10, 0xa4);
this.lbSex.Name = "lbSex";
this.lbSex.Size = new Size(0x2d, 13);
this.lbSex.TabIndex = 5;
this.lbSex.Text = "性 别";
this.lbSex.TextAlign = ContentAlignment.TopLeft;
this.lbSex.UseMnemonic = false;
this.txtNickName.BackColor = Color.White;
this.txtNickName.BorderStyle = BorderStyle.FixedSingle;
this.txtNickName.Location = new Point(0x4d, 0x80);
this.txtNickName.MaxLength = 15;
this.txtNickName.Name = "txtNickName";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -