Beispiel #1
0
 private void connect()
 {
     try
     {
         authClient_ = new AuthentificationService.AuthentificationDomainServiceSoapClient();
         AuthentificationService.QueryResultOfUser result = authClient_.Login(login_, password_, true, "");
         if (result.RootResults != null && result.RootResults.Count() > 0)
         {
             currentUser_ = result.RootResults.First();
             Debug.WriteLine("You're logged in ! " + currentUser_.Name);
             FeedsVM.CurrentUser = currentUser_;
             FeedsVM.init();
             LoginViewVisibility = Visibility.Hidden;
             FeedsViewVisibility = Visibility.Visible;
         }
         else
         {
             MessageBox.Show("Wrong password or bad login. Please try again.");
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("Login failure : " + e.Message);
     }
 }
Beispiel #2
0
 private void authClient_LoginCompleted(object sender, AuthentificationService.LoginCompletedEventArgs e)
 {
     try
     {
         if (!e.Cancelled)
         {
             if (e.Error == null)
             {
                 if (e.Result.RootResults != null && e.Result.RootResults.Count > 0)
                 {
                     AuthentificationService.AuthentificationDomainServiceSoapClient authClient = (AuthentificationService.AuthentificationDomainServiceSoapClient)sender;
                     currentUser_ = e.Result.RootResults.First();
                     cookie_      = authClient.CookieContainer;
                     Debug.WriteLine("Your logged in ! " + currentUser_.Name);
                     FeedsVM.CurrentUser = currentUser_;
                     FeedsVM.MainVM      = this;
                     FeedsVM.init();
                     NavigationService.Navigate(new Uri("/View/RssReader.xaml", UriKind.Relative));
                 }
                 else
                 {
                     System.Windows.MessageBox.Show("An error occured please try again.");
                 }
             }
             else
             {
                 Debug.WriteLine("Error : " + e.Error.Message);
                 System.Windows.MessageBox.Show("An error occured please try again.");
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }