private async void Button_Click(object sender, RoutedEventArgs e)
 {
     var flag = false;
     var users = await UserJson.Get<User>(UrlUser);
     if (users == null)
     {
         var wind = new Window1();
         wind.Show();
     }
     else
     foreach (var user in users)
     {
         flag = false;
         if (LoginBox.Text == user.login && PasswordBox.Text == user.password &&
             user.role.name == "ROLE_ADMIN")
         {
             var admin = new AdminWindow();
             admin.Show();
             Close();
             break;
         }
         else
         {
             flag = true;
         }
     }
     if (flag)
     {
         var authErr = new ErrorAuthorization();
         authErr.Show();
     }
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     List<User> users = new List<User>();
     bool flag;
     UserJson.GetData(out users, out flag);
     foreach (var user in users)
     {
         if (LoginBox.Text == user.login && PasswordBox.Text == user.password && user.role == "admin")
         {
             AdminWindow admin = new AdminWindow();
             admin.Show();
             this.Close();
             break;
         }
         else
         {
             if (flag) break;
             ErrorAuthorization authErr = new ErrorAuthorization();
             authErr.Show();
             break;
         }
     }            
 }