public void RefreshStatus(SyncClientDownloadAudioFileProgressEntity entity) { Gtk.Application.Invoke(delegate{ lblStatus.Text = entity.Status; lblDownloadSpeedValue.Text = entity.DownloadSpeed; lblErrorsValue.Text = entity.Errors.ToString(); lblFilesDownloadedValue.Text = string.Format("{0}/{1}", entity.FilesDownloaded, entity.TotalFiles); lblCurrentFile.Text = entity.DownloadFileName; progressBar.Fraction = entity.PercentageDone / 100f; progressBarCurrentFile.Fraction = entity.DownloadPercentageDone / 100f; }); }
public void RefreshStatus(SyncClientDownloadAudioFileProgressEntity entity) { RunOnUiThread(() => { //progressView.Progress = entity.PercentageDone/100f; _lblTitle.Text = entity.Status; _lblCompletedValue.Text = string.Format("{0:0.0}%", entity.PercentageDone); _lblCurrentFileProgressValue.Text = string.Format("{0:0.0}%", entity.DownloadPercentageDone); _lblFilesDownloadedValue.Text = string.Format("{0}", entity.FilesDownloaded); _lblTotalFilesValue.Text = string.Format("{0}", entity.TotalFiles); _lblDownloadSpeedValue.Text = entity.DownloadSpeed; _lblErrorsValue.Text = string.Format("{0}", entity.Errors); _lblFileName.Text = entity.DownloadFileName; //textViewLog.Text = entity.Log; }); }
public void RefreshStatus(SyncClientDownloadAudioFileProgressEntity entity) { InvokeOnMainThread(delegate { lblStatus.StringValue = entity.Status; lblDownloadSpeedValue.StringValue = entity.DownloadSpeed; lblErrorsValue.StringValue = entity.Errors.ToString(); lblFilesDownloadedValue.StringValue = string.Format("{0}/{1}", entity.FilesDownloaded, entity.TotalFiles); lblCurrentFileValue.StringValue = entity.DownloadFileName; progressIndicator.DoubleValue = entity.PercentageDone; progressIndicatorCurrentFile.DoubleValue = entity.DownloadPercentageDone; }); }
public void RefreshStatus(SyncClientDownloadAudioFileProgressEntity entity) { InvokeOnMainThread(() => { progressView.Progress = entity.PercentageDone / 100f; lblTitle.Text = entity.Status; lblPercentageDoneValue.Text = string.Format("{0:0.0}%", entity.PercentageDone); lblCurrentFileValue.Text = string.Format("{0:0.0}%", entity.DownloadPercentageDone); lblFilesDownloadedValue.Text = string.Format("{0}", entity.FilesDownloaded); lblTotalFilesValue.Text = string.Format("{0}", entity.TotalFiles); lblDownloadSpeedValue.Text = entity.DownloadSpeed; lblErrorsValue.Text = string.Format("{0}", entity.Errors); lblFileNameValue.Text = entity.DownloadFileName; textViewLog.Text = entity.Log; }); }
private void HandleDownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { if (e.Cancelled) return; _stopwatch.Stop(); if (e.Error != null) { Console.WriteLine("SyncClientService - HandleDownloadFileCompleted - Error: {0}", e.Error); _errorCount++; } else { // TODO: Check if the ID is already in the database! If yes, that means the insert statement will fail. Console.WriteLine("SyncClientService - HandleDownloadFileCompleted - File downloaded; inserting audio file into database..."); var audioFile = _audioFiles[_filesDownloaded]; string localFilePath = GetLibraryLocalPath(audioFile); audioFile.FilePath = localFilePath; _libraryService.InsertAudioFile(audioFile); } _filesDownloaded++; var entity = new SyncClientDownloadAudioFileProgressEntity() { Status = "Downloading files...", PercentageDone = ((float)_filesDownloaded / (float)_audioFiles.Count()) * 100f, FilesDownloaded = _filesDownloaded, TotalFiles = _audioFiles.Count(), DownloadSpeed = GetDownloadSpeed(), Errors = _errorCount, Log = string.Empty }; // Download the next file if(_filesDownloaded < _audioFiles.Count) { Console.WriteLine("SyncClientService - HandleDownloadFileCompleted - Downloading next file {0}...", _audioFiles[_filesDownloaded].FilePath); if (OnDownloadAudioFileCompleted != null) OnDownloadAudioFileCompleted(entity); DownloadAudioFile(_audioFiles[_filesDownloaded]); return; } // Process is over; refresh cache Console.WriteLine("SyncClientService - HandleDownloadFileCompleted - Process is over, refreshing audio file cache..."); entity.Status = "Refreshing cache..."; if (OnDownloadAudioFileCompleted != null) OnDownloadAudioFileCompleted(entity); _audioFileCacheService.RefreshCache(); if (OnDownloadAudioFilesCompleted != null) OnDownloadAudioFilesCompleted(this, new EventArgs()); }