Esempio n. 1
0
 /// <summary>
 /// Add allowed user button event
 /// </summary>
 /// <param name="username">Username</param>
 /// <returns>Task</returns>
 public async Task AddAllowedUsersButton(object username)
 {
     if (SelectedTest != null)
     {
         if (AllowedUsers.Contains(username as string))
         {
             return;
         }
         if (!(await TryAddAllowedUser((username as string), SelectedTest)))
         {
             if (await _tokenHandler.TryRefreshTokenAsync())
             {
                 await TryAddAllowedUser((username as string), SelectedTest);
             }
             else
             {
                 MessageBox.Show(LocalizationService.GetLocalizedValue <string>("TokenExpired"));
                 RegionManager.RequestNavigate(StaticProperties.ContentRegion, "AuthorizationWindow");
             }
         }
     }
     else
     {
         MessageBox.Show("Choose test");
     }
 }
 public static bool IsAllowed(string userName) => AllowedUsers.Contains(userName);