Exemple #1
0
        private async void LoginCommandExecuteAsync(object obj)
        {
            await _authenticationRepository.PostAuthorizationAsync(User);

            if (_authenticationRepository.Authentic.IsAuthorised)
            {
                UriQuery query = new UriQuery();
                NavigatePatameters.Save(_authenticationRepository.Authentic.GetHashCode(), _authenticationRepository.Authentic);
                query.Add("authenticationhash", _authenticationRepository.Authentic.GetHashCode().ToString());

                Application.Current.Dispatcher.Invoke(new System.Action(() =>
                {
                    var regionManager = ServiceLocator.Current.GetInstance <IRegionManager>();
                    regionManager.RequestNavigate("MainRegion", new Uri("ServerView" + query.ToString(), UriKind.Relative), nr =>
                    {
                        if (nr.Result.HasValue && nr.Result == false)
                        {
                            var error = nr.Error;
                        }
                    });
                }));
            }
            else
            {
                MessageBox.Show("Unable to authenticate!", "Authorization error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public void OnNavigatedTo(Microsoft.Practices.Prism.Regions.NavigationContext navigationContext)
        {
            int hash = int.Parse(navigationContext.Parameters["authenticationhash"]);

            _authentic = (Authentication)NavigatePatameters.Request(hash);
            GetServers();
        }