📄 compactprofile.cs
字号:
namespace Imps.Client.Pc.Provsion2
{
using Imps.Client.Core;
using Imps.Client.Pc;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Pc.Options;
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.Threading;
using System.Windows.Forms;
public class CompactProfile : ProvsionControlBase
{
private EventHandler<PropertiesChangedEventArgs> _personalProfileChangedHanlder;
private EventHandler<ProfileRetrivedEventArgs> _profileRetrivedHandler;
private EventHandler<HttpAppEventArgs> _profileUpdateHanlder;
private EventHandler<SysCfgEventArgs> _sysCfgAvaildHanlder;
private XButton btnDetailProfile;
private XComboBox comboBoxGender;
private IContainer components;
private GroupBox groupBox1;
private XLabel lbCongrantulations;
private XLabel lbNickName;
private XLabel lbSex;
private MobileEmailLinkControl linkBindMobilEmail;
private XTextBox txtNickName;
private XButton xBtnProtrait;
private DisplayPortrait xpbProtrait;
public CompactProfile(ProvisionWizard host) : base(host)
{
WaitCallback callBack = null;
this.InitializeComponent();
this.comboBoxGender.SelectedIndex = 2;
this.LoadResource();
this.AttachEventHandler();
base.Disposed += new EventHandler(this.CompactProfile_Disposed);
this.Init();
this.linkBindMobilEmail.Init(base._host.frmWnd);
if (callBack == null)
{
callBack = delegate {
MobileMailCommandHelper.GetMobileMailBoxBindInfo(base._host.frmWnd.AccountManager.CurrentUser);
};
}
ThreadPool.QueueUserWorkItem(callBack);
}
private void AttachEventHandler()
{
this._profileRetrivedHandler = new EventHandler<ProfileRetrivedEventArgs>(this, (IntPtr) this.Provisioning_OnProfileRetrived);
Imps.Client.Core.Provisioning.OnProfileRetrived += this._profileRetrivedHandler;
this._profileUpdateHanlder = new EventHandler<HttpAppEventArgs>(this, (IntPtr) this.Provisioning_OnPorfileUpdated);
Imps.Client.Core.Provisioning.OnPorfileUpdated += this._profileUpdateHanlder;
this._sysCfgAvaildHanlder = new EventHandler<SysCfgEventArgs>(this, (IntPtr) this.Provisioning_OnNewSysCfgRecived);
Imps.Client.Core.Provisioning.OnSysCfgRecived += this._sysCfgAvaildHanlder;
this._personalProfileChangedHanlder = new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.PersonalInfo_PropertiesChanged);
base._host.frmWnd.AccountManager.CurrentUser.PersonalInfo.PropertiesChanged += this._personalProfileChangedHanlder;
}
private void btnDetailProfile_Click(object sender, EventArgs e)
{
if (this.GetValidData())
{
using (InitProfile profile = new InitProfile(base._host.ProvsionData, base._host.frmWnd))
{
profile.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._sysCfgAvaildHanlder != null)
{
Imps.Client.Core.Provisioning.OnSysCfgRecived -= this._sysCfgAvaildHanlder;
}
if (this._personalProfileChangedHanlder != null)
{
base._host.frmWnd.AccountManager.CurrentUser.PersonalInfo.PropertiesChanged -= this._personalProfileChangedHanlder;
}
}
protected override void DisableAllControls()
{
this.txtNickName.Enabled = false;
this.comboBoxGender.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;
}
switch (this.comboBoxGender.SelectedIndex)
{
case 0:
base._host.ProvsionData.CurrentUser.PersonalInfo.Gender.ProposedValue = Gender.Male;
break;
case 1:
base._host.ProvsionData.CurrentUser.PersonalInfo.Gender.ProposedValue = Gender.Female;
break;
case 2:
base._host.ProvsionData.CurrentUser.PersonalInfo.Gender.ProposedValue = Gender.Unknown;
break;
}
base._host.ProvsionData.CurrentUser.PersonalInfo.Nickname.ProposedValue = this.txtNickName.Text;
return true;
}
private void Init()
{
base._tipMessage = string.Empty;
this.lbCongrantulations.Text = "您输入的手机号已经成功开通中国移动飞信业务,感谢您的使用。";
this.ShowInfo();
base._cancelMessage = "您尚未完成个人资料填写,确实要跳过此步骤吗?";
if (!base._host.ProvsionData.IsFreshUser)
{
base._host.LoadSysCfg();
this.DisableAllControls();
}
else
{
base._host.ProvsionData.Flag.IsOldProfileRetrived = true;
}
base._host.frmWnd.AccountManager.FillUserIdAndPassword(base._host.ProvsionData.MobileNo, base._host.ProvsionData.Password, false);
base._host.ProvsionData.CurrentUser = base._host.frmWnd.AccountManager.CurrentUser;
}
private void InitializeComponent()
{
ComponentResourceManager manager = new ComponentResourceManager(typeof(CompactProfile));
this.lbCongrantulations = new XLabel();
this.lbNickName = new XLabel();
this.lbSex = new XLabel();
this.txtNickName = new XTextBox();
this.btnDetailProfile = new XButton();
this.groupBox1 = new GroupBox();
this.linkBindMobilEmail = new MobileEmailLinkControl();
this.comboBoxGender = new XComboBox();
this.xBtnProtrait = new XButton();
this.xpbProtrait = new DisplayPortrait();
this.groupBox1.SuspendLayout();
base.SuspendLayout();
this.lbCongrantulations.BorderColor = Color.Empty;
this.lbCongrantulations.ButtonBorderStyle = ButtonBorderStyle.None;
this.lbCongrantulations.Location = new System.Drawing.Point(6, 0x11);
this.lbCongrantulations.Name = "lbCongrantulations";
this.lbCongrantulations.Size = new Size(0x13f, 0x47);
this.lbCongrantulations.TabIndex = 0;
this.lbCongrantulations.Text = "欢迎!您已经开通了{0}服务。\r\n\r\n{1}号为{2}。\r\n\r\n为了您能够更好地享受我们的服务,请填写您的个人资料。";
this.lbCongrantulations.UseMnemonic = false;
this.lbNickName.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.lbNickName.set_AutoSize(true);
this.lbNickName.BorderColor = Color.Empty;
this.lbNickName.ButtonBorderStyle = ButtonBorderStyle.None;
this.lbNickName.Location = new System.Drawing.Point(0x3e, 240);
this.lbNickName.Name = "lbNickName";
this.lbNickName.Size = new Size(0x29, 12);
this.lbNickName.TabIndex = 3;
this.lbNickName.Text = "昵称:";
this.lbNickName.UseMnemonic = false;
this.lbSex.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.lbSex.set_AutoSize(true);
this.lbSex.BorderColor = Color.Empty;
this.lbSex.ButtonBorderStyle = ButtonBorderStyle.None;
this.lbSex.Location = new System.Drawing.Point(0x3e, 270);
this.lbSex.Name = "lbSex";
this.lbSex.Size = new Size(0x29, 12);
this.lbSex.TabIndex = 5;
this.lbSex.Text = "性别:";
this.lbSex.UseMnemonic = false;
this.txtNickName.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.txtNickName.BackColor = Color.White;
this.txtNickName.BorderStyle = BorderStyle.FixedSingle;
this.txtNickName.EmptyTextTip = "";
this.txtNickName.EmptyTextTipColor = Color.DarkGray;
this.txtNickName.Location = new System.Drawing.Point(0x6d, 0xec);
this.txtNickName.MaxLength = 15;
this.txtNickName.Name = "txtNickName";
this.txtNickName.Size = new Size(0x66, 0x15);
this.txtNickName.TabIndex = 1;
this.btnDetailProfile.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.btnDetailProfile.AutoArrangementX = true;
this.btnDetailProfile.AutoSizeToImage = false;
this.btnDetailProfile.BackColor = Color.Transparent;
this.btnDetailProfile.BackgroundImage = (Image) manager.GetObject("btnDetailProfile.BackgroundImage");
this.btnDetailProfile.BackgroundImageDisable = (Image) manager.GetObject("btnDetailProfile.BackgroundImageDisable");
this.btnDetailProfile.BackgroundImageDown = (Image) manager.GetObject("btnDetailProfile.BackgroundImageDown");
this.btnDetailProfile.BackgroundImageHover = (Image) manager.GetObject("btnDetailProfile.BackgroundImageHover");
this.btnDetailProfile.ChangeSkin = false;
this.btnDetailProfile.Location = new System.Drawing.Point(0xd9, 0x10b);
this.btnDetailProfile.Name = "btnDetailProfile";
this.btnDetailProfile.Size = new Size(0x53, 0x15);
this.btnDetailProfile.TabIndex = 3;
this.btnDetailProfile.Text = "设置更多…";
this.btnDetailProfile.set_UseVisualStyleBackColor(false);
this.btnDetailProfile.Click += new EventHandler(this.btnDetailProfile_Click);
this.linkBindMobilEmail.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.linkBindMobilEmail.set_AutoSize(true);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -