草庐IT

DownloadCompleted

全部标签

c# - FilePathResult 的已完成事件

我想在用户完成下载后做一些事情publicclassTestController:Controller{publicFilePathResultIndex(){returnFile("path/to/file","mime");}}我尝试的是将以下事件添加到测试Controller,但它们都在用户完成下载之前触发(除了永远不会调用的析构函数)protectedoverridevoidEndExecute(IAsyncResultasyncResult){base.EndExecute(asyncResult);}protectedoverridevoidEndExecuteCore(I

variables - swift 闭包作为变量存储和访问

我想像以前在Objective-C中那样在swift项目中实现回调我需要一个闭包类型的变量。该闭包应将一个对象作为参数并且不返回任何内容。vardownloadCompleted:(MLBook)->(Void)!当我需要触发回调时,我会这样做:ifself.downloadCompleted{self.downloadCompleted(book)}编译器提示此错误消息:Type'(MLBook)->(Void)!'doesnotconformtoprotocol'BooleanType'如果我删除if语句,编译器会说:Property'self.downloadCompleted'

c# - 将 BitmapImage 保存到文件

我正在开发一个程序,可以将图像从URL下载到位图图像并显示它。接下来,我尝试使用jpegbitmapencoder将位图图像保存到硬盘。文件已成功创建,但实际jpeg图像为空或1个黑色像素。publicGuidSavePhoto(stringistrImagePath){ImagePath=istrImagePath;BitmapImageobjImage=newBitmapImage(newUri(istrImagePath,UriKind.RelativeOrAbsolute));PictureDisplayed.Source=objImage;savedCreationObjec

c# - 将 BitmapImage 保存到文件

我正在开发一个程序,可以将图像从URL下载到位图图像并显示它。接下来,我尝试使用jpegbitmapencoder将位图图像保存到硬盘。文件已成功创建,但实际jpeg图像为空或1个黑色像素。publicGuidSavePhoto(stringistrImagePath){ImagePath=istrImagePath;BitmapImageobjImage=newBitmapImage(newUri(istrImagePath,UriKind.RelativeOrAbsolute));PictureDisplayed.Source=objImage;savedCreationObjec