/// <summary> /// Occurs on click on a button to refresh access token. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void RefreshTokenButtonClick(object sender, RoutedEventArgs e) { var authorization = new DriveAuthorization(new DriveAuthData()); var context = DataContext as DriveContext; Debug.Assert(context != null, "context != null"); Task.Factory.StartNew(() => { try { context.AccessToken = authorization.RefreshToken(context.AccessToken).Data; } catch (Exception exception) { Dispatcher.BeginInvoke(new Action <Exception>(ShowErrorMessage), exception); } }); }
public DriveConnectWindow() { InitializeComponent(); Authorization = new DriveAuthorization(new DriveAuthData()); }