IntegrationFileClientDownloadFileAsync 方法 (String, String, String, String, ActionInt64, Int64, String) | 
 
            下载服务器的文件到本地的文件操作,需要指定下载的文件的名字,三级分类信息,本次保存的文件名,支持进度报告。
            To download a file from the server to a local file, you need to specify the name of the downloaded file, 
            the three-level classification information, the name of the file saved this time, and support for progress reports.
            
 
        命名空间: 
     HslCommunication.Enthernet
        程序集:
     HslCommunication (在 HslCommunication.dll 中) 版本:12.5.1.0 (12.5.1.0)
语法public Task<OperateResult> DownloadFileAsync(
	string fileName,
	string factory,
	string group,
	string id,
	Action<long, long> processReport,
	string fileSaveName
)
Public Function DownloadFileAsync ( 
	fileName As String,
	factory As String,
	group As String,
	id As String,
	processReport As Action(Of Long, Long),
	fileSaveName As String
) As Task(Of OperateResult)
public:
Task<OperateResult^>^ DownloadFileAsync(
	String^ fileName, 
	String^ factory, 
	String^ group, 
	String^ id, 
	Action<long long, long long>^ processReport, 
	String^ fileSaveName
)
member DownloadFileAsync : 
        fileName : string * 
        factory : string * 
        group : string * 
        id : string * 
        processReport : Action<int64, int64> * 
        fileSaveName : string -> Task<OperateResult> 
参数
- fileName
 - 类型:SystemString
文件名称,带后缀 - factory
 - 类型:SystemString
第一大类 - group
 - 类型:SystemString
第二大类 - id
 - 类型:SystemString
第三大类 - processReport
 - 类型:SystemActionInt64, Int64
下载的进度报告,第一个数据是已完成总接字节数,第二个数据是总字节数。 - fileSaveName
 - 类型:SystemString
准备本地保存的名称 
返回值
类型:
TaskOperateResult是否成功的结果对象
备注
            用于分类的参数
factory,
group,
id中间不需要的可以为空,对应的是服务器上的路径系统。
            
  警告: | 
|---|
| 
            失败的原因大多数来自于网络的接收异常,或是服务器不存在文件。
             | 
示例
private async void button4_Click( object sender, EventArgs e )
{
    
    
    progressBar2.Value = 0;
    button4.Enabled = false;
    string fileName = textBox_download_fileName.Text;
    DateTime downloadStartTime = DateTime.Now;
    OperateResult result = await integrationFileClient.DownloadFileAsync(
            fileName,                                              
            textBox_download_factory.Text,                         
            textBox_download_group.Text,                           
            textBox_download_id.Text,                              
            DownloadReportProgress,                                
            Application.StartupPath + @"\Files\" + fileName        
            );
    button4.Enabled = true;
    if (result.IsSuccess)
    {
        
        DemoUtils.ShowMessage( "文件下载成功!耗时:" + (DateTime.Now - downloadStartTime).TotalSeconds.ToString( "F1" ) + " 秒" );
    }
    else
    {
        
        
        DemoUtils.ShowMessage( "文件下载失败:" + result.ToMessageShowString( ) );
    }
}
private void button10_Click( object sender, EventArgs e )
{
    string fileName = textBox_download_fileName.Text;
    OperateResult<bool> result = integrationFileClient.IsFileExists(
            fileName,                                              
            textBox_download_factory.Text,                         
            textBox_download_group.Text,                           
            textBox_download_id.Text                               
            );
    if (result.IsSuccess)
    {
        if (result.Content)
            DemoUtils.ShowMessage( "文件存在!" );
        else
            DemoUtils.ShowMessage( "文件不存在!" );
    }
    else
    {
        DemoUtils.ShowMessage( result.Message );
    }
}
private void ThreadDownloadFile( object filename )
{
    if (filename is string fileName)
    {
        OperateResult result = integrationFileClient.DownloadFile(
            fileName,                                              
            textBox_download_factory.Text,                         
            textBox_download_group.Text,                           
            textBox_download_id.Text,                              
            DownloadReportProgress,                                
            Application.StartupPath + @"\Files\" + filename        
            );
        
        Invoke( new Action<OperateResult>( operateResult =>
        {
            button4.Enabled = true;
            if (result.IsSuccess)
            {
                
                DemoUtils.ShowMessage( "文件下载成功!" );
            }
            else
            {
                
                
                DemoUtils.ShowMessage( "文件下载失败:" + result.ToMessageShowString( ) );
            }
        } ), result );
    }
}
private void DownloadReportProgress( long receive, long totle )
{
    if (progressBar2.InvokeRequired)
    {
        progressBar2.Invoke( new Action<long, long>( DownloadReportProgress ), receive, totle );
        return;
    }
    
    
    int value = (int)(receive * 100L / totle);
    progressBar2.Value = value;
    label9.Text = receive + "/" + totle;
}
参见