Пример #1
0
 public void Add(TOTP_SecretInfo secinfo)
 {
     this.BaseAdd(secinfo);
 }
Пример #2
0
        private void AddNewAcct(object sender, EventArgs e)
        {
            int iHasError = 1;

            if (null != this._frmAddAcct) {
                if (! this._frmAddAcct.IsDisposed)
                    return;
            }

            TOTP_SecretInfo csTOTPSecret = new TOTP_SecretInfo();

            // Config the first newly created account
            this._frmAddAcct = new SetSecretForm(this);

            while (iHasError == 1) {
                this._frmAddAcct.ShowDialog();

                if (this._rsDialog != DialogResult.Cancel) {
                    csTOTPSecret.ID = this._frmAddAcct.GetAcctID();

                    if (null != this._TOTPAccounts.FindByID(csTOTPSecret.ID)) {
                        // Account name duplicate
                        this._frmAddAcct.SetErrTxt("Account Name exists!");
                    } else {
                        csTOTPSecret.Key = this._frmAddAcct.GetSecretText();
                        csTOTPSecret.CodeLen = Convert.ToInt32(this._frmAddAcct.GetCodeLen());

                        this._frmAddAcct.Dispose();

                        this._TOTPAccounts.Add(csTOTPSecret);

                        this._confApp.Save(ConfigurationSaveMode.Full, true);

                        // Add account menu item
                        int iAcctCnt = this._TOTPAccounts.Count;

                        this._TOTPAccounts[iAcctCnt - 1].MenuItem = this.CreateAcctMenu(csTOTPSecret.ID);

                        this.msTrayIcon.Items.Insert(iAcctCnt,
                                                    this._TOTPAccounts[iAcctCnt - 1].MenuItem);
                        //

                        iHasError = 0;
                    }
                } else {
                    // Form closed
                    iHasError = 0;
                    this._frmAddAcct.Dispose();
                }
            }
        }
Пример #3
0
        private void AddNewAcct(object sender, EventArgs e)
        {
            int iHasError = 1;

            if (null != this._frmAddAcct)
            {
                if (!this._frmAddAcct.IsDisposed)
                {
                    return;
                }
            }

            TOTP_SecretInfo csTOTPSecret = new TOTP_SecretInfo();

            // Config the first newly created account
            this._frmAddAcct = new SetSecretForm(this);

            while (iHasError == 1)
            {
                this._frmAddAcct.ShowDialog();

                if (this._rsDialog != DialogResult.Cancel)
                {
                    csTOTPSecret.ID = this._frmAddAcct.GetAcctID();

                    if (null != this._TOTPAccounts.FindByID(csTOTPSecret.ID))
                    {
                        // Account name duplicate
                        this._frmAddAcct.SetErrTxt("Account Name exists!");
                    }
                    else
                    {
                        csTOTPSecret.Key     = this._frmAddAcct.GetSecretText();
                        csTOTPSecret.CodeLen = Convert.ToInt32(this._frmAddAcct.GetCodeLen());

                        this._frmAddAcct.Dispose();

                        this._TOTPAccounts.Add(csTOTPSecret);

                        this._confApp.Save(ConfigurationSaveMode.Full, true);

                        // Add account menu item
                        int iAcctCnt = this._TOTPAccounts.Count;

                        this._TOTPAccounts[iAcctCnt - 1].MenuItem = this.CreateAcctMenu(csTOTPSecret.ID);

                        //this.msTrayIcon.Items.Insert(iAcctCnt,
                        //                            this._TOTPAccounts[iAcctCnt - 1].MenuItem);
                        //

                        iHasError = 0;
                    }
                }
                else
                {
                    // Form closed
                    iHasError = 0;
                    this._frmAddAcct.Dispose();
                }
            }
        }
Пример #4
0
 public void Add(TOTP_SecretInfo secinfo)
 {
     this.BaseAdd(secinfo);
 }