예제 #1
0
        public async Task <IImageSourceServiceResult <UIImage> > GetImageAsync(ICountedImageSourceStub imageSource, float scale = 1, CancellationToken cancellationToken = default)
        {
            try
            {
                Starting.Set();

                // simulate actual work
                var image = await Task.Run(() =>
                {
                    if (imageSource.Wait)
                    {
                        DoWork.WaitOne();
                    }

                    var color = imageSource.Color.ToNative();

                    return(CreateImage(scale, color));
                }).ConfigureAwait(false);

                return(new Result(image, imageSource.IsResolutionDependent));
            }
            finally
            {
                Finishing.Set();
            }
        }
예제 #2
0
        public async Task <IImageSourceServiceResult <Drawable> > GetDrawableAsync(ICountedImageSourceStub imageSource, Context context, CancellationToken cancellationToken = default)
        {
            try
            {
                Starting.Set();

                // simulate actual work
                var drawable = await Task.Run(() =>
                {
                    if (imageSource.Wait)
                    {
                        DoWork.WaitOne();
                    }

                    var color = imageSource.Color.ToPlatform();

                    return(new ColorDrawable(color));
                }).ConfigureAwait(false);

                return(new Result(drawable, imageSource.IsResolutionDependent));
            }
            finally
            {
                Finishing.Set();
            }
        }
예제 #3
0
 public Task <IImageSourceServiceResult <UI.Xaml.Media.ImageSource> > GetImageSourceAsync(ICountedImageSourceStub imageSource, float scale = 1, CancellationToken cancellationToken = default)
 {
     throw new NotImplementedException();
 }