コード例 #1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            NavPaneDivider.Visibility = Visibility.Collapsed;
            //ViewModel handles the navigation to the 0 index on startup so have to manually set this here.

            if (!CrossSecureStorage.Current.HasKey("OAuthToken"))
            {
                await ApiKeysManager.KeyRetriever();
            }
        }
コード例 #2
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);
            ApiKeysManager.KeyRetriever();
            _webView = view.FindViewById <WebView>(Resource.Id.login_webview);
            _webView.Settings.JavaScriptEnabled = true;
            //Values can be found at https://github.com/settings/applications
            _clientId     = ApiKeysManager.GithubClientId;
            _clientSecret = ApiKeysManager.GithubClientSecret;
            _client       = new GitHubClient(new ProductHeaderValue("gitit"));

            _webView.SetWebViewClient(new LoginWebViewClient(_client, _clientId, _clientSecret, _webView));

            var loginRequest = new OauthLoginRequest(_clientId)
            {
                Scopes = { "user", "notifications", "repo", "delete_repo", "gist", "admin:org" }
            };

            var oAuthLoginUrl = _client.Oauth.GetGitHubLoginUrl(loginRequest);

            _webView.LoadUrl(oAuthLoginUrl.ToString());
        }
コード例 #3
0
        private async void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
            NavMenuList.SelectedIndex = 0;
            NavMenuList.SetSelectedItem(NavMenuList.Items[0] as NavMenuItem);
            if (!(Microsoft.Services.Store.Engagement.StoreServicesFeedbackLauncher.IsSupported()))
            {
                FeedbackNavPaneButton.Visibility      = Visibility.Collapsed;
                FeedbackEmailNavPaneButton.Visibility = Visibility.Visible;
            }

            NavPaneDivider.Visibility = Visibility.Collapsed;
            //ViewModel handles the navigation to the 0 index on startup so have to manually set this here.

            if (!CrossSecureStorage.Current.HasKey("OAuthToken"))
            {
                await ApiKeysManager.KeyRetriever();
            }
            await ViewModel.LoadFragments();

            await RegisterAppForStoreNotifications();
        }