Beispiel #1
0
		public bool addAccount(string user)
		{
			CancellationTokenSource cts = new CancellationTokenSource();

			Task<UserCredential> ucTask = SAuthorizeAsync(user, cts.Token);

			AuthWaitDialog authdiag = new AuthWaitDialog(user);
			ucTask.ContinueWith(t => PostKeyRetrieve(t, authdiag, user));

			bool? result = authdiag.ShowDialog();
			if (!result.GetValueOrDefault(false))
			{
				cts.Cancel();
			}

			return true;
		}
Beispiel #2
0
		public void PostKeyRetrieve(Task<UserCredential> doneTask, AuthWaitDialog authwin, string id)
		{
			try
			{
				UserCredential credential = doneTask.Result;
				accountsDict[id] = credential;
			}
			catch (Exception e)
			{
				logging.TraceEvent(TraceEventType.Error, 1, "Error in PostKeyRetrieve: " + e);
			}
			authwin.authWindow.Dispatcher.BeginInvoke(new Action(() => authwin.completedClose() ) );
		}