Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/23/11 04:13:08 (13 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Authentication/AuthenticationClient.cs

    r5533 r5550  
    5151    public void Refresh() {
    5252      OnRefreshing();
    53 
     53      try {
     54        users = CallAuthenticationService<List<User>>(s => s.GetUsers()).OrderBy(x => x.Name);
     55      }
     56      finally {
     57        OnRefreshed();
     58      }
     59    }
     60    public void RefreshAsync(Action<Exception> exceptionCallback) {
    5461      var call = new Func<Exception>(delegate() {
    5562        try {
    56           users = CallAuthenticationService<List<User>>(s => s.GetUsers()).OrderBy(x => x.Name);
    57           return null;
     63          Refresh();
    5864        }
    5965        catch (Exception ex) {
    6066          return ex;
    6167        }
     68        return null;
    6269      });
    6370      call.BeginInvoke(delegate(IAsyncResult result) {
    6471        Exception ex = call.EndInvoke(result);
    65         if (ex != null) ErrorHandling.ShowErrorDialog("Refresh failed.", ex);
    66         OnRefreshed();
     72        if (ex != null) exceptionCallback(ex);
    6773      }, null);
     74    }
     75    #endregion
     76
     77    #region User Methods
     78    public static IEnumerable<User> GetUsers() {
     79      return CallAuthenticationService<List<User>>(s => s.GetUsers()).OrderBy(x => x.Name);
    6880    }
    6981    #endregion
     
    8395
    8496    #region Helpers
    85     private T CallAuthenticationService<T>(Func<IAuthenticationService, T> call) {
     97    private static T CallAuthenticationService<T>(Func<IAuthenticationService, T> call) {
    8698      AuthenticationServiceClient client = ClientFactory.CreateClient<AuthenticationServiceClient, IAuthenticationService>();
    8799      try {
Note: See TracChangeset for help on using the changeset viewer.