/// <summary> /// Creates a image source from embedded resource. /// </summary> /// <param name="this">The toast image source factory</param> /// <param name="resourcePath">Resource path</param> /// <param name="resolvingType">A type from the assembly in which to look up the image resource with resource.</param> /// <param name="cancellationToken"></param> /// <returns>Image source</returns> /// <remarks> /// On iOS and UWP this function will write a image to cache using <seealso cref="IImageCacher"/>, /// with name generated by <see cref="IResourceToFileNameStrategy"/> /// </remarks> public static Task <ToastImageSource> FromResourceAsync( this IToastImageSourceFactory @this, string resourcePath, Type resolvingType, CancellationToken cancellationToken = default) { return(@this.FromResourceAsync(resourcePath, resolvingType.GetTypeInfo().Assembly, cancellationToken)); }
protected override async Task DoRunAsync() { var result = await serviceProvider.GetRequiredService <INotificationBuilder>() .AddTitle(Localization.R_SOME_TITLE) .AddDescription(Localization.R_LOREM_IPSUM) .AddImage(await toastImageSourceFactory.FromResourceAsync(TestData.KEmbeddedImage, this.GetType())) .Build().ShowAsync(); Assert(result == NotificationResult.Activated || result == NotificationResult.TimedOut); }