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

View File

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

View File

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