Esempio n. 1
0
        private async Task ImageActionAsync()
        {
            var remoteUri = new Uri("https://smartthings-plus.s3.amazonaws.com/category-icons/garden-icon%402x.png");


            // Download image
            IHttpProxyService httpProxyService = new HttpProxyService();

            Tuple <string, byte[]> result = null;

            try
            {
                result = await httpProxyService.GetBytesAsync(remoteUri, cancellationToken : CancellationToken.None);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            // raw image
            var bitmapImage01 = new BitmapImage();
            await bitmapImage01.SetSourceAsync(new MemoryStream(result.Item2).AsRandomAccessStream());

            DownloadedImage = bitmapImage01;

            // applyed colorization effect
            ColorizedImage = await ProcessImage(result.Item2);
        }
Esempio n. 2
0
        private async Task <string> DownloadAdnApplyFilterAndSave()
        {
            IHttpProxyService httpProxyService = new HttpProxyService();
            var storageService = new StorageManagerService();

            var imageColorizationService = new ImageColorizationService(storageService, httpProxyService);

            var localUri = await imageColorizationService.ApplyColorizationFilterAndSaveAsync("https://smartthings-plus.s3.amazonaws.com/category-icons/garden-icon%402x.png");

            return(localUri.AbsoluteUri);
        }