Updated ProgressReporterForm to reflect the latest changes to the Tracking framework; renamed WeightedProgression.cs to WeightedWaitable.cs in order to match the previous name changed of the class contained therein; improved documentation of the Camera class

git-svn-id: file:///srv/devel/repo-conversion/nuwi@19 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2008-03-27 18:34:17 +00:00
parent 7b46b57833
commit 2a7d04ce45
3 changed files with 25 additions and 21 deletions

View File

@ -37,8 +37,8 @@ namespace Nuclex.Windows.Forms {
InitializeComponent();
this.asyncEndedDelegate = new EventHandler(asyncEnded);
this.asyncProgressUpdatedDelegate = new EventHandler<ProgressUpdateEventArgs>(
asyncProgressUpdated
this.asyncProgressChangedDelegate = new EventHandler<ProgressReportEventArgs>(
asyncProgressChanged
);
}
@ -48,7 +48,7 @@ namespace Nuclex.Windows.Forms {
/// <param name="progression">
/// Progression for whose duration to show the progress reporter
/// </param>
public static void Track(Progression progression) {
public static void Track(Waitable progression) {
Track(null, progression);
}
@ -61,7 +61,7 @@ namespace Nuclex.Windows.Forms {
/// <param name="progression">
/// Progression for whose duration to show the progress reporter
/// </param>
public static void Track(string windowTitle, Progression progression) {
public static void Track(string windowTitle, Waitable progression) {
// Small optimization to avoid the lengthy control creation when
// the progression has already ended
@ -94,7 +94,7 @@ namespace Nuclex.Windows.Forms {
/// <param name="progression">
/// Progression for whose duration to show the progress reporter
/// </param>
private void track(string windowTitle, Progression progression) {
private void track(string windowTitle, Waitable progression) {
// Set the window title if the user wants to use a custom one
if(windowTitle != null)
@ -106,7 +106,9 @@ namespace Nuclex.Windows.Forms {
// Subscribe the form to the progression it is supposed to monitor
progression.AsyncEnded += this.asyncEndedDelegate;
progression.AsyncProgressUpdated += this.asyncProgressUpdatedDelegate;
IProgressReporter progressReporter = progression as IProgressReporter;
if(progressReporter != null)
progressReporter.AsyncProgressChanged += this.asyncProgressChangedDelegate;
// The progression might have ended before this line was reached, if that's
// the case, we don't show the dialog at all.
@ -114,7 +116,9 @@ namespace Nuclex.Windows.Forms {
ShowDialog();
// We're done, unsubscribe from the progression's events again
progression.AsyncProgressUpdated -= this.asyncProgressUpdatedDelegate;
progressReporter = progression as IProgressReporter;
if(progressReporter != null)
progressReporter.AsyncProgressChanged -= this.asyncProgressChangedDelegate;
progression.AsyncEnded -= this.asyncEndedDelegate;
}
@ -144,7 +148,7 @@ namespace Nuclex.Windows.Forms {
/// <param name="arguments">
/// Contains the new progress achieved by the progression
/// </param>
private void asyncProgressUpdated(object sender, ProgressUpdateEventArgs arguments) {
private void asyncProgressChanged(object sender, ProgressReportEventArgs arguments) {
// See if this is the first progress update we're receiving. If yes, we need to
// switch the progress bar from marquee into its normal mode!
@ -205,7 +209,7 @@ namespace Nuclex.Windows.Forms {
/// <summary>Delegate for the asyncEnded() method</summary>
private EventHandler asyncEndedDelegate;
/// <summary>Delegate for the asyncProgressUpdated() method</summary>
private EventHandler<ProgressUpdateEventArgs> asyncProgressUpdatedDelegate;
private EventHandler<ProgressReportEventArgs> asyncProgressChangedDelegate;
/// <summary>Whether the form can be closed and should be closed</summary>
/// <remarks>
/// 0: Nothing happened yet

View File

@ -28,20 +28,20 @@ namespace Nuclex.Windows.Forms {
/// <summary>Tracks the specified progression in the tracking bar</summary>
/// <param name="progression">Progression to be tracked</param>
public void Track(Progression progression) {
public void Track(Waitable progression) {
TrackingBarControl.Track(progression);
}
/// <summary>Tracks the specified progression in the tracking bar</summary>
/// <param name="progression">Progression to be tracked</param>
/// <param name="weight">Weight of this progression in the total progress</param>
public void Track(Progression progression, float weight) {
public void Track(Waitable progression, float weight) {
TrackingBarControl.Track(progression, weight);
}
/// <summary>Stops tracking the specified progression</summary>
/// <param name="progression">Progression to stop tracking</param>
public void Untrack(Progression progression) {
public void Untrack(Waitable progression) {
TrackingBarControl.Untrack(progression);
}

View File

@ -48,32 +48,32 @@ namespace Nuclex.Windows.Forms {
this.asyncIdleStateChangedDelegate = new EventHandler<IdleStateEventArgs>(
asyncIdleStateChanged
);
this.asyncProgressUpdateDelegate = new EventHandler<ProgressUpdateEventArgs>(
this.asyncProgressUpdateDelegate = new EventHandler<ProgressReportEventArgs>(
asyncProgressUpdated
);
// Create the tracker and attach ourselfes to its events
this.tracker = new ProgressionTracker();
this.tracker = new ProgressTracker();
this.tracker.AsyncIdleStateChanged += this.asyncIdleStateChangedDelegate;
this.tracker.AsyncProgressUpdated += this.asyncProgressUpdateDelegate;
this.tracker.AsyncProgressChanged += this.asyncProgressUpdateDelegate;
}
/// <summary>Tracks the specified progression in the tracking bar</summary>
/// <param name="progression">Progression to be tracked</param>
public void Track(Progression progression) {
public void Track(Waitable progression) {
this.tracker.Track(progression);
}
/// <summary>Tracks the specified progression in the tracking bar</summary>
/// <param name="progression">Progression to be tracked</param>
/// <param name="weight">Weight of this progression in the total progress</param>
public void Track(Progression progression, float weight) {
public void Track(Waitable progression, float weight) {
this.tracker.Track(progression, weight);
}
/// <summary>Stops tracking the specified progression</summary>
/// <param name="progression">Progression to stop tracking</param>
public void Untrack(Progression progression) {
public void Untrack(Waitable progression) {
this.tracker.Untrack(progression);
}
@ -83,7 +83,7 @@ namespace Nuclex.Windows.Forms {
/// <param name="sender">Progression whose progress has changed</param>
/// <param name="arguments">Contains the progress achieved by the progression</param>
private void asyncProgressUpdated(
object sender, ProgressUpdateEventArgs arguments
object sender, ProgressReportEventArgs arguments
) {
AsyncSetValue(arguments.Progress);
}
@ -120,13 +120,13 @@ namespace Nuclex.Windows.Forms {
/// <summary>Whether the progress bar is in the idle state</summary>
private volatile bool isIdle;
/// <summary>Tracker used to sum and update the total progress</summary>
private ProgressionTracker tracker;
private ProgressTracker tracker;
/// <summary>Delegate for the idle state update method</summary>
private MethodInvoker updateIdleStateDelegate;
/// <summary>Delegate for the OnAsyncProgressionEnded method</summary>
private EventHandler<IdleStateEventArgs> asyncIdleStateChangedDelegate;
/// <summary>Delegate for the OnAsyncProgressionProgressUpdated method</summary>
private EventHandler<ProgressUpdateEventArgs> asyncProgressUpdateDelegate;
private EventHandler<ProgressReportEventArgs> asyncProgressUpdateDelegate;
}