示例#1
0
        public virtual void StartDownload()
        {
            // Offline check
            if (World.Settings.WorkOffline)
            {
                return;
            }

            Log.Write(Log.Levels.Debug, "GSDR", "Starting download for " + m_url);
            //			Log.Write(Log.Levels.Debug, "GSDR", "to be stored in "+this.m_imageStore.GetLocalPath(QuadTile));

            WorldWind.Net.Wms.WmsImageStore wmsImageStore       = m_imageStore as WorldWind.Net.Wms.WmsImageStore;
            System.Net.NetworkCredential    downloadCredentials = null;

            if (wmsImageStore != null)
            {
                downloadCredentials = new System.Net.NetworkCredential(wmsImageStore.Username, wmsImageStore.Password);
            }

            QuadTile.IsDownloadingImage = true;
            download = new WebDownload(m_url, downloadCredentials);

            download.DownloadType      = DownloadType.Wms;
            download.SavedFilePath     = m_localFilePath + ".tmp";
            download.ProgressCallback += new DownloadProgressHandler(UpdateProgress);
            download.CompleteCallback += new WorldWind.Net.DownloadCompleteHandler(DownloadComplete);
            download.BackgroundDownloadFile();
        }
 public virtual void StartDownload()
 {
     QuadTile.IsDownloadingImage = true;
     download = new WebDownload(m_url);
     download.DownloadType      = DownloadType.Wms;
     download.SavedFilePath     = m_localFilePath + ".tmp";
     download.ProgressCallback += new DownloadProgressHandler(UpdateProgress);
     download.CompleteCallback += new DownloadCompleteHandler(DownloadComplete);
     download.BackgroundDownloadFile();
 }
示例#3
0
        internal virtual void StartDownload(string filePath, string fileName)         // Asynch download here
        {
            string url = GetServerUrl();

            download = new WebDownload(url);
            download.SavedFilePath     = Path.Combine(filePath, fileName);
            download.ProgressCallback += new DownloadProgressHandler(UpdateProgress);
            download.CompleteCallback += new DownloadCompleteHandler(DownloadComplete);
            download.BackgroundDownloadFile();
            isDownloading = true;
        }
示例#4
0
 public virtual void StartDownload()
 {
     Log.Write(Log.Levels.Debug, "GSDR", "Starting download for " + m_url);
     QuadTile.IsDownloadingImage = true;
     download = new WebDownload(m_url);
     download.DownloadType      = DownloadType.Wms;
     download.SavedFilePath     = m_localFilePath + ".tmp";
     download.ProgressCallback += new DownloadProgressHandler(UpdateProgress);
     download.CompleteCallback += new DownloadCompleteHandler(DownloadComplete);
     download.BackgroundDownloadFile();
 }
示例#5
0
        //TODO: Implement Downloading + Uncompressing + Caching
        private void DownloadParsePlacenames()
        {
            try
            {
                if (m_failed)
                {
                    return;
                }

                if (m_dlInProcess)
                {
                    return;
                }

                //hard coded cache location
                //string cachefilename =
                //    Directory.GetParent(System.Windows.Forms.Application.ExecutablePath) +
                //    string.Format("Cache//WFS//Placenames//{0}//{1}_{2}_{3}_{4}.xml.gz",
                //    this.name, this.west, this.south, this.east, this.north);


                //let's use the location from settings instead
                string cachefilename = m_cache.CacheDirectory +
                                       string.Format("\\{0}\\WFS\\{1}\\{2}_{3}_{4}_{5}.xml.gz",
                                                     this.m_world.Name, this.name, this.west, this.south, this.east, this.north);

                if (!File.Exists(cachefilename))
                {
                    m_dlInProcess = true;

                    // Offline check
                    if (World.Settings.WorkOffline)
                    {
                        throw new Exception("Offline mode active.");
                    }

                    WebDownload wfsdl = new WebDownload(this.wfsURL);
                    wfsdl.BackgroundDownloadFile(cachefilename, new DownloadCompleteHandler(DownloadComplete));
                }
                else
                {
                    ProcessCacheFile();
                }
            }
            catch //(Exception ex)
            {
                //Log.Write(ex);
                if (m_placeNames == null)
                {
                    m_placeNames = new WorldWindPlacename[0];
                }
                m_failed = true;
            }
        }
示例#6
0
 /// <summary>
 /// Handles the Click event of the menuItemFileRetry control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 private void menuItemFileRetry_Click(object sender, System.EventArgs e)
 {
     foreach (DebugItem li in listView.SelectedItems)
     {
         WebDownload dl = new WebDownload(li.Url);
         dl.SavedFilePath     = li.SavedFilePath;
         dl.CompleteCallback += new DownloadCompleteHandler(OnDownloadComplete);
         dl.BackgroundDownloadFile();
         retryDownloads.Add(dl);
     }
 }
示例#7
0
 private void refreshTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (isUpdating)
     {
         return;
     }
     // refresh object position, check that not offline
     if (m_refreshurl != null && !World.Settings.WorkOffline)
     {
         WebDownload dl = new WebDownload(m_refreshurl);
         dl.SavedFilePath     = meshFileName.Replace(".x", ".txt");
         dl.CompleteCallback += new DownloadCompleteHandler(positionupdateComplete);
         dl.BackgroundDownloadFile();
     }
     isUpdating = true;
 }
示例#8
0
 /// <summary>
 /// Handles the Click event of the menuItemFileRetry control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 private void menuItemFileRetry_Click(object sender, EventArgs e)
 {
     foreach (DebugItem li in listView.SelectedItems) {
         WebDownload dl = new WebDownload(li.Url);
         dl.SavedFilePath = li.SavedFilePath;
         dl.CompleteCallback += new DownloadCompleteHandler(OnDownloadComplete);
         dl.BackgroundDownloadFile();
         retryDownloads.Add(dl);
     }
 }