/// <summary> /// Initializes a new instance of the <see cref= "T:WorldWind.Net.Monitor.ProgressDetailForm"/> class. /// </summary> /// <param name="item"></param> public HttpHeaderForm(DebugItem item) { InitializeComponent(); this.Text = item.Url; this.description.Text = item.ToString(); this.description.SelectionLength = 0; }
/// <summary> /// Initializes a new instance of the <see cref= "T:WorldWind.Net.Monitor.ProgressDetailForm"/> class. /// </summary> /// <param name="item"></param> public ProgressDetailForm( DebugItem item ) { InitializeComponent(); this.Text = item.Url; this.description.Text = item.ToString(); this.description.SelectionLength = 0; }
/// <summary> /// Removes the oldest item. /// </summary> private void RemoveOldestItem() { DebugItem oldest = null; foreach (DebugItem item in listView.Items) { if (oldest == null) { oldest = item; continue; } if (oldest.StartTime > item.StartTime) { oldest = item; } } if (oldest != null) { listView.Items.Remove(oldest); } }
/// <summary> /// Updates the specified download. /// </summary> /// <param name="wd">The wd.</param> public void Update(WebDownload wd) { // Make sure we're on the right thread if (this.InvokeRequired) { try { // Update progress asynchronously DownloadCompleteHandler dlgt = new DownloadCompleteHandler(Update); this.Invoke(dlgt, new object[] { wd }); } catch (Exception ex) { Log.Write(ex); } return; } foreach (DebugItem item in listView.Items) { if (item.WebDownload == wd) { item.Update(wd); if (logToFile) { if (wd.Exception != null) { Log.Write(Log.Levels.Error, logCategory, "Error : " + wd.Url.Replace("http://", "")); Log.Write(Log.Levels.Error, logCategory, " \\---" + wd.Exception.Message); } if (wd.ContentLength == wd.BytesProcessed) { string msg = string.Format(CultureInfo.CurrentCulture, "Done ({0:f2}s): {1}", item.ElapsedTime.TotalSeconds, wd.Url.Replace("http://", "")); Log.Write(Log.Levels.Debug, logCategory, msg); } } return; } } if (!isRunning) { return; } if (listView.Items.Count >= maxItems) { RemoveOldestItem(); } if (logToFile) { Log.Write(Log.Levels.Debug, logCategory, "Get : " + wd.Url); if (wd.SavedFilePath != null) { Log.Write(Log.Levels.Debug + 1, logCategory, " \\--- " + wd.SavedFilePath); } } DebugItem newItem = new DebugItem(wd); newItem.Update(wd); listView.Items.Insert(0, newItem); }
/// <summary> /// Updates the specified download. /// </summary> /// <param name="wd">The wd.</param> public void Update(WebDownload wd) { // Make sure we're on the right thread if (this.InvokeRequired) { // Update progress asynchronously DownloadCompleteHandler dlgt = new DownloadCompleteHandler(Update); this.Invoke(dlgt, new object[] {wd}); return; } foreach (DebugItem item in listView.Items) { if (item.WebDownload == wd) { item.Update(wd); if (logToFile) { if (wd.Exception != null) { Log.Write(logCategory, "Error : " + wd.Url.Replace("http://", "")); Log.Write(logCategory, " \\---" + wd.Exception.Message); } if (wd.ContentLength == wd.BytesProcessed) { string msg = string.Format(CultureInfo.CurrentCulture, "Done ({0:f2}s): {1}", item.ElapsedTime.TotalSeconds, wd.Url.Replace("http://", "")); Log.Write(logCategory, msg); } } return; } } if (!isRunning) { return; } if (listView.Items.Count >= maxItems) { RemoveOldestItem(); } if (logToFile) { Log.Write(logCategory, "Get : " + wd.Url); if (wd.SavedFilePath != null) { Log.Write(logCategory, " \\--- " + wd.SavedFilePath); } } DebugItem newItem = new DebugItem(wd); newItem.Update(wd); listView.Items.Insert(0, newItem); }