public void RequestCredentialsFor(string messagingServiceName, string suggestedUserName, IServiceInformation serviceInformation)
        {
            var username = "";
            var password = "";
            var savePassword = false;

            _Fiber.RunOnMainThread(() =>
                                       {
                                           var userCredentialsViewModel = new UserCredentialsViewModel()
                                                                              {
                                                                                  Caption = messagingServiceName + " Login",
                                                                                  UserName = suggestedUserName
                                                                              };

                                           var dialog = new UserCredentialsWindow
                                                            {
                                                                DataContext = userCredentialsViewModel
                                                            };
                                           var mainWindow = Application.Current.MainWindow;
                                           dialog.Owner = mainWindow;
                                           dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                                           dialog.ShowDialog();
                                           username = userCredentialsViewModel.UserName;
                                           password = userCredentialsViewModel.Password;
                                           savePassword = userCredentialsViewModel.SavePassword;
                                       });

            _CredentialsProvidedObserver.CredentialsProvided(new Credentials()
                                                         {
                                                             UserName = username,
                                                             Password = password,
                                                             ServiceInformation = serviceInformation,
                                                             IsPasswordCachingAllowed = savePassword
                                                         });
        }
        public Credentials GetCredentials(IServiceInformation serviceInformation)
        {
            var username = "";
            var password = "";

            var dispatcher = Dispatcher.FromThread(_mainThread);
            dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
                                                             {
                                                                 var model = new UserCredentialsViewModel()
                                                                 {
                                                                     Caption = serviceInformation.ServiceName + " Login"
                                                                 };
                                                                 var dialog = new UserCredentialsWindow
                                                                     {
                                                                         DataContext = model
                                                                     };
                                                                 var mainWindow = Application.Current.MainWindow;
                                                                 dialog.Owner = mainWindow;
                                                                 dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                                                                 dialog.ShowDialog();
                                                                 username = model.UserName;
                                                                 password = model.Password;
                                                             }));

            return new Credentials()
                       {
                           UserName = username,
                           Password = password,
                           ServiceInformation = serviceInformation
                       };
        }
 public void CredentialsRequested(IServiceInformation serviceInformation)
 {
     if (_Contains(serviceInformation.ServiceID))
     {
         var cachedCredential = _Get(serviceInformation);
         _CredentialsProvidedObserver.CredentialsProvided(cachedCredential);
     }
     else
     {
         _credentialsRequestedObserver.CredentialsRequested(serviceInformation);
     }
 }
 public Credentials GetCredentials(IServiceInformation serviceInformation)
 {
     return new Credentials()
                {
                    Password = "******",
                    UserName = "******",
                    ServiceInformation = serviceInformation
                };
 }
 public static bool AreEqual(IServiceInformation a, IServiceInformation b)
 {
     if (ReferenceEquals(null, a) || ReferenceEquals(null, b)) return false;
     if (ReferenceEquals(a, b)) return true;
     return Equals(a.ServiceName, b.ServiceName) && a.ServiceID.Equals(b.ServiceID);
 }
Exemple #6
0
 public static void Main(string[] args)
 {
     serviceInformation = new ServiceInfomation();
     //var result = serviceInformation.GetAllProfessors();
     serviceInformation.GetAllProfessors();
 }
Exemple #7
0
 public SubscriptionController(IServiceInformation serviceInformation)
 {
     _serviceInformation = serviceInformation;
 }
Exemple #8
0
 public ServiceInformationManager(IServiceInformation serviceInformation)
 {
     _serviceInformation = serviceInformation;
 }
 public void CredentialsRequested(IServiceInformation serviceInformation)
 {
     RequestCredentialsFor(serviceInformation.ServiceName, "", serviceInformation);
 }
 public Credentials GetCredentials(IServiceInformation serviceInformation)
 {
     throw new System.NotImplementedException();
 }
 public Credentials GetCredentials(IServiceInformation serviceInformation)
 {
     throw new WebException("Authentication failure");
 }
 public Startup(IConfiguration _configuration)
 {
     Configuration       = _configuration;
     _serviceInformation = new ServiceInformation(_configuration);
 }
Exemple #13
0
 public Credentials GetCredentials(IServiceInformation serviceInformation)
 {
     WasUserAuthenticated = true;
     Credentials = new Credentials()
     {
         UserName = "******",
         Password = "******",
         ServiceInformation = serviceInformation
     };
     return Credentials;
 }
 private Credentials _Get(IServiceInformation serviceInformation)
 {
     if (!_cache.ContainsKey(serviceInformation.ServiceID))
         return null;
     var cachedCredential = _cache[serviceInformation.ServiceID];
     return new Credentials()
         {
             ServiceInformation = serviceInformation,
             UserName = cachedCredential.UserName,
             Password = cachedCredential.Password,
             IsPasswordCachingAllowed = cachedCredential.IsPasswordCached
         };
 }
 public Credentials GetCredentials(IServiceInformation serviceInformation)
 {
     return new Credentials()
                {
                    UserName = "******",
                    Password = "******",
                    ServiceInformation = serviceInformation
                };
 }