www.pudn.com > Fetion.rar > EntryPointControl.cs


namespace Imps.Client.Pc 
{ 
    using Imps.Client; 
    using Imps.Client.Core; 
    using Imps.Client.Pc.BizControls; 
    using Imps.Client.Pc.BizControls.NotifyWindows; 
    using Imps.Client.Pc.Controls; 
    using Imps.Client.Pc.Password; 
    using Imps.Client.Pc.Properties; 
    using Imps.Client.Pc.Utils; 
    using Imps.Client.Pc.WndlessControls; 
    using Imps.Client.Resource; 
    using Imps.Client.Utils; 
    using Imps.Common; 
    using Imps.Utils; 
    using System; 
    using System.ComponentModel; 
    using System.Drawing; 
    using System.Drawing.Drawing2D; 
    using System.Net.NetworkInformation; 
    using System.Runtime.CompilerServices; 
    using System.Runtime.InteropServices; 
    using System.Text; 
    using System.Windows.Forms; 
 
    internal class EntryPointControl : UserControl 
    { 
        private bool _causedByUser = true; 
        private Image _curPortrait; 
        private Image _defaultPortrait; 
        private MainPresence _initPresence = MainPresence.Online; 
        private UserAccountManager _manager; 
        private bool _suspendIdChanged; 
        private WndlessControlCollection _wndlessCtls; 
        private AutoReconnect autoReconnect; 
        private volatile bool AutoReconnectEventAttached; 
        private BDisplayHelp bDisplayHelp; 
        private XButton btnLogin; 
        private CheckBox cbAutoLogin; 
        private CheckBox cbSaveAccount; 
        private CheckBox cbSavePassword; 
        private XComboBox cmbId; 
        private IContainer components; 
        private UserAccounts.AccountData currentAd; 
        private int HeightShowButton = 0x87; 
        private int HeightShowPortrait = 0x13b; 
        private int HeightShowSaveInfo = 0xeb; 
        private BDisplayNameAndOnlineStatus InitStatus; 
        private menu_widget InitStatusMenu; 
        private WndlessLabel lblStep; 
        private WndlessLabel lblWelcome; 
        private WndlessLinkLabel llEraseInfo; 
        private WndlessLinkLabel llForgetPass; 
        private WndlessLinkLabel llNetSetting; 
        private WndlessLinkLabel llProvisioning; 
        private WndlessLinkLabel llReconnectAtOnce; 
        private const int MarginX = 0x18; 
        private const int MarginY = 50; 
        private const int PaddingX = 5; 
        private const int PaddingY = 3; 
        private WndlessPictureBox pbPortrait; 
        private PictureBox pbProgress; 
        private WndlessPictureBox pnPortrait; 
        private RadioButton rbPrivate; 
        private RadioButton rbPublic; 
        private const int SpacingLogin = 0x24; 
        private XPasswordEdit tbPassword; 
        private const int WidthMaxId = 160; 
        private const int WidthMinId = 80; 
        private int WidthShowProvisioning; 
 
        public EntryPointControl(UserAccountManager manager) 
        { 
            this._manager = manager; 
            this._manager.CurrentUser.StatusChanged += new EventHandler(this.CurrentUser_StatusChanged); 
            this._manager.CurrentUser.LoginStepChanged += new EventHandler(this.CurrentUser_LoginStepChanged); 
            this._manager.CurrentUser.AutoLoginFailed += new EventHandler(this.CurrentUser_AutoLoginFailed); 
            this._manager.FrameworkWnd.MainWindowLoaded += new EventHandler(this.FrameworkWnd_Loaded); 
            this._manager.FrameworkWnd.MainWindow.Activated += new EventHandler(this.MainWindow_Activated); 
            this._manager.FrameworkWnd.SuspendRestored += new EventHandler(this.FrameworkWnd_SuspendRestored); 
            this._manager.FrameworkWnd.BeginSuspend += new EventHandler(this.FrameworkWnd_BeginSuspend); 
            base.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); 
            this.DoubleBuffered = true; 
            this.InitializeComponent(); 
            this.cmbId.EmptyTextTip = "请输入手机号或飞信号..."; 
            this.tbPassword.EmptyTextTip = StringTable.Password.EmptyPasswordTipText; 
            this.tbPassword.ModifyPasswordTip = StringTable.Password.ModifyPasswordTipOfPasswordEdit; 
            this.InitializeWndlessComponent(); 
            this.tbPassword.DoEncrypt = new XPasswordEdit.DlgtEncryptString(this._manager.CurrentUser.HashPassword); 
            this.CalcSizeParameters(); 
            base.SizeChanged += new EventHandler(this.EntryPointControl_SizeChanged); 
            ControlHelper.SetAcceptDigitOnly(this.cmbId, true); 
            this.DoLocalize(); 
            this.ResetCheckBox(); 
            this.InitStatusMenuItems(); 
            this.bDisplayHelp.DropDownMenu = ((MainForm) this._manager.FrameworkWnd).HelpMenu; 
            this.autoReconnect = new AutoReconnect(0x7fffffff); 
            this.AttachReconnEventHandlers(true); 
        } 
 
        private void AR_OnTick(object sender, TickEventArgs e) 
        { 
            try 
            { 
                this._manager.CurrentUser.Status = UserAccountStatus.WaitReconnect; 
                if (NetworkInterface.GetIsNetworkAvailable()) 
                { 
                    this.llReconnectAtOnce.Visible = true; 
                    if (e != null) 
                    { 
                        this.UpdateStepLabelText(string.Format(StringTable.User.StepNextReconnect, e.CurrentTick)); 
                    } 
                } 
                else 
                { 
                    this.llReconnectAtOnce.Visible = false; 
                    this.UpdateStepLabelText(StringTable.User.WaitForNetworkRecover); 
                    this.autoReconnect.StopTimer(); 
                } 
            } 
            catch (Exception exception) 
            { 
                ClientLogger.WriteException(exception); 
            } 
        } 
 
        private void AR_TimeUp(object sender, EventArgs e) 
        { 
            try 
            { 
                if (this._manager.CurrentUser.Status == UserAccountStatus.WaitReconnect) 
                { 
                    if (NetworkInterface.GetIsNetworkAvailable()) 
                    { 
                        this.UpdateStepLabelText(StringTable.User.StepSigning); 
                        this.autoReconnect.StopTimer(); 
                        this._manager.CurrentUser.AsyncLogin(this._initPresence, true); 
                    } 
                    else 
                    { 
                        this.llReconnectAtOnce.Visible = false; 
                        this.UpdateStepLabelText(StringTable.User.WaitForNetworkRecover); 
                        this.autoReconnect.StopTimer(); 
                    } 
                } 
            } 
            catch (Exception exception) 
            { 
                ClientLogger.WriteException(exception); 
            } 
        } 
 
        private void AttachReconnEventHandlers(bool attach) 
        { 
            if (attach) 
            { 
                if (!this.AutoReconnectEventAttached) 
                { 
                    this.autoReconnect.OnTick += new EventHandler(this.AR_OnTick); 
                    this.autoReconnect.TimeUp += new EventHandler(this.AR_TimeUp); 
                } 
            } 
            else 
            { 
                this.AutoReconnectEventAttached = false; 
                this.autoReconnect.OnTick -= new EventHandler(this.AR_OnTick); 
                this.autoReconnect.TimeUp -= new EventHandler(this.AR_TimeUp); 
            } 
        } 
 
        private void btnLogin_Click(object sender, EventArgs e) 
        { 
            try 
            { 
                if (base.Visible) 
                { 
                    this.DoLoginOrCancel(); 
                } 
            } 
            catch (Exception exception) 
            { 
                ClientLogger.WriteGeneral(exception.ToString()); 
            } 
        } 
 
        private void CalcSizeParameters() 
        { 
            this.HeightShowButton = 200; 
            this.HeightShowSaveInfo = ((this.HeightShowButton + (this.cbSaveAccount.Height * 4)) + 30) + 9; 
            this.HeightShowPortrait = (this.HeightShowSaveInfo + this.pnPortrait.Height) + 20; 
            this.WidthShowProvisioning = (((80 + this.WidthMaxProvisioning) + 0x18) + 0x18) + 5; 
        } 
 
        internal void CancelLogin() 
        { 
            try 
            { 
                this.UpdateStepLabelText("取消中..."); 
            } 
            catch 
            { 
            } 
            try 
            { 
                this.autoReconnect.StopTimer(true); 
                this._manager.CurrentUser.AsyncCancelLogin(); 
                this._suspendIdChanged = false; 
                this.cmbId.SelectAll(); 
                this.cmbId.Focus(); 
            } 
            catch (Exception exception) 
            { 
                this._manager.FrameworkWnd.UnifiedMessageBox.ShowException(exception); 
            } 
        } 
 
        private void cbAutoLogin_CheckedChanged(object sender, EventArgs e) 
        { 
            try 
            { 
                if (this.cbAutoLogin.Checked) 
                { 
                    this.cbSaveAccount.Checked = true; 
                    this.cbSavePassword.Checked = true; 
                } 
                if (this._causedByUser) 
                { 
                    UserAccounts.SetAccountAutoLogin(this.cmbId.Text, this.cbAutoLogin.Checked); 
                    UserAccounts.SaveToLocal(); 
                } 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception); 
            } 
        } 
 
        private void cbSaveAccount_CheckedChanged(object sender, EventArgs e) 
        { 
            try 
            { 
                if (!this.cbSaveAccount.Checked) 
                { 
                    this._causedByUser = false; 
                    this.cbAutoLogin.Checked = false; 
                    this.cbSavePassword.Checked = false; 
                    this._causedByUser = true; 
                } 
            } 
            catch 
            { 
            } 
        } 
 
        private void cbSavePassword_CheckedChanged(object sender, EventArgs e) 
        { 
            try 
            { 
                if (this.cbSavePassword.Checked) 
                { 
                    this.cbSaveAccount.Checked = true; 
                } 
                else 
                { 
                    this.cbAutoLogin.Checked = false; 
                    this.tbPassword.Enabled = true; 
                    if (this._causedByUser) 
                    { 
                        UserAccounts.EraseAccountPassword(this.cmbId.Text); 
                        UserAccounts.SaveToLocal(); 
                    } 
                } 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception); 
            } 
        } 
 
        internal bool CheckInput(out long id, out string password) 
        { 
            id = 0L; 
            password = this.tbPassword.Text; 
            if (this.cmbId.Text.Length <= 0) 
            { 
                this.ShowErrorTip(StringTable.User.MsgEmptyId, this.cmbId); 
                return false; 
            } 
            char ch = this.cmbId.Text[0]; 
            bool flag = ((ch < '1') || (ch > '9')) || !long.TryParse(this.cmbId.Text, out id); 
            bool flag2 = password.Length <= 0; 
            bool flag3 = ImpsHelper.IsSid(id); 
            bool flag4 = ImpsHelper.IsCmccMobileNo(id); 
            if ((flag || (id <= 0L)) || (!flag3 && !flag4)) 
            { 
                this.ShowErrorTip(StringTable.User.MsgInvalidId, this.cmbId); 
                return false; 
            } 
            if (flag2) 
            { 
                this.ShowErrorTip(StringTable.User.MsgInvalidPassword, this.tbPassword); 
                return false; 
            } 
            return true; 
        } 
 
        private void Child_KeyPress(object sender, KeyPressEventArgs e) 
        { 
            this.InnerOnKeyPress(e); 
        } 
 
        private void cmbId_TextChanged(object sender, EventArgs e) 
        { 
            if (!this._suspendIdChanged) 
            { 
                try 
                { 
                    this.TryFillRelatedInfo(); 
                    this.EnableControls(this.cmbId.Enabled); 
                } 
                catch 
                { 
                } 
            } 
        } 
 
        private static int CompareIds(string id1, string id2) 
        { 
            if (id1.Length < 11) 
            { 
                if (id2.Length == 11) 
                { 
                    return 1; 
                } 
            } 
            else if (id2.Length < 11) 
            { 
                return -1; 
            } 
            return string.Compare(id1, id2); 
        } 
 
        private bool CompareWithOldPassword() 
        { 
            bool flag; 
            XPasswordEdit.DlgtEncryptString doEncrypt = this.tbPassword.DoEncrypt; 
            try 
            { 
                this.tbPassword.DoEncrypt = new XPasswordEdit.DlgtEncryptString(this.HashWithOldNonce); 
                string hashPassword = this.tbPassword.GetHashPassword(); 
                flag = string.Equals(this.currentAd.Password, hashPassword); 
            } 
            catch 
            { 
                flag = false; 
            } 
            finally 
            { 
                this.tbPassword.DoEncrypt = doEncrypt; 
            } 
            return flag; 
        } 
 
        private void CurrentUser_AutoLoginFailed(object sender, ImpsErrorEventArgs e) 
        { 
            if (this.btnLogin.Text == StringTable.EP_BtnCancel) 
            { 
                this.StartReconnect(); 
            } 
        } 
 
        private void CurrentUser_LoginStepChanged(object sender, EventArgs e) 
        { 
            try 
            { 
                this.UpdateStepLabelText(this._manager.CurrentUser.LoginStep); 
            } 
            catch 
            { 
            } 
        } 
 
        private void CurrentUser_StatusChanged(object sender, UserSatusChangedEventArgs e) 
        { 
            try 
            { 
                switch (e.NewStatus) 
                { 
                    case UserAccountStatus.Initialized: 
                        this.btnLogin.Text = StringTable.EP_BtnLogin; 
                        this.EnableControls(true); 
                        this.ShowNetworkSetting(true); 
                        goto Label_0198; 
 
                    case UserAccountStatus.Loginning: 
                        this.btnLogin.Text = StringTable.EP_BtnCancel; 
                        this.EnableControls(false); 
                        this.ShowNetworkSetting(true); 
                        goto Label_0198; 
 
                    case UserAccountStatus.Logon: 
                        this.autoReconnect.StopTimer(true); 
                        if (!this.rbPublic.Checked && this.cbSaveAccount.Checked) 
                        { 
                            break; 
                        } 
                        this.cmbId.Text = string.Empty; 
                        this.tbPassword.Text = string.Empty; 
                        goto Label_0141; 
 
                    case UserAccountStatus.Logouting: 
                        this.TryLoadPortrait(this.cmbId.Text); 
                        this.ShowNetworkSetting(true); 
                        this.UpdateStepLabelText(string.Empty); 
                        goto Label_0198; 
 
                    case UserAccountStatus.Disconnected: 
                        this.btnLogin.Text = StringTable.EP_BtnCancel; 
                        this.EnableControls(false); 
                        this.ShowNetworkSetting(false); 
                        this.StartReconnect(); 
                        goto Label_0198; 
 
                    case UserAccountStatus.WaitReconnect: 
                        this.EnableControls(false); 
                        this.ShowNetworkSetting(false); 
                        this.btnLogin.Text = StringTable.EP_BtnCancel; 
                        this.AR_OnTick(this, null); 
                        goto Label_0198; 
 
                    default: 
                        this.btnLogin.Text = StringTable.EP_BtnLogin; 
                        this.UpdateStepLabelText(string.Empty); 
                        this.EnableControls(true); 
                        this.ShowNetworkSetting(true); 
                        goto Label_0198; 
                } 
                if (!this.cbSavePassword.Checked) 
                { 
                    this.tbPassword.Text = string.Empty; 
                } 
                else 
                { 
                    this.cbAutoLogin.Checked = UserAccounts.LatestAccountAutoLogin; 
                } 
            Label_0141: 
                this.ShowNetworkSetting(true); 
            Label_0198: 
                this._suspendIdChanged = false; 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception); 
            } 
        } 
 
        protected override void Dispose(bool disposing) 
        { 
            if (disposing && (this.components != null)) 
            { 
                this.components.Dispose(); 
            } 
            base.Dispose(disposing); 
        } 
 
        private void DoLocalize() 
        { 
            this.btnLogin.Text = StringTable.EP_BtnLogin; 
        } 
 
        internal bool DoLogin() 
        { 
            return this.DoLogin(false); 
        } 
 
        private bool DoLogin(bool auto) 
        { 
            try 
            { 
                long num; 
                string str; 
                if (!this.CheckInput(out num, out str)) 
                { 
                    return false; 
                } 
                NotifyWindowManager.Clear(); 
                this.btnLogin.Focus(); 
                this.cmbId.Select(0, 0); 
                if (this._initPresence == MainPresence.OfflineLogin) 
                { 
                    try 
                    { 
                        this.currentAd = UserAccounts.GetAccount(num.ToString()); 
                        if (this.currentAd == null) 
                        { 
                            this._manager.FrameworkWnd.UnifiedMessageBox.ShowWarning(StringTable.User.MsgConnectSeverValidate); 
                            return false; 
                        } 
                        if (!string.Equals(str, this.currentAd.Password) && !this.CompareWithOldPassword()) 
                        { 
                            this._manager.FrameworkWnd.UnifiedMessageBox.ShowWarning(StringTable.User.MsgUnauthorization); 
                            return false; 
                        } 
                    } 
                    catch 
                    { 
                        return false; 
                    } 
                    finally 
                    { 
                        this.currentAd = null; 
                    } 
                } 
                this._manager.LoginAs(num, str, this._initPresence, auto); 
                string text = this.cmbId.Text; 
                bool flag = this.rbPrivate.Checked && this.cbSaveAccount.Checked; 
                this._manager.CurrentUser.Configuration.UserSetting.SaveMyInfo = flag; 
                if (flag) 
                { 
                    string pass = this.cbSavePassword.Checked ? this.tbPassword.Text : string.Empty; 
                    UserAccounts.AccountData data = new UserAccounts.AccountData(text, pass, this.cbAutoLogin.Checked, this._initPresence); 
                    UserAccounts.LastestAccount = data; 
                    if (!this.cmbId.Items.Contains(text)) 
                    { 
                        int index = this.FindInsertIndexOfId(text); 
                        if (index < 0) 
                        { 
                            this.cmbId.Items.Add(text); 
                        } 
                        else 
                        { 
                            this.cmbId.Items.Insert(index, text); 
                        } 
                    } 
                } 
                else 
                { 
                    UserAccounts.LastestAccount = null; 
                    UserAccounts.EraseAccountElement(text); 
                    UserAccounts.LatestId = string.Empty; 
                    UserAccounts.SaveToLocal(); 
                    this._suspendIdChanged = true; 
                    this.cmbId.Items.Remove(text); 
                    if (this.cmbId.Text.Length <= 0) 
                    { 
                        this.cmbId.Text = text; 
                    } 
                    this._suspendIdChanged = false; 
                } 
                return true; 
            } 
            catch (Exception exception) 
            { 
                this._manager.FrameworkWnd.UnifiedMessageBox.ShowException(exception); 
                ClientLogger.WriteException(exception); 
                return false; 
            } 
        } 
 
        private void DoLoginOrCancel() 
        { 
            if (this.btnLogin.Text == StringTable.EP_BtnLogin) 
            { 
                this.DoLogin(); 
            } 
            else 
            { 
                this.CancelLogin(); 
                this.ShowNetworkSetting(true); 
            } 
        } 
 
        private void EnableControls(bool enabled) 
        { 
            this.pbProgress.Visible = !enabled; 
            this.cmbId.Enabled = enabled; 
            this.tbPassword.Enabled = enabled; 
            this.llForgetPass.Enabled = enabled; 
            this.llNetSetting.Enabled = enabled; 
            this.llProvisioning.Enabled = enabled; 
            this.rbPrivate.Enabled = enabled; 
            this.rbPublic.Enabled = enabled; 
            enabled = enabled && this.rbPrivate.Checked; 
            this.cbSaveAccount.Enabled = enabled; 
            this.llEraseInfo.Enabled = enabled; 
            this.cbSavePassword.Enabled = enabled; 
            this.cbAutoLogin.Enabled = enabled; 
            this.InitStatus.Enabled = this.tbPassword.Enabled; 
            this.bDisplayHelp.Enabled = enabled; 
        } 
 
        private void EntryPointControl_SizeChanged(object sender, EventArgs e) 
        { 
            this.RearrangeControls(); 
        } 
 
        internal void FillUserIdAndPassword(string id, string pass) 
        { 
            if (!FuncLimitedSetting.SSIEncryptLoginLimited) 
            { 
                this.cmbId.Text = id; 
                this.tbPassword.Text = this._manager.CurrentUser.HashPassword(Encoding.UTF8.GetBytes(pass)); 
            } 
            else 
            { 
                this.cmbId.Text = id; 
                this.tbPassword.Text = pass; 
            } 
        } 
 
        private int FindInsertIndexOfId(string id) 
        { 
            for (int i = 0; i < this.cmbId.Items.Count; i++) 
            { 
                string str = (string) this.cmbId.Items[i]; 
                if (CompareIds(str, id) > 0) 
                { 
                    return i; 
                } 
            } 
            return -1; 
        } 
 
        private void FrameworkWnd_BeginSuspend(object sender, EventArgs e) 
        { 
            try 
            { 
                if ((this._manager.CurrentUser.Status == UserAccountStatus.WaitReconnect) && !this.AutoLogin) 
                { 
                    ClientLogger.WriteBizOperation("开始休眠,清除倒计时!"); 
                    if (this.autoReconnect != null) 
                    { 
                        this.autoReconnect.StopTimer(true); 
                    } 
                } 
                this.ShowNetworkSetting(true); 
            } 
            catch (Exception) 
            { 
            } 
        } 
 
        private void FrameworkWnd_Loaded(object sender, EventArgs e) 
        { 
            try 
            { 
                this.LoadUserAccounts(); 
                this.TryAutoLogin(); 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception); 
            } 
        } 
 
        private void FrameworkWnd_SuspendRestored(object sender, EventArgs e) 
        { 
            try 
            { 
                ClientLogger.WriteBizOperation("休眠恢复!"); 
                this.TryAutoLogin(); 
            } 
            catch 
            { 
            } 
        } 
 
        private string HashWithOldNonce(byte[] bytes) 
        { 
            return Imps.Client.Core.User.DoHashPassword(bytes, ComputeAuthResponse.HexToBinary(this.currentAd.Password.Substring(0, 8))); 
        } 
 
        private void HideErrorTip() 
        { 
            BalloonHelper.RemoveAll(); 
        } 
 
        private void InitializeComponent() 
        { 
            this.components = new Container(); 
            ComponentResourceManager manager = new ComponentResourceManager(typeof(EntryPointControl)); 
            this.cbAutoLogin = new CheckBox(); 
            this.cbSavePassword = new CheckBox(); 
            this.cbSaveAccount = new CheckBox(); 
            this.rbPrivate = new RadioButton(); 
            this.rbPublic = new RadioButton(); 
            this.pbProgress = new PictureBox(); 
            this.InitStatus = new BDisplayNameAndOnlineStatus(); 
            this.InitStatusMenu = new menu_widget(this.components); 
            this.bDisplayHelp = new BDisplayHelp(); 
            this.cmbId = new XComboBox(); 
            this.tbPassword = new XPasswordEdit(); 
            this.btnLogin = new XButton(); 
            ((ISupportInitialize) this.pbProgress).BeginInit(); 
            base.SuspendLayout(); 
            this.cbAutoLogin.AutoSize = true; 
            this.cbAutoLogin.FlatStyle = FlatStyle.Flat; 
            this.cbAutoLogin.Location = new System.Drawing.Point(13, 0x14d); 
            this.cbAutoLogin.Name = "cbAutoLogin"; 
            this.cbAutoLogin.Size = new Size(0x47, 0x11); 
            this.cbAutoLogin.TabIndex = 7; 
            this.cbAutoLogin.Text = "自动登录"; 
            this.cbAutoLogin.UseVisualStyleBackColor = true; 
            this.cbAutoLogin.CheckedChanged += new EventHandler(this.cbAutoLogin_CheckedChanged); 
            this.cbSavePassword.AutoSize = true; 
            this.cbSavePassword.FlatStyle = FlatStyle.Flat; 
            this.cbSavePassword.Location = new System.Drawing.Point(13, 310); 
            this.cbSavePassword.Name = "cbSavePassword"; 
            this.cbSavePassword.Size = new Size(0x5f, 0x11); 
            this.cbSavePassword.TabIndex = 6; 
            this.cbSavePassword.Text = "记住我的密码"; 
            this.cbSavePassword.UseVisualStyleBackColor = true; 
            this.cbSavePassword.CheckedChanged += new EventHandler(this.cbSavePassword_CheckedChanged); 
            this.cbSaveAccount.AutoSize = true; 
            this.cbSaveAccount.FlatStyle = FlatStyle.Flat; 
            this.cbSaveAccount.Location = new System.Drawing.Point(13, 0x11f); 
            this.cbSaveAccount.Name = "cbSaveAccount"; 
            this.cbSaveAccount.Size = new Size(0x5f, 0x11); 
            this.cbSaveAccount.TabIndex = 5; 
            this.cbSaveAccount.Text = "保存我的信息"; 
            this.cbSaveAccount.UseVisualStyleBackColor = true; 
            this.cbSaveAccount.Visible = false; 
            this.cbSaveAccount.CheckedChanged += new EventHandler(this.cbSaveAccount_CheckedChanged); 
            this.rbPrivate.AutoSize = true; 
            this.rbPrivate.Checked = true; 
            this.rbPrivate.FlatStyle = FlatStyle.Flat; 
            this.rbPrivate.Location = new System.Drawing.Point(4, 0x108); 
            this.rbPrivate.Name = "rbPrivate"; 
            this.rbPrivate.Size = new Size(0x60, 0x11); 
            this.rbPrivate.TabIndex = 4; 
            this.rbPrivate.TabStop = true; 
            this.rbPrivate.Text = "保存我的信息"; 
            this.rbPrivate.UseVisualStyleBackColor = true; 
            this.rbPrivate.CheckedChanged += new EventHandler(this.rbPrivate_CheckedChanged); 
            this.rbPublic.AutoSize = true; 
            this.rbPublic.FlatStyle = FlatStyle.Flat; 
            this.rbPublic.Location = new System.Drawing.Point(3, 0xf1); 
            this.rbPublic.Name = "rbPublic"; 
            this.rbPublic.Size = new Size(0x54, 0x11); 
            this.rbPublic.TabIndex = 3; 
            this.rbPublic.Text = "公共计算机"; 
            this.rbPublic.UseVisualStyleBackColor = true; 
            this.rbPublic.CheckedChanged += new EventHandler(this.rbPublic_CheckedChanged); 
            this.pbProgress.BackColor = Color.Transparent; 
            this.pbProgress.Image = (Image) manager.GetObject("pbProgress.Image"); 
            this.pbProgress.Location = new System.Drawing.Point(0x7f, 0xd3); 
            this.pbProgress.Name = "pbProgress"; 
            this.pbProgress.Size = new Size(0x66, 15); 
            this.pbProgress.TabIndex = 9; 
            this.pbProgress.TabStop = false; 
            this.pbProgress.Visible = false; 
            this.InitStatus.BackColor = Color.Transparent; 
            this.InitStatus.DisplayName = ""; 
            this.InitStatus.DisplayNameFont = new Font("SimSun", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86); 
            this.InitStatus.DisplayNameForeColor = Color.Black; 
            this.InitStatus.DropDownButtonImage = (Image) manager.GetObject("InitStatus.DropDownButtonImage"); 
            this.InitStatus.DropDownMenu = this.InitStatusMenu; 
            this.InitStatus.Location = new System.Drawing.Point(0x18, 0x71); 
            this.InitStatus.MouseDownBackColor = Color.White; 
            this.InitStatus.MouseDownBackgroundImage = null; 
            this.InitStatus.MouseDownBorderColor = Color.FromArgb(0x98, 200, 0xe8); 
            this.InitStatus.MouseOverBackColor = Color.White; 
            this.InitStatus.MouseOverBackgroundImage = null; 
            this.InitStatus.MouseOverBorderColor = Color.FromArgb(0x48, 0x90, 200); 
            this.InitStatus.Name = "InitStatus"; 
            this.InitStatus.OnlineStatusText = "在线"; 
            this.InitStatus.OnlineStatusTextFont = new Font("SimSun", 9f); 
            this.InitStatus.OnlineStatusTextForeColor = Color.Black; 
            this.InitStatus.Size = new Size(0x2f, 0x16); 
            this.InitStatus.TabIndex = 8; 
            this.InitStatus.ToolTipText = ""; 
            this.InitStatusMenu.Name = "InitStatusMenu"; 
            this.InitStatusMenu.Size = new Size(0x3d, 4); 
            this.InitStatusMenu.UseMnemonic = true; 
            this.InitStatusMenu.Opening += new CancelEventHandler(this.InitStatusMenu_Opening); 
            this.bDisplayHelp.BackColor = Color.Transparent; 
            this.bDisplayHelp.DropDownButtonImage = (Image) manager.GetObject("bDisplayHelp.DropDownButtonImage"); 
            this.bDisplayHelp.DropDownMenu = null; 
            this.bDisplayHelp.ForeColor = Color.Blue; 
            this.bDisplayHelp.Location = new System.Drawing.Point(0xc6, 3); 
            this.bDisplayHelp.MouseDownBackColor = Color.White; 
            this.bDisplayHelp.MouseDownBackgroundImage = null; 
            this.bDisplayHelp.MouseDownBorderColor = Color.FromArgb(0x98, 200, 0xe8); 
            this.bDisplayHelp.MouseOverBackColor = Color.White; 
            this.bDisplayHelp.MouseOverBackgroundImage = null; 
            this.bDisplayHelp.MouseOverBorderColor = Color.FromArgb(0x48, 0x90, 200); 
            this.bDisplayHelp.Name = "bDisplayHelp"; 
            this.bDisplayHelp.Size = new Size(0x2b, 0x15); 
            this.bDisplayHelp.TabIndex = 11; 
            this.bDisplayHelp.Text = "帮助"; 
            this.bDisplayHelp.ToolTipText = ""; 
            this.cmbId.AutoCompleteMode = AutoCompleteMode.Suggest; 
            this.cmbId.AutoCompleteSource = AutoCompleteSource.ListItems; 
            this.cmbId.BackColor = Color.White; 
            this.cmbId.EmptyTextTip = ""; 
            this.cmbId.EmptyTextTipColor = Color.DarkGray; 
            this.cmbId.Location = new System.Drawing.Point(0x18, 0x8e); 
            this.cmbId.MaxLength = 11; 
            this.cmbId.Name = "cmbId"; 
            this.cmbId.Size = new Size(0x9d, 0x15); 
            this.cmbId.TabIndex = 0; 
            this.cmbId.TextChanged += new EventHandler(this.cmbId_TextChanged); 
            this.tbPassword.BackColor = Color.White; 
            this.tbPassword.BorderStyle = BorderStyle.FixedSingle; 
            this.tbPassword.EmptyTextTip = ""; 
            this.tbPassword.EmptyTextTipColor = Color.DarkGray; 
            this.tbPassword.Location = new System.Drawing.Point(0x18, 0xb6); 
            this.tbPassword.MaxLength = 0x10; 
            this.tbPassword.ModifyPasswordTip = ""; 
            this.tbPassword.Name = "tbPassword"; 
            this.tbPassword.PasswordChar = '*'; 
            this.tbPassword.Size = new Size(0x9d, 20); 
            this.tbPassword.TabIndex = 1; 
            this.tbPassword.UseSystemPasswordChar = true; 
            this.tbPassword.TextChanged += new EventHandler(this.tbPassword_TextChanged); 
            this.btnLogin.AutoArrangementX = true; 
            this.btnLogin.AutoSizeToImage = true; 
            this.btnLogin.BackColor = Color.Transparent; 
            this.btnLogin.BackgroundImage = Resources.logon; 
            this.btnLogin.BackgroundImageDisable = Resources.logon_dis; 
            this.btnLogin.BackgroundImageDown = Resources.logon_down; 
            this.btnLogin.BackgroundImageHover = Resources.logon_hover; 
            this.btnLogin.ChangeSkin = false; 
            this.btnLogin.Font = new Font("SimSun", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 0x86); 
            this.btnLogin.ForeColor = Color.White; 
            this.btnLogin.Location = new System.Drawing.Point(0x8b, 0xf1); 
            this.btnLogin.Name = "btnLogin"; 
            this.btnLogin.Size = new Size(0x5b, 0x1b); 
            this.btnLogin.TabIndex = 2; 
            this.btnLogin.UseVisualStyleBackColor = false; 
            this.btnLogin.Click += new EventHandler(this.btnLogin_Click); 
            base.AutoScaleDimensions = new SizeF(6f, 13f); 
            base.AutoScaleMode = AutoScaleMode.Font; 
            this.BackColor = Color.Transparent; 
            base.Controls.Add(this.InitStatus); 
            base.Controls.Add(this.rbPublic); 
            base.Controls.Add(this.rbPrivate); 
            base.Controls.Add(this.bDisplayHelp); 
            base.Controls.Add(this.cmbId); 
            base.Controls.Add(this.pbProgress); 
            base.Controls.Add(this.cbAutoLogin); 
            base.Controls.Add(this.cbSavePassword); 
            base.Controls.Add(this.cbSaveAccount); 
            base.Controls.Add(this.tbPassword); 
            base.Controls.Add(this.btnLogin); 
            this.MinimumSize = new Size(100, 150); 
            base.Name = "EntryPointControl"; 
            base.Size = new Size(0x10d, 0x173); 
            ((ISupportInitialize) this.pbProgress).EndInit(); 
            base.ResumeLayout(false); 
            base.PerformLayout(); 
        } 
 
        private void InitializeWndlessComponent() 
        { 
            this.llNetSetting = new WndlessLinkLabel(); 
            this.pbPortrait = new WndlessPictureBox(); 
            this.pnPortrait = new WndlessPictureBox(); 
            this.llProvisioning = new WndlessLinkLabel(); 
            this.llForgetPass = new WndlessLinkLabel(); 
            this.llEraseInfo = new WndlessLinkLabel(); 
            this.llReconnectAtOnce = new WndlessLinkLabel(); 
            this.lblStep = new WndlessLabel(); 
            this.lblWelcome = new WndlessLabel(); 
            this.lblWelcome.Size = new Size(100, 0x19); 
            this.lblWelcome.Text = StringTable.User.EP_LabelWelcome; 
            this.lblWelcome.Font = new Font("宋体", 10.5f, FontStyle.Bold); 
            this.lblWelcome.ForeColor = Color.FromArgb(0, 0, 0xff); 
            this.lblStep.AutoSize = true; 
            this.lblStep.ForeColor = Color.Blue; 
            this.lblStep.Text = string.Empty; 
            this.llNetSetting.Text = StringTable.User.EP_LabelNetSetting; 
            this.llNetSetting.Click += new EventHandler(this.llNetSetting_LinkClicked); 
            this.llReconnectAtOnce.Text = StringTable.User.EP_LabelConnectNow; 
            this.llReconnectAtOnce.Click += new EventHandler(this.llReconnectAtOnce_Click); 
            this.llReconnectAtOnce.Visible = false; 
            this.pbPortrait.Image = ImpsPortrait.GetDefaultPortrait(0x60, 0x60); 
            this.pbPortrait.BorderStyle = BorderStyle.None; 
            this.pbPortrait.Margin = new Padding(2); 
            this.pbPortrait.SizeMode = PictureBoxSizeMode.AutoSize; 
            this.pnPortrait.Image = Resources.portraitBackground; 
            this.pnPortrait.BorderStyle = BorderStyle.None; 
            this.pnPortrait.SizeMode = PictureBoxSizeMode.AutoSize; 
            this.llProvisioning.Text = StringTable.User.EP_LabelProvioning; 
            this.llProvisioning.Click += new EventHandler(this.llProvisioning_Click); 
            this.llForgetPass.Text = StringTable.User.EP_LabelForgetPass; 
            this.llForgetPass.Click += new EventHandler(this.llForgetPass_LinkClicked); 
            this.llEraseInfo.Text = StringTable.User.EP_LabelEraseInfo; 
            this.llEraseInfo.Click += new EventHandler(this.llEraseInfo_LinkClicked); 
            this._wndlessCtls = new WndlessControlCollection(this); 
            this._wndlessCtls.Add(this.lblStep); 
            this._wndlessCtls.Add(this.llNetSetting); 
            this._wndlessCtls.Add(this.pbPortrait); 
            this._wndlessCtls.Add(this.pnPortrait); 
            this._wndlessCtls.Add(this.llProvisioning); 
            this._wndlessCtls.Add(this.llForgetPass); 
            this._wndlessCtls.Add(this.llEraseInfo); 
            this._wndlessCtls.Add(this.llReconnectAtOnce); 
            this._wndlessCtls.Add(this.lblWelcome); 
        } 
 
        private void InitStatusMenu_Opening(object sender, CancelEventArgs e) 
        { 
            foreach (ToolStripItem item in this.InitStatusMenu.Items) 
            { 
                menu_radioitem _radioitem = item as menu_radioitem; 
                if (_radioitem != null) 
                { 
                    CustomPresence tag = _radioitem.Tag as CustomPresence; 
                    if (tag != null) 
                    { 
                        if (tag.BasicPresence == this._initPresence) 
                        { 
                            _radioitem.Radioed = true; 
                        } 
                        else 
                        { 
                            _radioitem.Radioed = false; 
                        } 
                    } 
                } 
            } 
        } 
 
        private void InitStatusMenuItems() 
        { 
            EventHandler handler = null; 
            ToolStripItem[] basicPresenceMenuItems = this._manager.GetBasicPresenceMenuItems(); 
            for (int i = 0; i < basicPresenceMenuItems.Length; i++) 
            { 
                this.InitStatusMenu.Items.Add(basicPresenceMenuItems[i]); 
                if (handler == null) 
                { 
                    handler = delegate (object sender, EventArgs e) { 
                        ToolStripItem item = sender as ToolStripItem; 
                        if (item != null) 
                        { 
                            CustomPresence tag = item.Tag as CustomPresence; 
                            if (tag != null) 
                            { 
                                this.InitStatus.OnlineStatusText = MainPresenceHelper.MainPresence2Str(tag.BasicPresence); 
                                this._initPresence = tag.BasicPresence; 
                            } 
                        } 
                    }; 
                } 
                basicPresenceMenuItems[i].Click += handler; 
            } 
        } 
 
        private void InnerOnKeyPress(KeyPressEventArgs e) 
        { 
            try 
            { 
                if (base.Visible) 
                { 
                    this.HideErrorTip(); 
                    switch (e.KeyChar) 
                    { 
                        case '\r': 
                            this.DoLoginOrCancel(); 
                            break; 
 
                        case '\x001b': 
                            this.CancelLogin(); 
                            break; 
                    } 
                } 
            } 
            catch 
            { 
            } 
        } 
 
        private static bool IsIdCompleted(string id) 
        { 
            return (id.Length == 11); 
        } 
 
        private void llEraseInfo_LinkClicked(object sender, EventArgs e) 
        { 
            try 
            { 
                string text = this.cmbId.Text; 
                if (text.Length > 0) 
                { 
                    EraseAccountForm form = new EraseAccountForm(text); 
                    if (ControlHelper.ShowDialogCenterOnParent(form, base.ParentForm, true) == DialogResult.OK) 
                    { 
                        if (UserAccounts.EraseAccountElement(text)) 
                        { 
                            UserAccounts.SaveToLocal(); 
                        } 
                        this.cmbId.Items.Remove(text); 
                        this.cmbId.Text = string.Empty; 
                        this.tbPassword.Text = string.Empty; 
                        this.TryLoadPortrait(string.Empty); 
                        this.TryFillRelatedInfo(); 
                        this.cmbId.Focus(); 
                        if (text.Length >= 11) 
                        { 
                            long mappedSid = UserAccounts.GetMappedSid(text); 
                            if (mappedSid <= 0L) 
                            { 
                                return; 
                            } 
                            text = mappedSid.ToString(); 
                        } 
                        if (form.RbAllMaterials.Checked) 
                        { 
                            this._manager.FrameworkWnd.PersistentManager.DelById(text); 
                        } 
                        else if (form.RbDetailOption.Checked) 
                        { 
                            if (form.CkChatHistory.Checked) 
                            { 
                                this._manager.FrameworkWnd.PersistentManager.DelChatHistoryById(text); 
                            } 
                            if (form.CkContactInfo.Checked) 
                            { 
                                this._manager.FrameworkWnd.PersistentManager.DelContactsInfoById(text); 
                            } 
                            if (form.CkCaches.Checked) 
                            { 
                                this._manager.FrameworkWnd.PersistentManager.DelUserInfoById(text); 
                                this._manager.FrameworkWnd.PersistentManager.DelPortraitsById(text); 
                                this._manager.FrameworkWnd.PersistentManager.DelPluginsCfgById(text); 
                                this._manager.FrameworkWnd.PersistentManager.DelPortraitsById(text); 
                            } 
                        } 
                    } 
                } 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception); 
            } 
        } 
 
        private void llForgetPass_LinkClicked(object sender, EventArgs e) 
        { 
            try 
            { 
                SetPasswordWizard form = new SetPasswordWizard(this._manager.FrameworkWnd); 
                form.CurrentMobileNo = this.CurrentId; 
                ControlHelper.ShowDialogCenterOnParent(form, this, true); 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception); 
            } 
        } 
 
        private void llNetSetting_LinkClicked(object sender, EventArgs e) 
        { 
            try 
            { 
                this._manager.FrameworkWnd.ShowOptions("SsNet"); 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception); 
            } 
        } 
 
        private void llProvisioning_Click(object sender, EventArgs e) 
        { 
            try 
            { 
                this._manager.Register(); 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception); 
            } 
        } 
 
        private void llReconnectAtOnce_Click(object sender, EventArgs e) 
        { 
            this.autoReconnect.ConnectNow(); 
        } 
 
        internal void LoadUserAccounts() 
        { 
            this.cmbId.Items.Clear(); 
            try 
            { 
                string[] ids = UserAccounts.EnumAccounts(); 
                SortIds(ids); 
                this.cmbId.Items.AddRange(ids); 
                this.cmbId.Text = UserAccounts.LatestId; 
                this.TryFillRelatedInfo(); 
            } 
            catch (Exception exception) 
            { 
                ClientLogger.WriteGeneral(exception.ToString()); 
            } 
        } 
 
        private void MainWindow_Activated(object sender, EventArgs e) 
        { 
            try 
            { 
                if (base.Visible) 
                { 
                    this.cmbId.Focus(); 
                } 
            } 
            catch 
            { 
            } 
        } 
 
        protected override void OnControlAdded(ControlEventArgs e) 
        { 
            e.Control.KeyPress += new KeyPressEventHandler(this.Child_KeyPress); 
            base.OnControlAdded(e); 
        } 
 
        protected override void OnControlRemoved(ControlEventArgs e) 
        { 
            e.Control.KeyPress -= new KeyPressEventHandler(this.Child_KeyPress); 
            base.OnControlRemoved(e); 
        } 
 
        protected override void OnKeyPress(KeyPressEventArgs e) 
        { 
            this.InnerOnKeyPress(e); 
            base.OnKeyPress(e); 
        } 
 
        protected override void OnPaint(PaintEventArgs e) 
        { 
            base.OnPaint(e); 
            using (Pen pen = new Pen(Color.Gray)) 
            { 
                pen.DashStyle = DashStyle.Dot; 
                e.Graphics.DrawLine(pen, new System.Drawing.Point(5, 0x24), new System.Drawing.Point(base.Width - 5, 0x24)); 
                e.Graphics.DrawLine(pen, new System.Drawing.Point(5, this.llNetSetting.Bottom + 7), new System.Drawing.Point(base.Width - 5, this.llNetSetting.Bottom + 7)); 
            } 
        } 
 
        private void rbPrivate_CheckedChanged(object sender, EventArgs e) 
        { 
            this._causedByUser = false; 
            this.cbSaveAccount.Checked = true; 
            this._causedByUser = true; 
            this._manager.MIOfflineLoginVisible(this.rbPrivate.Checked); 
        } 
 
        private void rbPublic_CheckedChanged(object sender, EventArgs e) 
        { 
            this.EnableControls(this.cmbId.Enabled); 
            if (this.rbPublic.Checked) 
            { 
                this._causedByUser = false; 
                this.cbSaveAccount.Checked = false; 
                this.cbSavePassword.Checked = false; 
                this.cbSaveAccount.Checked = false; 
                this._causedByUser = true; 
                if (this._initPresence == MainPresence.OfflineLogin) 
                { 
                    this.InitStatus.OnlineStatusText = MainPresenceHelper.MainPresence2Str(MainPresence.Online); 
                    this._initPresence = MainPresence.Online; 
                } 
            } 
        } 
 
        private void RearrangeControls() 
        { 
            base.SuspendLayout(); 
            try 
            { 
                int num2; 
                int y = 50; 
                Size clientSize = base.ClientSize; 
                this.lblWelcome.Location = new System.Drawing.Point(11, 14); 
                this.bDisplayHelp.Location = new System.Drawing.Point((base.Width - this.bDisplayHelp.Width) - 11, 12); 
                bool flag = clientSize.Height >= this.HeightShowPortrait; 
                bool flag2 = clientSize.Width >= this.WidthShowProvisioning; 
                bool flag3 = clientSize.Height >= this.HeightShowSaveInfo; 
                bool flag4 = clientSize.Height >= this.HeightShowButton; 
                this.pbPortrait.Visible = flag; 
                this.pnPortrait.Visible = flag; 
                this.InitStatus.Visible = flag; 
                this.llProvisioning.Visible = flag2; 
                this.llForgetPass.Visible = flag2; 
                this.cbAutoLogin.Visible = flag3; 
                this.llEraseInfo.Visible = flag3 && flag2; 
                this.cbSaveAccount.Visible = false; 
                this.cbSavePassword.Visible = flag3; 
                this.rbPrivate.Visible = flag3; 
                this.rbPublic.Visible = flag3; 
                this.btnLogin.Visible = flag4; 
                if (flag) 
                { 
                    num2 = (clientSize.Width - this.pbPortrait.Width) / 2; 
                    this.pbPortrait.SetBounds(num2, y, 0, 0, BoundsSpecified.Location); 
                    this.pnPortrait.Location = new System.Drawing.Point((clientSize.Width - this.pnPortrait.Width) / 2, this.pbPortrait.Top - 8); 
                    y = this.pbPortrait.Bottom + 50; 
                } 
                num2 = 0x18; 
                int num3 = clientSize.Width - 0x18; 
                int width = num3 - 0x18; 
                if (flag2) 
                { 
                    width -= 5 + this.WidthMaxProvisioning; 
                } 
                if (width > 160) 
                { 
                    int num7 = (width - 160) / 2; 
                    num2 += num7; 
                    num3 -= num7; 
                    width = 160; 
                } 
                int num8 = num2; 
                int num9 = y - 6; 
                int num4 = y; 
                this.cmbId.SetBounds(num2, num4 - 6, width, 0, BoundsSpecified.Width | BoundsSpecified.Location); 
                if (num2 != this.cmbId.Left) 
                { 
                    win32api_wrapper.MoveWindow(this.cmbId.Handle, num2, num4 - 6, width, this.cmbId.Height, true); 
                } 
                y = ((num9 + this.cmbId.Height) + 6) + 1; 
                int num5 = y; 
                this.tbPassword.SetBounds(num2, num5, width, 0, BoundsSpecified.Width | BoundsSpecified.Location); 
                y = this.tbPassword.Bottom + 15; 
                this.InitStatus.SetBounds(this.pbPortrait.Right - this.InitStatus.Width, this.pbPortrait.Bottom + 3, 0, 0, BoundsSpecified.Location); 
                if (flag2) 
                { 
                    num2 += width + 5; 
                    this.llProvisioning.SetBounds(num2, num9 + ((this.cmbId.Height - this.llProvisioning.Height) / 2), 0, 0, BoundsSpecified.Location); 
                    this.llForgetPass.SetBounds(num2, this.tbPassword.Top + ((this.tbPassword.Height - this.llForgetPass.Height) / 2), 0, 0, BoundsSpecified.Location); 
                } 
                if (flag4) 
                { 
                    y = this.tbPassword.Bottom + 0x24; 
                    num2 = num8; 
                    int num10 = (num2 + ((int) ((num3 - num2) * 0.5))) - (this.btnLogin.Width / 2); 
                    num2 = (num3 - 0x18) - this.btnLogin.Width; 
                    if (num10 < num2) 
                    { 
                        num2 = num10; 
                    } 
                    this.lblStep.SetBounds(num2, (y - this.pbProgress.Height) - 3, 0, 0, BoundsSpecified.Location); 
                    y += (this.tbPassword.Height + 3) + 3; 
                    this.btnLogin.SetBounds(num2 - 5, y, 0, 0, BoundsSpecified.Location); 
                    this.pbProgress.Location = new System.Drawing.Point(((base.Width - this.pbProgress.Width) / 2) - 5, (y - this.pbProgress.Height) - 3); 
                    y = (this.btnLogin.Bottom + 3) + 3; 
                    num2 += (this.btnLogin.Width - this.llNetSetting.Width) / 2; 
                    this.llNetSetting.SetBounds(num2, y, 0, 0, BoundsSpecified.Location); 
                    this.llReconnectAtOnce.SetBounds(num2, y, 0, 0, BoundsSpecified.Location); 
                } 
                if (flag3) 
                { 
                    num2 = num8 + 0x18; 
                    y = clientSize.Height - this.cbAutoLogin.Height; 
                    this.cbSaveAccount.SetBounds(num2, y, 0, 0, BoundsSpecified.Location); 
                    y -= this.cbSavePassword.Height + 3; 
                    this.cbAutoLogin.SetBounds(num2, y, 0, 0, BoundsSpecified.Location); 
                    y -= this.cbSaveAccount.Height + 3; 
                    this.cbSavePassword.SetBounds(num2, y, 0, 0, BoundsSpecified.Location); 
                    num2 = num8; 
                    y -= this.rbPrivate.Height + 3; 
                    this.rbPrivate.SetBounds(num2, y, 0, 0, BoundsSpecified.Location); 
                    y -= this.rbPublic.Height + 3; 
                    this.rbPublic.SetBounds(num2, y, 0, 0, BoundsSpecified.Location); 
                    if (flag2) 
                    { 
                        this.llEraseInfo.SetBounds(this.rbPrivate.Right + 20, this.rbPrivate.Top + 3, 0, 0, BoundsSpecified.Location); 
                        this.llEraseInfo.Visible = this.llEraseInfo.Right < (base.Width - 0x18); 
                    } 
                } 
            } 
            catch 
            { 
            } 
            finally 
            { 
                base.ResumeLayout(false); 
            } 
        } 
 
        private void ResetCheckBox() 
        { 
            this.rbPrivate.Checked = true; 
            this.cbSaveAccount.Checked = true; 
            this.cbSavePassword.Checked = true; 
            this.cbAutoLogin.Checked = true; 
        } 
 
        private void ShowErrorTip(string text, Control ctrl) 
        { 
            if (ctrl is TextBoxBase) 
            { 
                ((TextBoxBase) ctrl).SelectAll(); 
            } 
            else if (ctrl is ComboBox) 
            { 
                ((ComboBox) ctrl).SelectAll(); 
            } 
            ctrl.Focus(); 
            BalloonHelper.ShowBallon(ctrl, text, StringTable.User.MsgErrorTitle, ToolTipIcon.Error, new System.Drawing.Point(10, 5), 0x7d0); 
        } 
 
        private void ShowNetworkSetting(bool show) 
        { 
            this.llNetSetting.Visible = show; 
            this.llReconnectAtOnce.Visible = !show && NetworkInterface.GetIsNetworkAvailable(); 
        } 
 
        private static void SortIds(string[] ids) 
        { 
            int length = ids.Length; 
            for (int i = 0; i < (length - 1); i++) 
            { 
                int num1 = ids[i].Length; 
                for (int j = i + 1; j < length; j++) 
                { 
                    if (CompareIds(ids[i], ids[j]) > 0) 
                    { 
                        string str = ids[i]; 
                        ids[i] = ids[j]; 
                        ids[j] = str; 
                    } 
                } 
            } 
        } 
 
        private void StartReconnect() 
        { 
            if (this.autoReconnect.NextInterval > 0) 
            { 
                ClientLogger.WriteGeneral("开始自动重连!"); 
                this._manager.CurrentUser.Status = UserAccountStatus.WaitReconnect; 
                this.autoReconnect.StartTimer(); 
            } 
        } 
 
        private void tbPassword_TextChanged(object sender, EventArgs e) 
        { 
            try 
            { 
                this.EnableControls(this.cmbId.Enabled); 
            } 
            catch 
            { 
            } 
        } 
 
        private void TryAutoLogin() 
        { 
            if ((this.cbAutoLogin.Checked && (this.cmbId.Text.Length > 0)) && (this.tbPassword.Text.Length > 0)) 
            { 
                this.DoLogin(true); 
            } 
        } 
 
        private void TryFillRelatedInfo() 
        { 
            try 
            { 
                this._causedByUser = false; 
                base.SuspendLayout(); 
                this.HideErrorTip(); 
                string text = this.cmbId.Text; 
                UserAccounts.AccountData account = UserAccounts.GetAccount(text); 
                bool flag = null != account; 
                this.TryLoadPortrait(flag ? account.Id : null); 
                if (flag) 
                { 
                    this.rbPrivate.Checked = true; 
                    this.cbSaveAccount.Checked = true; 
                    this.tbPassword.Text = account.Password; 
                    bool flag2 = !string.IsNullOrEmpty(account.Password); 
                    this.cbSavePassword.Checked = flag2; 
                    this.cbAutoLogin.Checked = flag2 && account.AutoLogin; 
                    try 
                    { 
                        this._initPresence = (MainPresence) Enum.Parse(typeof(MainPresence), account.PresenceValue.ToString()); 
                    } 
                    catch (Exception exception) 
                    { 
                        ClientLogger.WriteException("设置_initPresence 执行出错", exception); 
                    } 
                } 
                else if (text.Length <= 0) 
                { 
                    this.tbPassword.Text = string.Empty; 
                } 
                else if (IsIdCompleted(text) || this.tbPassword.AutoInputed) 
                { 
                    this.tbPassword.Text = string.Empty; 
                } 
                this.InitStatus.OnlineStatusText = MainPresenceHelper.MainPresence2Str(this._initPresence); 
            } 
            catch (Exception exception2) 
            { 
                ClientLogger.WriteException("TryFillRelatedInfo 方法执行出错", exception2); 
            } 
            finally 
            { 
                base.ResumeLayout(false); 
                this._causedByUser = true; 
            } 
        } 
 
        private void TryLoadPortrait(string id) 
        { 
            Image objB = null; 
            long mappedSid; 
            if (!string.IsNullOrEmpty(id) && long.TryParse(id, out mappedSid)) 
            { 
                if (mappedSid >= 0x2540be400L) 
                { 
                    mappedSid = UserAccounts.GetMappedSid(mappedSid.ToString()); 
                } 
                if (mappedSid > 0L) 
                { 
                    IicUri uri = IicUri.CreateSidUri((long) ((int) mappedSid)); 
                    try 
                    { 
                        if (this._manager.CurrentUser != null) 
                        { 
                            int num2; 
                            this._manager.FrameworkWnd.PersistentManager.LoadById(mappedSid); 
                            objB = this._manager.FrameworkWnd.PersistentManager.LoadPortrait(uri, out num2); 
                        } 
                    } 
                    catch 
                    { 
                    } 
                } 
            } 
            if (objB == null) 
            { 
                objB = this.DefaultPortrait; 
            } 
            if (!object.Equals(this._curPortrait, objB)) 
            { 
                this._curPortrait = objB; 
                ControlHelper.FadeinImage(this.pbPortrait, objB); 
            } 
        } 
 
        private void UpdateStepLabelText(string newLabelText) 
        { 
            this.lblStep.Text = newLabelText; 
        } 
 
        public bool AutoLogin 
        { 
            get 
            { 
                return this.cbAutoLogin.Checked; 
            } 
            set 
            { 
                this.cbAutoLogin.Checked = value; 
            } 
        } 
 
        public string CurrentId 
        { 
            get 
            { 
                return this.cmbId.Text; 
            } 
            set 
            { 
                if (value != string.Empty) 
                { 
                    this.cmbId.Text = value; 
                } 
            } 
        } 
 
        public Image DefaultPortrait 
        { 
            get 
            { 
                if (this._defaultPortrait == null) 
                { 
                    this._defaultPortrait = ImpsPortrait.GetDefaultPortrait(0x60, 0x60); 
                } 
                return this._defaultPortrait; 
            } 
        } 
 
        public string InitStatusText 
        { 
            get 
            { 
                return this.InitStatus.OnlineStatusText; 
            } 
        } 
 
        private int WidthMaxProvisioning 
        { 
            get 
            { 
                return Math.Max(this.llProvisioning.Width, this.llForgetPass.Width); 
            } 
        } 
    } 
}