Ejemplo n.º 1
0
        protected async Task <bool> CheckSignIn()
        {
            if (IsRequireSignIn)
            {
                var isSignIn = await HohoemaApp.CheckSignedInStatus() == Mntone.Nico2.NiconicoSignInStatus.Success;

                if (!HohoemaApp.IsLoggedIn && !isSignIn)
                {
                    if (!AccountManager.HasPrimaryAccount())
                    {
                        return(false);
                    }
                    else
                    {
                        var result = await HohoemaApp.SignInWithPrimaryAccount();

                        if (result == Mntone.Nico2.NiconicoSignInStatus.Failed)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(HohoemaApp.IsLoggedIn);
        }
Ejemplo n.º 2
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            disposables?.Dispose();
            disposables = new CompositeDisposable();

            IsLoggedIn.Where(x => x)
            .Take(1)
            .Delay(TimeSpan.FromSeconds(2.5))     /* ここでログイン確認後の遷移前タメ時間を調整 */
            .Subscribe(_ =>
            {
                var goNextCommand = new Commands.GoNextIntroductionPageCommand() as ICommand;
                if (goNextCommand != null)
                {
                    goNextCommand.Execute(null);
                }
            });

            _HohoemaApp.SignInWithPrimaryAccount().ConfigureAwait(false);

            base.OnNavigatedTo(e, viewModelState);
        }