1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
public class MainService : IMainService
{
#region Const
const string ServiceConfigurationName = "PersonConfiguration";
#endregion
#region Private members
private readonly PersonServiceClient client;
private readonly IUnityContainer container;
#endregion
public MainService(IUnityContainer container)
{
this.container = container;
this.client = new PersonServiceClient(MainService.ServiceConfigurationName);
this.client = new PersonServiceClient(MainService.ServiceConfigurationName);
client.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(OnLoginCompleted);
}
public void BeginLogin(string userName, string password, ServiceCompleted<User> LoginCompleted)
{
client.LoginAsync(user, password,
new ServiceArgs<User>(LoginCompleted));
}
void OnLoginCompleted(object sender, LoginCompletedEventArgs e)
{
User result = null;
if (e.Error == null)
{
result = e.Result;
}
var arg = e.UserState as ServiceArgs<User>;
arg.Complete(result, e);
}
}
} |
Partager