Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Populate the list of available files to download.
        /// </summary>
        private void OnPopulateDownloadList()
        {
            // If the ADCP is pinging, make it stop
            _adcpConn.StopPinging();

            // The D command will cancel any pending downloads
            // Send it twice to first ignore the last packet sent, then
            // stop the download process
            _adcpConn.SendData(string.Format("{0}", RTI.Commands.AdcpCommands.CMD_DS_CANCEL));
            _adcpConn.SendData(string.Format("{0}", RTI.Commands.AdcpCommands.CMD_DS_CANCEL));

            // Send command to the ADCP to give a list of all the files
            RTI.Commands.AdcpDirListing dirListing = _adcpConn.GetDirectoryListing();

            // Populate the list with all the files found
            Application.Current.Dispatcher.BeginInvoke(new System.Action(() => PopulateDownloadList(dirListing)));
        }