private void S3StatusChanged(S3Status s3Status)
 {
     Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => {
         cloudTotal.Content = String.Format("{0} files on cloud (Bucket: {1})", s3Status.CloudTotal, s3Status.BucketName);
         localTotal.Content = String.Format("{0} files on local", s3Status.LocalTotal);
         uploading.Content = String.Format("{0}/{1} uploading. {2} errors.", s3Status.Uploading, s3Status.UploadingTotal, s3Status.UploadingException);
         downloading.Content = String.Format("{0}/{1} downloading. {2} errors.", s3Status.Downloading, s3Status.DownloadingTotal, s3Status.DownloadingException);
         matching.Content = String.Format("{0} matching files", s3Status.MatchingFiles);
         notProcessed.Content = String.Format("{0} files not processed", s3Status.NotProcessedFiles);
     }));
 }
        private void UpdateStatus(S3StausChangedEventHandler eventHandler, Dictionary <string, ProcessItem> files, Dictionary <string, S3Object> list)
        {
            if (eventHandler == null)
            {
                return;
            }
            var uploading            = 0;
            var uploadingTotal       = 0;
            var uploadingException   = 0;
            var downloading          = 0;
            var downloadingTotal     = 0;
            var downloadingException = 0;
            var matchingFiles        = 0;
            var notProcessedFiles    = 0;

            foreach (var file in files)
            {
                switch (file.Value.Action)
                {
                case ProcessAction.Match:
                    matchingFiles++;
                    break;

                case ProcessAction.Upload:
                    uploadingTotal++;
                    break;

                case ProcessAction.Download:
                    downloadingTotal++;
                    break;

                case ProcessAction.UploadingDone:
                    uploadingTotal++;
                    uploading++;
                    break;

                case ProcessAction.UploadingException:
                    uploading++;
                    uploadingTotal++;
                    uploadingException++;
                    break;

                case ProcessAction.DownloadingDone:
                    downloadingTotal++;
                    downloading++;
                    break;

                case ProcessAction.DownloadingException:
                    downloading++;
                    downloadingTotal++;
                    downloadingException++;
                    break;

                case ProcessAction.Empty:
                    notProcessedFiles++;
                    break;

                default:
                    break;
                }
            }
            var status = new S3Status {
                BucketName    = _bucketName, CloudTotal = list.Count + uploading - uploadingException, LocalTotal = files.Count + downloading - downloadingException,
                Uploading     = uploading, UploadingTotal = uploadingTotal, UploadingException = uploadingException,
                Downloading   = downloading, DownloadingTotal = downloadingTotal, DownloadingException = downloadingException,
                MatchingFiles = matchingFiles, NotProcessedFiles = notProcessedFiles
            };

            eventHandler(status);
        }
        private void UpdateStatus(S3StausChangedEventHandler eventHandler, Dictionary<string, ProcessItem> files, Dictionary<string, S3Object> list)
        {
            if (eventHandler == null) return;
            var uploading = 0;
            var uploadingTotal = 0;
            var uploadingException = 0;
            var downloading = 0;
            var downloadingTotal = 0;
            var downloadingException = 0;
            var matchingFiles = 0;
            var notProcessedFiles = 0;

            foreach (var file in files) {
                switch (file.Value.Action) {
                    case ProcessAction.Match:
                        matchingFiles++;
                        break;
                    case ProcessAction.Upload:
                        uploadingTotal++;
                        break;
                    case ProcessAction.Download:
                        downloadingTotal++;
                        break;
                    case ProcessAction.UploadingDone:
                        uploadingTotal++;
                        uploading++;
                        break;
                    case ProcessAction.UploadingException:
                        uploading++;
                        uploadingTotal++;
                        uploadingException++;
                        break;
                    case ProcessAction.DownloadingDone:
                        downloadingTotal++;
                        downloading++;
                        break;
                    case ProcessAction.DownloadingException:
                        downloading++;
                        downloadingTotal++;
                        downloadingException++;
                        break;
                    case ProcessAction.Empty:
                        notProcessedFiles++;
                        break;
                    default:
                        break;
                }
            }
            var status = new S3Status {
                BucketName = _bucketName, CloudTotal = list.Count + uploading - uploadingException, LocalTotal = files.Count + downloading - downloadingException, 
                Uploading = uploading, UploadingTotal = uploadingTotal, UploadingException = uploadingException, 
                Downloading = downloading, DownloadingTotal = downloadingTotal, DownloadingException = downloadingException, 
                MatchingFiles = matchingFiles, NotProcessedFiles = notProcessedFiles};
            eventHandler(status);
        }