private void HandleLogonClick(object sender, RoutedEventArgs e) { // in a proper implementation, it's better to setup an MVVM and have this handled // in the view-model... // get a proxy - a more sophisticated approach is to use an IoC container here // like TinyIoC... ILogonServiceProxy proxy = new LogonServiceProxy(); proxy.Logon(this.Username, this.Password, (result) => { // show... if (result.IsOk) this.ShowAlert("Logon OK: " + result.LogonToken); else this.ShowAlert(result.Error); }); }
private void HandleLogonClick(object sender, RoutedEventArgs e) { // in a proper implementation, it's better to setup an MVVM and have this handled // in the view-model... // get a proxy - a more sophisticated approach is to use an IoC container here // like TinyIoC... ILogonServiceProxy proxy = new LogonServiceProxy(); this.EnterBusy(); proxy.Logon(this.Username, this.Password, (result) => { // show... if (result.IsOk) { // tell the service that we're logged on... AppRuntime.Logon(this.Username, result.LogonToken); // go to the "reports" page... but careful, as we may be on a different thread... this.SafeNavigate(typeof(ReportsPage)); } else this.ShowAlert(result.Error); // stop... this.ExitBusy(); }); }