Exemplo n.º 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);
        }
Exemplo n.º 2
0
        private static void SwapItems(PassItem pass1, PassItem pass2)
        {
            var tempId = pass1.Id;

            pass1.Id = pass2.Id;
            pass2.Id = tempId;
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 public EditPasswordForm(PassItem pass)
 {
     InitializeComponent();
     if (pass == null)
     {
         pass = new PassItem();
     }
     _passItem = pass;
 }
Exemplo n.º 5
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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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();
        }
Exemplo n.º 9
0
 private bool Contains(PassItem pass)
 {
     return(_connections.PcBase.Base.PassGroup.Any(a => a.Id == pass.Id && a != pass));
 }
Exemplo n.º 10
0
 private static void SwapItems(PassItem pass1, PassItem pass2)
 {
     var tempId = pass1.Id;
     pass1.Id = pass2.Id;
     pass2.Id = tempId;
 }
Exemplo n.º 11
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;
 }
Exemplo n.º 12
0
 private bool Contains(PassItem pass)
 {
     return _connections.PcBase.Base.Passwords.Any(a => a.Id == pass.Id && a != pass);
 }
Exemplo n.º 13
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;
        }