Ejemplo n.º 1
0
        private void ShowLoginForm()
        {
            ConfirmForm passwordForm = new ConfirmForm("请登录", "请输入登录密码", "", p =>
            {
                try
                {
                    repository = Factory.CreatePassworkProjectRepository(p);
                    if (!repository.VerificationPassword(p))
                    {
                        MessageBox.Show("密码不正确!", "温馨提示");
                        return(false);
                    }
                    isLogin = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "温馨提示");
                    return(false);
                }
                ProjectList.Items.AddRange(repository.GetPassworkProjectNameList().ToArray());
                return(true);
            })
            {
                TopMost = true,
            };

            passwordForm.Show();
        }
Ejemplo n.º 2
0
        private void toolStripButton_AddNew_Click(object sender, EventArgs e)
        {
            if (!isLogin)
            {
                ShowLoginForm();
                return;
            }
            ConfirmForm confirmForm = new ConfirmForm("添加密码项目", "请输入密码项目名称", "", p =>
            {
                if (p.Length <= 0)
                {
                    MessageBox.Show("项目名称不能为空!", "温馨提示");
                    return(false);
                }
                try
                {
                    SelectPassworkProject = repository.CreatePassworkProject(p, String.Empty);
                    ProjectList.Items.Add(p);
                    ProjectList.SelectedItem = p;
                    ProjectDetailAction      = DetailAction.Edit;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "温馨提示");
                    return(false);
                }
                return(true);
            });

            confirmForm.Show();
        }
Ejemplo n.º 3
0
        private void toolStripButton_AddSafetyProblems_Click(object sender, EventArgs e)
        {
            if (ProjectDetailAction == DetailAction.Display)
            {
                MessageBox.Show("预览状态,不能新增安全问题", "温馨提示");
                return;
            }
            if (SelectPassworkProject == null)
            {
                MessageBox.Show("密码项目不存在", "温馨提示");
                return;
            }
            ConfirmForm confirmForm = new ConfirmForm("添加安全问题", "请输入安全问题", "", p =>
            {
                if (p.Length <= 0)
                {
                    MessageBox.Show("安全问题不能为空!", "温馨提示");
                    return(false);
                }
                try
                {
                    if (SelectPassworkProject == null)
                    {
                        return(false);
                    }
                    SelectPassworkProject.AddSafetyProblem(p);
                    AddSafetyProblemChildControl(panel_SafetyProblems, p);

                    if (!groupBox_SafetyProblems.Visible)
                    {
                        groupBox_SafetyProblems.Visible = true;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "温馨提示");
                    return(false);
                }

                return(true);
            });

            confirmForm.Show();
        }
Ejemplo n.º 4
0
        private void toolStripButton_AddExtendField_Click(object sender, EventArgs e)
        {
            if (ProjectDetailAction == DetailAction.Display)
            {
                MessageBox.Show("预览状态,不能新增扩展字段", "温馨提示");
                return;
            }

            if (SelectPassworkProject == null)
            {
                MessageBox.Show("密码项目不存在", "温馨提示");
                return;
            }
            ConfirmForm confirmForm = new ConfirmForm("添加扩展字段", "请输入扩展字段名称", "", p =>
            {
                if (p.Length <= 0)
                {
                    MessageBox.Show("扩展字段名称不能为空!", "温馨提示");
                    return(false);
                }
                try
                {
                    if (SelectPassworkProject == null)
                    {
                        return(false);
                    }
                    SelectPassworkProject.AddExtensionField(p);
                    AddExtendFieldChildControl(panel_ExtensionFields, p);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "温馨提示");
                    return(false);
                }
                if (!groupBox_ExtendField.Visible)
                {
                    groupBox_ExtendField.Visible = true;
                }

                return(true);
            });

            confirmForm.Show();
        }
Ejemplo n.º 5
0
        private void toolStripButton_AddPassrowdItem_Click(object sender, EventArgs e)
        {
            if (ProjectDetailAction == DetailAction.Display)
            {
                MessageBox.Show("预览状态,不能新增密码", "温馨提示");
                return;
            }
            if (SelectPassworkProject == null)
            {
                MessageBox.Show("密码项目不存在", "温馨提示");
                return;
            }
            ConfirmForm confirmForm = new ConfirmForm("添加密码", "请输入密码名称", "", p =>
            {
                if (p.Length <= 0)
                {
                    MessageBox.Show("密码名称不能为空!", "温馨提示");
                    return(false);
                }
                try
                {
                    if (SelectPassworkProject == null)
                    {
                        return(false);
                    }
                    SelectPassworkProject.AddPasswordItem(p);
                    AddPassrowdItemChildControl(panel_PasswordItems, p);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "温馨提示");
                    return(false);
                }
                return(true);
            });

            confirmForm.Show();
        }