/// <summary> /// When the downloading is complete, this method will be called. /// This will update the buttons and begin outputing data to the /// screen again. /// </summary> private void On_DownloadDataCompleted() { // Turn on displaying serial data _isDownloadingData = false; _eventAggregator.PublishOnUIThread(new AdcpStatus(eAdcpStatus.Connected)); this.NotifyOfPropertyChange(() => this.CanDownloadData); this.NotifyOfPropertyChange(() => this.CanCancelDownload); this.NotifyOfPropertyChange(() => this.CanPopulateDownloadList); this.NotifyOfPropertyChange(() => this.CanFormatSdCard); // Check how the download completed if (_cancelDownload) { _eventAggregator.PublishOnUIThread(new StatusEvent("Download Cancelled.", MessageBoxImage.Warning)); // Clear the list of downloads DownloadFileList.Clear(); } //else if (e.Error != null) //{ // _eventAggregator.Publish(new StatusEvent("Download Error.", MessageBoxImage.Error)); // // Clear the list of downloads // DownloadFileList.Clear(); //} else { _eventAggregator.PublishOnUIThread(new StatusEvent("Download complete.")); } }
/// <summary> /// Populate the list with all the possible files /// that can be downloaded. This will be all the /// ENS files on the ADCP. /// </summary> /// <param name="directoryListing">List of files.</param> private void PopulateDownloadList(RTI.Commands.AdcpDirListing directoryListing) { try { // Clear the current list DownloadFileList.Clear(); // Set the total and used space DownloadTotalSpace = directoryListing.TotalSpace.ToString() + " MB"; DownloadUsedSpace = directoryListing.UsedSpace.ToString() + " MB"; // Create a list of all the ENS files for (int x = 0; x < directoryListing.DirListing.Count; x++) { DownloadFileList.Add(new DownloadFile(directoryListing.DirListing[x]) { IsSelected = SelectAllFiles }); } this.NotifyOfPropertyChange(() => this.CanDownloadData); } catch (Exception e) { log.Error("Error downloading list of files.", e); } }