/// <summary> /// Creates a new event arguments instance. /// </summary> /// <param name="item">The progress item.</param> /// <param name="progress">The progress info.</param> /// <param name="oldLegend">The old legend.</param> /// <param name="newLegend">The new legend.</param> public ProgressItemLegendSetEventArgs(ProgressItem item, ProgressInfo progress, ProgressLegend oldLegend, ProgressLegend newLegend) : base(item) { this.Progress = progress; this.OldLegend = oldLegend; this.NewLegend = newLegend; }
/// <summary> /// Creates a new progress list box item with the specified text and progress legend. /// </summary> /// <param name="text">The item text.</param> /// <param name="legend">The progress legend.</param> public ProgressItem(string text, ProgressLegend legend) { // Set the text. this.text = text; // Create the progress information. this.progress = new ProgressInfo(legend); // Set the progress event handlers. this.progress.LevelChanged += this.OnProgressLevelChanged; this.progress.DefaultChanged += this.OnProgressDefaultChanged; this.progress.CountChanged += this.OnProgressCountChanged; this.progress.LegendSet += this.OnProgressLegendSet; this.progress.LegendChanged += this.OnProgressLegendChanged; }
// Private methods. /// <summary> /// An event handler called when a new progress info has been set. /// </summary> /// <param name="oldProgress">The old progress info.</param> /// <param name="newProgress">The new progress info.</param> private void OnProgressSet(ProgressInfo oldProgress, ProgressInfo newProgress) { // If the object has been disposed, do nothing. if (this.IsDisposed) return; // Remove the event handler for the old progress info. if (null != oldProgress) { oldProgress.CountChanged -= this.OnProgressCountChanged; oldProgress.DefaultChanged -= this.OnProgressDefaultChanged; oldProgress.LevelChanged -= this.OnProgressLevelChanged; oldProgress.LegendSet -= this.OnProgressLegendSet; oldProgress.LegendChanged -= this.OnProgressLegendChanged; } // Add the event handler for the new progress info. if (null != newProgress) { newProgress.CountChanged += this.OnProgressCountChanged; newProgress.DefaultChanged += this.OnProgressDefaultChanged; newProgress.LevelChanged += this.OnProgressLevelChanged; newProgress.LegendSet += this.OnProgressLegendSet; newProgress.LegendChanged += this.OnProgressLegendChanged; } // Update the progress. this.OnUpdateProgress(); // Update the legend. this.OnUpdateLegend(); // Update the geometric measurements. this.OnUpdateGeometrics(); // Refresh the control. this.Invalidate(this.controlBorder); }
/// <summary> /// Creates a new event arguments instance. /// </summary> /// <param name="progress">The progress info.</param> public ProgressInfoEventArgs(ProgressInfo progress) { this.Progress = progress; }
/// <summary> /// Creates a new event arguments instance. /// </summary> /// <param name="progress">The progress info.</param> /// <param name="legend">The progress legend.</param> public ProgressLegendChangedEventArgs(ProgressInfo progress, ProgressLegend legend) : base(progress) { this.Legend = legend; }
/// <summary> /// Creates a new event arguments instance. /// </summary> /// <param name="progress">The progress info.</param> /// <param name="oldLegend">The old progress legend.</param> /// <param name="newLegend">The new progress legend.</param> public ProgressLegendSetEventArgs(ProgressInfo progress, ProgressLegend oldLegend, ProgressLegend newLegend) : base(progress) { this.OldLegend = oldLegend; this.NewLegend = newLegend; }
/// <summary> /// Creates a new event arguments instance. /// </summary> /// <param name="item">The progress item.</param> /// <param name="progress">The progress info.</param> /// <param name="legend">The legend.</param> public ProgressItemLegendChangedEventArgs(ProgressItem item, ProgressInfo progress, ProgressLegend legend) : base(item) { this.Progress = progress; this.Legend = legend; }
/// <summary> /// An event handler called before the item progress object has changed. /// </summary> /// <param name="oldProgress">The old progress object.</param> /// <param name="newProgress">The new progress object.</param> private void OnProgressChanged(ProgressInfo oldProgress, ProgressInfo newProgress) { // Remove the old progress event handlers. if (oldProgress != null) { oldProgress.LevelChanged -= this.OnProgressLevelChanged; oldProgress.DefaultChanged -= this.OnProgressDefaultChanged; oldProgress.CountChanged -= this.OnProgressCountChanged; oldProgress.LegendSet -= this.OnProgressLegendSet; oldProgress.LegendChanged -= this.OnProgressLegendChanged; } // Add the new progress event handlers. if (newProgress != null) { newProgress.LevelChanged += this.OnProgressLevelChanged; newProgress.DefaultChanged += this.OnProgressDefaultChanged; newProgress.CountChanged += this.OnProgressCountChanged; newProgress.LegendSet += this.OnProgressLegendSet; newProgress.LegendChanged += this.OnProgressLegendChanged; } // Raise the event. if (null != this.ProgressSet) this.ProgressSet(this, new ProgressItemInfoSetEventArgs(this, oldProgress, newProgress)); }