Ejemplo n.º 1
0
        private void dgvPasswordList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                PasswordDetailLogin pl       = new PasswordDetailLogin();
                PasswordDetail      plDetail = new PasswordDetail();

                string rowCustomPassword = dgvPasswordList.Rows[e.RowIndex].Cells["CustomPassword"].Value.ToString();

                rowID             = int.Parse(dgvPasswordList.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                rowTitle          = dgvPasswordList.Rows[e.RowIndex].Cells["title"].Value.ToString();
                rowPassword       = dgvPasswordList.Rows[e.RowIndex].Cells["Password"].Value.ToString();
                rowCustomPassword = dgvPasswordList.Rows[e.RowIndex].Cells["CustomPassword"].Value.ToString();

                if (rowCustomPassword != string.Empty)
                {
                    pl.ShowDialog();
                }
                else
                {
                    PasswordDetail.rowID            = rowID;
                    plDetail.txtTitle.Text          = rowTitle;
                    plDetail.txtPassword.Text       = rowPassword;
                    plDetail.txtCustomPassword.Text = rowCustomPassword;
                    plDetail.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                dgvPasswordList.ClearSelection();
            }
        }
        private void btnShow_Click(object sender, EventArgs e)
        {
            PasswordDetail pDetail = new PasswordDetail();

            int rowID = PasswordList.rowID;

            string rowTitle          = PasswordList.rowTitle;
            string rowPassword       = PasswordList.rowPassword;
            string rowCustomPassword = txtPasswordProtected.Text;

            bool isValid = p.CustomIsValid(rowID, rowCustomPassword);

            if (isValid)
            {
                PasswordDetail.rowID           = rowID;
                pDetail.txtTitle.Text          = rowTitle;
                pDetail.txtPassword.Text       = rowPassword;
                pDetail.txtCustomPassword.Text = rowCustomPassword;
                pDetail.ShowDialog();
                Close();
            }
            else
            {
                lblPasswordTrue.ForeColor = Color.Red;
                lblPasswordTrue.Text      = "Wrong Password!";
            }
        }
Ejemplo n.º 3
0
        private void cntRightMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            clickedItem = e.ClickedItem.Text;

            cntRightMenu.Visible = false;

            if (clickedItem.ToLower().Contains("delete"))
            {
                var isOk = MessageBox.Show("Are you sure you want to delete?", "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (isOk == DialogResult.Yes)
                {
                    p.DeleteData(deletedRow);
                    dgvPasswordList.DataSource = p.GetDataTable();
                }
            }
            else
            {
                PasswordDetailLogin pl       = new PasswordDetailLogin();
                PasswordDetail      plDetail = new PasswordDetail();
                int    rowInd            = dgvPasswordList.SelectedRows[0].Index;
                string rowCustomPassword = dgvPasswordList.Rows[rowInd].Cells["CustomPassword"].Value.ToString();

                rowID             = int.Parse(dgvPasswordList.Rows[rowInd].Cells["ID"].Value.ToString());
                rowTitle          = dgvPasswordList.Rows[rowInd].Cells["title"].Value.ToString();
                rowPassword       = dgvPasswordList.Rows[rowInd].Cells["Password"].Value.ToString();
                rowCustomPassword = dgvPasswordList.Rows[rowInd].Cells["CustomPassword"].Value.ToString();

                if (rowCustomPassword != string.Empty)
                {
                    pl.ShowDialog();
                }
                else
                {
                    PasswordDetail.rowID            = rowID;
                    plDetail.txtTitle.Text          = rowTitle;
                    plDetail.txtPassword.Text       = rowPassword;
                    plDetail.txtCustomPassword.Text = rowCustomPassword;
                    plDetail.ShowDialog();
                }
            }
            dgvPasswordList.ClearSelection();
        }