コード例 #1
0
ファイル: App.xaml.cs プロジェクト: hispafox/PetrolheadUWP
        // runs only when not restored from state
        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            // set hamburger menu to full screen mode on Mobile devices.
            if (DeviceUtils.Current().IsPhone())
            {
                Views.Shell.HamburgerMenu.IsFullScreen = true;
            }

            if (!AuthHelper.IsCachedCredentialsAvailable())
            {
                Debug.WriteLine("App.OnStartAsync() : no cached credentials available, loading login page...");
                NavigationService.Navigate(typeof(Views.LoginPage));
            }
            else
            {
                Debug.WriteLine("App.OnStartAsync() : cached credentials found, bypassing login page...");
                await AuthHelper.AuthenticateAsync();

                if (Settings.IsAlreadyConfigured)
                {
                    Debug.WriteLine("App.OnStartAsync() : already set up, skipping to MainPage...");
                    NavigationService.Navigate(typeof(Views.MainPage));
                }
                else
                {
                    Debug.WriteLine("App.OnStartAsync() : not configured, starting setup wizard...");
                    NavigationService.Navigate(typeof(Views.SetupWizardHomePage));
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Performs an asynchronous authentication using your Microsoft Account.
 /// </summary>
 /// <returns>Returns a boolean value representing status</returns>
 protected async Task <bool> AuthenticateAsync()
 {
     return(await AuthHelper.AuthenticateAsync());
 }