System.Threading.Tasks.TaskCompletionSource.SetResult(TReturnable)

Here are the examples of the csharp api System.Threading.Tasks.TaskCompletionSource.SetResult(TReturnable) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : PopupViewModel.cs
with MIT License
from LuckyDucko

public virtual void SafeCloseModal<TPopupType>(TReturnable result) where TPopupType : Rg.Plugins.Popup.Pages.PopupPage, new()
		{
			try
			{
				var safeCloseAttempt = Returnable.TrySetResult(result);
				if (!safeCloseAttempt)
				{
					Returnable = new TaskCompletionSource<TReturnable>();
					Returnable.SetResult(result);
				}
			}
			catch (Exception)
			{
				Returnable = new TaskCompletionSource<TReturnable>();
				Returnable.SetResult(BaseExitValue);
			}
			finally
			{

				PopupService.PopAsync<TPopupType>();
			}
		}