示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthViewModel"/> class.
        /// </summary>
        public AuthViewModel(string webmapURL, string arcGISOnlineURL, string appClientID, string redirectURL, string userName, string oAuthRefreshToken)
        {
            _webmapURL         = webmapURL;
            _arcGISOnlineURL   = arcGISOnlineURL;
            _appClientID       = appClientID;
            _redirectURL       = redirectURL;
            _userName          = userName;
            _oAuthRefreshToken = oAuthRefreshToken;

            // Watch for oAuth token changes
            BroadcastMessenger.Instance.BroadcastMessengerValueChanged += (o, args) =>
            {
                if (args.Args.Key == BroadcastMessageKey.OAuthRefreshToken)
                {
                    _oAuthRefreshToken = args.Args.Value?.ToString();
                }
            };

            // Set up authentication manager to handle signing in
            UpdateAuthenticationManager();

            // test if refresh token is available and sign the user in
            if (!string.IsNullOrEmpty(_oAuthRefreshToken))
            {
                // if device is online, sign user in automatically
                ConnectivityHelper.IsWebmapAccessible(_webmapURL).ContinueWith(t =>
                {
                    if (t.Result)
                    {
                        SignInCommand.Execute(null);
                    }
                });
            }
        }
示例#2
0
        protected override void OnLoaded(ContentControl view)
        {
            var users = _mountUserRepository.GetAll();

            if (MountUserCollection == null)
            {
                MountUserCollection = new ObservableCollection <IMountUser>();
            }
            foreach (var item in users)
            {
                MountUserCollection.Add(item);
            }
            var passwordBox = (view as SignInMountPage)?.PasswordBox;

            if (FillAccontPageInfo(passwordBox, users.FirstOrDefault(item => item.IsAutoSignIn)))
            {
                IsAutoSignIn = true;
                if (SignInCommand.CanExecute(passwordBox))
                {
                    SignInCommand.Execute(passwordBox);
                }
                return;
            }
            FillAccontPageInfo(passwordBox, users.FirstOrDefault(item => item.IsRememberPassword));
        }
示例#3
0
        public MainWindowVm()
        {
            SignInCommand              = new SignInCommand();
            SignOutCommand             = new SignOutCommand();
            AddAnimalCommand           = new AddAnimalCommand();
            EditAnimalCommand          = new EditAnimalCommand();
            DeleteAnimalCommand        = new DeleteAnimalCommand();
            CallVaccineCommand         = new CallVaccineCommand();
            CallTreatmentCommand       = new CallTreatmentCommand();
            CompleteCallCommand        = new CompleteCallCommand();
            ShowVaccinationCardCommand = new ShowVaccinationCardCommand();
            SignInCommand.Execute(this);

            Update();
        }
 public void ExecuteTestPO()
 {
     Assert.DoesNotThrow(() => { signInCommandUnderTest.Execute(new object()); });
 }
示例#5
0
 public async Task <SignInOutput> SignIn([FromServices] SignInCommand command, [FromBody] SignInInput input)
 {
     return(await command.Execute(input));
 }