Example #1
0
 /// <summary>
 /// Downloads the file.
 /// </summary>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="worker">The worker.</param>
 /// <returns></returns>
 public byte[] DownloadFile(string fileName, ActionWorker worker)
 {
     byte[] result = null;
     if (client != null)
     {
         try
         {
             OnBeforeDownload(new WcfClientArgs(client, fileName));
             result = client.DownloadFile(fileName);
             OnAfterDownload(new WcfClientArgs(client, fileName));
             worker.ReportProgress(Localizer.DownloadOk);
         }
         catch (Exception exception)
         {
             worker.ReportError(Localizer.DownloadError, fileName, exception.Message);
         }
     }
     else
     {
         worker.ReportError(Localizer.ClientIsNotOpened);
     }
     return(result);
 }