Ejemplo n.º 1
0
 public ScanAndRepairFileProgress(string fileName, int totalProgressPercentage,
                                  DownloadFileProgress downloadProgress)
 {
     FileName = fileName;
     TotalProgressPercentage = totalProgressPercentage;
     DownloadFileProgress    = downloadProgress;
 }
Ejemplo n.º 2
0
 private void RegisterDownloadDelegates()
 {
     // We do all this magic because other threads should NOT change the UI.
     // We want the changes made to the reusable `TransferFileProgressArgs` instance
     // to raise change events on the context of the Main thread.
     Implementation.DownloadStarted += (TransferFileProgressArgs args, Action action) =>
     {
         EventDispatcher.Invoke(() =>
         {
             if (action != null)
             {
                 action.Invoke();
             }
             if (DownloadFileStarted != null)
             {
                 DownloadFileStarted.Invoke(this, args);
             }
         });
     };
     Implementation.DownloadProgressed += (TransferFileProgressArgs args, Action action) =>
     {
         EventDispatcher.Invoke(() =>
         {
             if (action != null)
             {
                 action.Invoke();
             }
             if (DownloadFileProgress != null)
             {
                 DownloadFileProgress.Invoke(this, args);
             }
         });
     };
     Implementation.DownloadCanceled += (TransferFileProgressArgs args, Action action) =>
     {
         EventDispatcher.Invoke(() =>
         {
             if (action != null)
             {
                 action.Invoke();
             }
             if (DownloadFileCanceled != null)
             {
                 DownloadFileCanceled.Invoke(this, args);
             }
         });
     };
     Implementation.DownloadFailed += (TransferFileProgressArgs args, Action action) =>
     {
         EventDispatcher.Invoke(() =>
         {
             if (action != null)
             {
                 action.Invoke();
             }
             if (DownloadFileFailed != null)
             {
                 DownloadFileFailed.Invoke(this, args);
             }
         });
     };
     Implementation.DownloadCompleted += (TransferFileProgressArgs args, Action action) =>
     {
         EventDispatcher.Invoke(() =>
         {
             if (action != null)
             {
                 action.Invoke();
             }
             if (DownloadFileCompleted != null)
             {
                 DownloadFileCompleted.Invoke(this, args);
             }
         });
     };
 }