//压缩Gif private async void btyasuo_Click(object sender, RoutedEventArgs e) { /* * //LINQ 的查询 * List<int> listA = new List<int> { 1, 2, 3, 5, 7, 9 }; * List<int> listB = new List<int> { 13, 4, 17, 29, 2 }; * List<int> ResultA = listA.Union(listB).ToList<int>(); //剔除重复项 * List<int> ResultB = listA.Concat(listB).ToList<int>();//保留重复项 * List<int> ResultC = listA.Union(listB).Except(listB).ToList<int>(); * List<int> ResultD = listA.Union(listB).Except(listA).ToList<int>(); */ //压缩 await Task.Run(async() => { //var rass = RandomAccessStreamReference.CreateFromUri(new Uri(this.baseUri, "/Gif/123.gif")); var rass = RandomAccessStreamReference.CreateFromUri(new Uri(this.baseUri, "/Gif/234.gif")); var streamRandom = await rass.OpenReadAsync(); var streamRandomCopy = streamRandom.CloneStream(); var stream = await CompressionHelper.CompressionGif(streamRandom, 400, 300); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { await imageGif.SetSourceAsync(stream); await gifYaSuo.SetSourceAsync(streamRandomCopy); }); }); Windows.Networking.BackgroundTransfer.BackgroundDownloader bgd = new Windows.Networking.BackgroundTransfer.BackgroundDownloader(); //测试返回String var sss = await GetAsyncTaskSample(); //BitmapImage bi = new BitmapImage(); //HttpDownLoadHelper hdlh = new HttpDownLoadHelper(); //var ss = await hdlh.StartDownload(new Uri("http://ww4.sinaimg.cn/bmiddle/636b6f59jw1e2exg8yk5pj.jpg", UriKind.RelativeOrAbsolute)); //await bi.SetSourceAsync(ss); //ceshiImage.Source = bi; hdlch = new HttpDownLoadContinueHelper(); hdlch.DownLoadChanging += new EventHandler <WinRtHttpHelper.Data.DownLoadChangingEventArgs>(DownLoadChanging); var ss = await hdlch.StartDownload(new Uri("http://ww4.sinaimg.cn/bmiddle/636b6f59jw1e2exg8yk5pj.jpg", UriKind.RelativeOrAbsolute)); }
//开始下载 private async void btS_Click(object sender, RoutedEventArgs e) { var ss = await hdlch.StartDownload(new Uri("http://ww4.sinaimg.cn/bmiddle/636b6f59jw1e2exg8yk5pj.jpg", UriKind.RelativeOrAbsolute)); }