示例#1
0
        private bool CheckPassword(PassItem pass)
        {
            if (Contains(pass))
            {
                MessageBox.Show("Contains this id");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(pass.Title))
            {
                MessageBox.Show("Title is empty");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(pass.Login) && pass.EnterWithLogin)
            {
                MessageBox.Show("No login set to \"Enter with login\"");
                return(false);
            }

            /*  if (string.IsNullOrWhiteSpace(pass.Pass))
             * {
             *    MessageBox.Show("Password is empty");
             *    return false;
             * }
             */

            /* if (string.IsNullOrWhiteSpace(pass.Description))
             * {
             *   MessageBox.Show("Description is empty");
             *   return false;
             * }*/
            return(true);
        }
示例#2
0
        private static void SwapItems(PassItem pass1, PassItem pass2)
        {
            var tempId = pass1.Id;

            pass1.Id = pass2.Id;
            pass2.Id = tempId;
        }
示例#3
0
        private bool CheckPassword(PassItem pass)
        {
            if (Contains(pass))
            {
                MessageBox.Show("Contains this id");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(pass.Title))
            {
                MessageBox.Show("Title is empty");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(pass.Login))
            {
                MessageBox.Show("Login is empty");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(pass.Pass))
            {
                MessageBox.Show("Password is empty");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(pass.Description))
            {
                MessageBox.Show("Description is empty");
                return(false);
            }
            return(true);
        }
示例#4
0
 public EditPasswordForm(PassItem pass)
 {
     InitializeComponent();
     if (pass == null)
     {
         pass = new PassItem();
     }
     _passItem = pass;
 }
示例#5
0
文件: PassItem.cs 项目: mihver1/PSD
 public void InitFromPass(PassItem backup)
 {
     this.Id = backup.Id;
     this.Title = backup.Title;
     this.Login = backup.Login;
     this.EnterWithLogin = backup.EnterWithLogin;
     this.Pass = backup.Pass;
     this.Description = backup.Description;
 }
示例#6
0
 public void InitFromPass(PassItem backup)
 {
     this.Id             = backup.Id;
     this.Title          = backup.Title;
     this.Login          = backup.Login;
     this.EnterWithLogin = backup.EnterWithLogin;
     this.Pass           = backup.Pass;
     this.Description    = backup.Description;
 }
示例#7
0
 private bool EditPassword(PassItem password)
 {
     do
     {
         var editPassForm = new EditPasswordForm(password);
         editPassForm.ShowDialog();
         if (!editPassForm.Confirmed)
         {
             return(false); //was cancelled
         }
     } while (!CheckPassword(password));
     return(true);
 }
示例#8
0
        private void btnAddPass_Click(object sender, EventArgs e)
        {
            var selectedIndex = lstPasses.SelectedIndex;

            var newPassword = new PassItem();

            if (!EditPassword(newPassword))
            {
                return;
            }

            _rootPassGroup.AddPass(newPassword);
            if (selectedIndex != -1 && selectedIndex != lstPasses.Items.Count - 1)
            {
                while (newPassword.Id > ((PassItem)lstPasses.SelectedItem).Id)
                {
                    _rootPassGroup.Passwords.MoveUp(newPassword);
                }
                _rootPassGroup.Passwords.MoveDown(newPassword);
            }
            RegisterChange();
            RefillPasswordsList();
        }
示例#9
0
 private bool Contains(PassItem pass)
 {
     return(_connections.PcBase.Base.PassGroup.Any(a => a.Id == pass.Id && a != pass));
 }
示例#10
0
文件: PSDForm.cs 项目: mihver1/PSD
 private static void SwapItems(PassItem pass1, PassItem pass2)
 {
     var tempId = pass1.Id;
     pass1.Id = pass2.Id;
     pass2.Id = tempId;
 }
示例#11
0
文件: PSDForm.cs 项目: mihver1/PSD
 private bool EditPassword(PassItem password)
 {
     do
     {
         var editPassForm = new EditPasswordForm(password);
         editPassForm.ShowDialog();
         if (!editPassForm.Confirmed)
             return false; //was cancelled
     } while (!CheckPassword(password));
     return true;
 }
示例#12
0
文件: PSDForm.cs 项目: mihver1/PSD
 private bool Contains(PassItem pass)
 {
     return _connections.PcBase.Base.Passwords.Any(a => a.Id == pass.Id && a != pass);
 }
示例#13
0
文件: PSDForm.cs 项目: mihver1/PSD
        private bool CheckPassword(PassItem pass)
        {
            if (Contains(pass))
            {
                MessageBox.Show("Contains this id");
                return false;
            }

            if (string.IsNullOrWhiteSpace(pass.Title))
            {
                MessageBox.Show("Title is empty");
                return false;
            }

            if (string.IsNullOrWhiteSpace(pass.Login))
            {
                MessageBox.Show("Login is empty");
                return false;
            }

            if (string.IsNullOrWhiteSpace(pass.Pass))
            {
                MessageBox.Show("Password is empty");
                return false;
            }

            if (string.IsNullOrWhiteSpace(pass.Description))
            {
                MessageBox.Show("Description is empty");
                return false;
            }
            return true;
        }