summaryrefslogtreecommitdiffstats
path: root/samples/OAuthConsumerWpf/MainWindow.xaml.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-04-09 07:54:24 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-04-09 07:54:24 -0700
commit16ca42988d40f06adfd259098ef2a1507fd1c731 (patch)
tree5f53dd6642799f64937f794dc0d66bfb47d4278a /samples/OAuthConsumerWpf/MainWindow.xaml.cs
parent266e65da43dc5d3b785af7d22ac0dc11274550c2 (diff)
downloadDotNetOpenAuth-16ca42988d40f06adfd259098ef2a1507fd1c731.zip
DotNetOpenAuth-16ca42988d40f06adfd259098ef2a1507fd1c731.tar.gz
DotNetOpenAuth-16ca42988d40f06adfd259098ef2a1507fd1c731.tar.bz2
Moved OAuth consumer WPF sample's consumer key and secret into its app.config file.
Diffstat (limited to 'samples/OAuthConsumerWpf/MainWindow.xaml.cs')
-rw-r--r--samples/OAuthConsumerWpf/MainWindow.xaml.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/samples/OAuthConsumerWpf/MainWindow.xaml.cs b/samples/OAuthConsumerWpf/MainWindow.xaml.cs
index bf65431..1c8d0aa 100644
--- a/samples/OAuthConsumerWpf/MainWindow.xaml.cs
+++ b/samples/OAuthConsumerWpf/MainWindow.xaml.cs
@@ -1,6 +1,7 @@
namespace DotNetOpenAuth.Samples.OAuthConsumerWpf {
using System;
using System.Collections.Generic;
+ using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading;
@@ -35,11 +36,15 @@
InitializeComponent();
this.google = new DesktopConsumer(GoogleConsumer.ServiceDescription, this.tokenManager);
+ this.tokenManager.ConsumerKey = ConfigurationManager.AppSettings["googleConsumerKey"];
+ this.tokenManager.ConsumerSecret = ConfigurationManager.AppSettings["googleConsumerSecret"];
}
private void beginAuthorizationButton_Click(object sender, RoutedEventArgs e) {
- this.tokenManager.ConsumerKey = consumerKeyBox.Text;
- this.tokenManager.ConsumerSecret = consumerSecretBox.Text;
+ if (string.IsNullOrEmpty(this.tokenManager.ConsumerKey)) {
+ MessageBox.Show(this, "You must modify the App.config or OAuthConsumerWpf.exe.config file for this application to include your Google OAuth consumer key first.", "Configuration required", MessageBoxButton.OK, MessageBoxImage.Stop);
+ return;
+ }
Cursor original = this.Cursor;
this.Cursor = Cursors.Wait;