private void Login(object parameter)
        {
            //var stringList = parameter as Users;
            //clearTextPassword = stringList.pass.Password;
            //Username = stringList.login;

            db.User.Load();
            UserSource = db.User.Local;
            PasswordBox passwordBox       = parameter as PasswordBox;
            string      clearTextPassword = passwordBox.Password;

            //{
            if ((!LogIned && tries <= 3))
            {
                foreach (User p in UserSource)
                {
                    if ((p.Login == Username) && (p.Password == clearTextPassword))
                    {
                        LogIned = true;
                        MessageBox.Show("Добро пожаловать, " + p.Login + "!");
                        Window2 h = new Window2(p.Id, db);
                        WindowManager.CloseWindow(ViewID);
                        h.Show();
                    }
                }
                if (!LogIned)
                {
                    tries++;
                    MessageBox.Show("Логин и пароль были введены неправильно!");
                }
            }
            //} while (!LogIned && tries <=3);
            if (LogIned == false && tries == 3)
            {
                MessageBox.Show("Вы израсходовали все попытки!");
                System.Windows.Application.Current.Shutdown();
            }
        }
        private void Registration(object parameter)
        {
            bool        exists            = false;
            PasswordBox passwordBox       = parameter as PasswordBox;
            string      clearTextPassword = passwordBox.Password;

            db.User.Load();
            UserSource = db.User.Local;


            foreach (User p in UserSource)
            {
                if (p.Login == Username)
                {
                    exists = true;
                }
            }
            if (exists)
            {
                MessageBox.Show("Выбранный вами логин уже существует!");
            }
            else
            {
                User newUser = new User();
                newUser.Login    = Username;
                newUser.Password = clearTextPassword;
                db.User.Add(newUser);
                db.SaveChanges();
                db.User.Load();
                UserSource = db.User.Local;
                MessageBox.Show("Добро пожаловать, " + UserSource[UserSource.IndexOf(newUser)].Login + "!");
                Window2 h = new Window2(UserSource[UserSource.IndexOf(newUser)].Id, db);
                WindowManager.CloseWindow(ViewID);
                h.Show();
            }
        }