private void btnlogIn_Click(object sender, EventArgs e) { if (AccountInfoManager.LogIn(this.cboAccount.Text, this.txtPassword.Text)) { this.DialogResult = System.Windows.Forms.DialogResult.OK; } }
private void Initialize() { try { _accountInfoCollection = AccountInfoManager.GetAccountInfoCollection(); for (int i = 0; i < _accountInfoCollection.Count; i++) { this.cboAccount.Items.Add(_accountInfoCollection[i].Name); } if (_accountInfoCollection.Count > 0) { this.cboAccount.SelectedIndex = 0; } else { this.cboAccount.Text = ResourceHelper.Language.GetString("NoUser"); } LanguageManager.Apply(this); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void panel2_MouseClick(object sender, MouseEventArgs e) { if (++_clickCount >= 2) { //1.0.160818.0800 修改懶人登入方法 if (AccountInfoManager.LogIn(SystemDefine.DEVELOPER_USER_NAME, SystemDefine.DEVELOPER_USER_PASSWORD)) { this.DialogResult = System.Windows.Forms.DialogResult.OK; } } }
private void btnOK_Click(object sender, EventArgs e) { try { AccountInfoManager.SetAccountInfoCollection(_accountInfoCollection); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public static List <AccountInfo> GetAccountInfoCollection() { try { _accountInfoCollection = new List <AccountInfo>(); IniFile iniFile = new IniFile(SystemDefine.SYSTEM_DATA_FOLDER_PATH, "AccountInfo"); int accountInfoCount = iniFile.GetInt32("General", "Count"); if (accountInfoCount > 0) { string key = iniFile.GetString("General", "Key"); for (int i = 0; i < accountInfoCount; i++) { _accountInfoCollection.Add(new AccountInfo() { Name = AESEncryption.AESDecoder(iniFile.GetString("User" + (i + 1).ToString(), "Name", ""), key), Password = AESEncryption.AESDecoder(iniFile.GetString("User" + (i + 1).ToString(), "Password", "0"), key), Level = (AccountLevel)Enum.Parse(typeof(AccountLevel), AESEncryption.AESDecoder(iniFile.GetString("User" + (i + 1).ToString(), "Level", "0"), key)) }); } } else { //v1.0.0.6 新增預設開發者帳號密碼 _accountInfoCollection.Add(new AccountInfo() { Name = SystemDefine.DEVELOPER_USER_NAME, Password = SystemDefine.DEVELOPER_USER_PASSWORD, Level = AccountLevel.Developer }); AccountInfoManager.SetAccountInfoCollection(_accountInfoCollection); GetAccountInfoCollection(); } return(_accountInfoCollection); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); return(_accountInfoCollection); } }
private void Initialize() { try { //1.0.160811.0800 新增使用者權限不得高於當前使用者 foreach (string accountLevelName in Enum.GetNames(typeof(AccountLevel))) { AccountLevel accountLevel = (AccountLevel)Enum.Parse(typeof(AccountLevel), accountLevelName); if ((AccountInfoManager.ActiveAccountLevel) >= accountLevel && (accountLevel != AccountLevel.Developer)) { this.cboAccountLevel.Items.Add(accountLevelName); } } _accountInfoCollection = AccountInfoManager.GetAccountInfoCollection(); RefreshData(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }