Example #1
0
        public AuthViewModel(
            IDirectAuthViewModel directAuth,
            IHostAuthViewModel hostAuth,
            IOAuthViewModel oAuth,
            IScheduler currentThread,
            IScheduler mainThread,
            IProvider provider)
        {
            OAuth      = oAuth;
            HostAuth   = hostAuth;
            DirectAuth = directAuth;
            _provider  = provider;

            _isAuthenticated = _provider
                               .IsAuthorized
                               .DistinctUntilChanged()
                               .ObserveOn(mainThread)
                               .ToProperty(this, x => x.IsAuthenticated, scheduler: currentThread);

            _isAnonymous = _provider
                           .IsAuthorized
                           .Select(authorized => !authorized)
                           .DistinctUntilChanged()
                           .ObserveOn(mainThread)
                           .ToProperty(this, x => x.IsAnonymous, scheduler: currentThread);
        }
Example #2
0
        public AuthViewModel(
            IDirectAuthViewModel directAuth,
            IHostAuthViewModel hostAuth,
            IOAuthViewModel oAuth,
            IProvider provider,
            IScheduler current,
            IScheduler main)
        {
            OAuth      = oAuth;
            HostAuth   = hostAuth;
            DirectAuth = directAuth;
            _provider  = provider;

            _isAuthenticated = _provider
                               .IsAuthorized
                               .DistinctUntilChanged()
                               .ObserveOn(main)
                               .Log(this, $"Authentication state changed for {provider.Name}")
                               .ToProperty(this, x => x.IsAuthenticated, scheduler: current);

            _isAnonymous = this
                           .WhenAnyValue(x => x.IsAuthenticated)
                           .Select(authenticated => !authenticated)
                           .ToProperty(this, x => x.IsAnonymous, scheduler: current);
        }
Example #3
0
 public AuthViewModel(
     IDirectAuthViewModel directAuth,
     IOAuthViewModel oAuth,
     IScheduler currentThread,
     IProvider provider)
 {
     OAuth            = oAuth;
     DirectAuth       = directAuth;
     _provider        = provider;
     _isAuthenticated = _provider
                        .IsAuthorized
                        .DistinctUntilChanged()
                        .ToProperty(this, x => x.IsAuthenticated, scheduler: currentThread);
 }
        public OAuthWebViewPage()
        {
            InitializeComponent();
            BrowserControl.Width = this.Width;
            BrowserControl.Height = this.Height;

            dataContext = DI.Container.Current.Get<IOAuthViewModel>();

            this.DataContext = dataContext;

            ((ViewModelBase)dataContext).PropertyChanged += OAuthWebView_PropertyChanged;

            if (!string.IsNullOrEmpty(dataContext.ServiceAccount.AccessToken)) GoHome();

            dataContext.Url = dataContext.ServiceAccount.AuthorizationEndPoint();
        }
Example #5
0
        public AuthViewModel(
            IDirectAuthViewModel direct,
            IHostAuthViewModel host,
            IOAuthViewModel open,
            ICloud provider)
        {
            OAuth      = open;
            HostAuth   = host;
            DirectAuth = direct;
            _provider  = provider;

            _isAuthenticated = _provider
                               .IsAuthorized
                               .DistinctUntilChanged()
                               .Log(this, $"Authentication state changed for {provider.Name}")
                               .ObserveOn(RxApp.MainThreadScheduler)
                               .ToProperty(this, x => x.IsAuthenticated);

            _isAnonymous = this
                           .WhenAnyValue(x => x.IsAuthenticated)
                           .Select(authenticated => !authenticated)
                           .ToProperty(this, x => x.IsAnonymous);
        }