Skip to content

Commit

Permalink
Merge pull request #18309 from unoplatform/dev/youssef/samplesapp-fai…
Browse files Browse the repository at this point in the history
…l-safe

chore: Fail safe in SamplesApp `IWaitableSample` samples
  • Loading branch information
Youssef1313 authored Sep 29, 2024
2 parents c5c91bd + dcc36eb commit e4d8b5e
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,32 @@ internal static class WaitableSampleImageHelpers
private static Task WaitImage(ImageBrush image)
{
var tcs = new TaskCompletionSource();
image.ImageOpened += (_, _) => tcs.SetResult();
image.ImageFailed += (_, _) => tcs.SetResult();
image.ImageOpened += (_, _) => tcs.TrySetResult();
image.ImageFailed += (_, _) => tcs.TrySetResult();
return tcs.Task;
}

private static Task WaitImage(Image image)
{
var tcs = new TaskCompletionSource();
image.ImageOpened += (_, _) => tcs.SetResult();
image.ImageFailed += (_, _) => tcs.SetResult();
image.ImageOpened += (_, _) => tcs.TrySetResult();
image.ImageFailed += (_, _) => tcs.TrySetResult();
return tcs.Task;
}

private static Task WaitImage(SvgImageSource image)
{
var tcs = new TaskCompletionSource();
image.Opened += (_, _) => tcs.SetResult();
image.OpenFailed += (_, _) => tcs.SetResult();
image.Opened += (_, _) => tcs.TrySetResult();
image.OpenFailed += (_, _) => tcs.TrySetResult();
return tcs.Task;
}

private static Task WaitImage(BitmapImage image)
{
var tcs = new TaskCompletionSource();
image.ImageOpened += (_, _) => tcs.SetResult();
image.ImageFailed += (_, _) => tcs.SetResult();
image.ImageOpened += (_, _) => tcs.TrySetResult();
image.ImageFailed += (_, _) => tcs.TrySetResult();
return tcs.Task;
}

Expand Down

0 comments on commit e4d8b5e

Please sign in to comment.