Ejemplo n.º 1
0
        async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            pinAuth = new PinAuthorizer
            {
                // Get the ConsumerKey and ConsumerSecret for your app and load them here.
                CredentialStore = new InMemoryCredentialStore
                {
                    ConsumerKey = ConfigurationManager.AppSettings["consumerKey"],
                    ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"]
                },
                // Note: GetPin isn't used here because we've broken the authorization
                // process into two parts: begin and complete
                GoToTwitterAuthorization = pageLink => Dispatcher.BeginInvoke((Action)
                    (() => OAuthWebBrowser.Navigate(new Uri(pageLink, UriKind.Absolute))))
            };

            await pinAuth.BeginAuthorizeAsync();
        }
Ejemplo n.º 2
0
		private async Task OpenAuthorizationPageAsync()
		{
			_authorizer = new PinAuthorizer
			{
				CredentialStore = new InMemoryCredentialStore
				{
					ConsumerKey = ConsumerKey,
					ConsumerSecret = ConsumerSecret
				},
				GoToTwitterAuthorization = pageLink => Process.Start(pageLink)
			};

			try
			{
				await _authorizer.BeginAuthorizeAsync();
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}