Here are the examples of the csharp api System.Threading.Tasks.TaskCompletionSource.TrySetResult(Snackbar) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
19
Source : UserDialogs.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
private Task<Snackbar> CreateSnackbar(AppCompatActivity activity, string msg, bool autoHide = false)
{
var tcs = new TaskCompletionSource<Snackbar>();
activity.RunOnUiThread(() =>
{
var view = (activity as ICommonActivity)?.View ?? activity.Window.DecorView.RootView.FindViewById(Android.Resource.Id.Content);
try
{
var snackBar = Snackbar.Make(
view,
msg,
autoHide ? Snackbar.LengthShort : Snackbar.LengthLong
);
tcs.TrySetResult(snackBar);
}
catch
{
tcs.TrySetResult(null);
}
});
return tcs.Task;
}
19
Source : UserDialogs.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
private Task<Snackbar> CreateSnackbar(AppCompatActivity activity, string msg, bool autoHide = false)
{
var tcs = new TaskCompletionSource<Snackbar>();
activity.RunOnUiThread(() =>
{
var view = (activity as ICommonActivity)?.View ?? activity.Window.DecorView.RootView.FindViewById(Android.Resource.Id.Content);
try
{
var snackBar = Snackbar.Make(
view,
msg,
autoHide ? Snackbar.LengthShort : Snackbar.LengthLong
);
tcs.TrySetResult(snackBar);
}
catch
{
tcs.TrySetResult(null);
}
});
return tcs.Task;
}