diff --git a/Source/ContainerListView/ContainerListView.Designer.cs b/Source/ContainerListView/ContainerListView.Designer.cs index 0b360f2..dfee615 100644 --- a/Source/ContainerListView/ContainerListView.Designer.cs +++ b/Source/ContainerListView/ContainerListView.Designer.cs @@ -47,6 +47,7 @@ namespace Nuclex.Windows.Forms { } #endregion + } } // namespace Nuclex.Windows.Forms diff --git a/Source/ContainerListView/ContainerListView.cs b/Source/ContainerListView/ContainerListView.cs index 8b9df59..c2a5310 100644 --- a/Source/ContainerListView/ContainerListView.cs +++ b/Source/ContainerListView/ContainerListView.cs @@ -42,7 +42,7 @@ namespace Nuclex.Windows.Forms { /// Initializes a new ContainerListView public ContainerListView() { - this.embeddedControlClickedHandler = new EventHandler(embeddedControlClicked); + this.embeddedControlClickedDelegate = new EventHandler(embeddedControlClicked); this.embeddedControls = new ListViewEmbeddedControlCollection(); @@ -67,12 +67,12 @@ namespace Nuclex.Windows.Forms { /// Called when the list of embedded controls has been cleared /// Collection that has been cleared of its controls - /// Not used - private void embeddedControlsClearing(object sender, EventArgs e) { + /// Not used + private void embeddedControlsClearing(object sender, EventArgs arguments) { this.BeginUpdate(); try { foreach(ListViewEmbeddedControl embeddedControl in this.embeddedControls) { - embeddedControl.Control.Click -= this.embeddedControlClickedHandler; + embeddedControl.Control.Click -= this.embeddedControlClickedDelegate; this.Controls.Remove(embeddedControl.Control); } } @@ -83,30 +83,36 @@ namespace Nuclex.Windows.Forms { /// Called when a control gets removed from the embedded controls list /// List from which the control has been removed - /// Event arguments providing a reference to the removed control + /// + /// Event arguments providing a reference to the removed control + /// private void embeddedControlAdded( - object sender, ListViewEmbeddedControlCollection.ListViewEmbeddedControlEventArgs e + object sender, + ListViewEmbeddedControlCollection.ListViewEmbeddedControlEventArgs arguments ) { - e.EmbeddedControl.Control.Click += this.embeddedControlClickedHandler; - this.Controls.Add(e.EmbeddedControl.Control); + arguments.EmbeddedControl.Control.Click += this.embeddedControlClickedDelegate; + this.Controls.Add(arguments.EmbeddedControl.Control); } /// Called when a control gets added to the embedded controls list /// List to which the control has been added - /// Event arguments providing a reference to the added control + /// + /// Event arguments providing a reference to the added control + /// private void embeddedControlRemoved( - object sender, ListViewEmbeddedControlCollection.ListViewEmbeddedControlEventArgs e + object sender, + ListViewEmbeddedControlCollection.ListViewEmbeddedControlEventArgs arguments ) { - if(this.Controls.Contains(e.EmbeddedControl.Control)) { - e.EmbeddedControl.Control.Click -= this.embeddedControlClickedHandler; - this.Controls.Remove(e.EmbeddedControl.Control); + if(this.Controls.Contains(arguments.EmbeddedControl.Control)) { + arguments.EmbeddedControl.Control.Click -= this.embeddedControlClickedDelegate; + this.Controls.Remove(arguments.EmbeddedControl.Control); } } /// Called when an embedded control has been clicked on /// Embedded control that has been clicked - /// Not used - private void embeddedControlClicked(object sender, EventArgs e) { + /// Not used + private void embeddedControlClicked(object sender, EventArgs arguments) { this.BeginUpdate(); try { @@ -174,7 +180,7 @@ namespace Nuclex.Windows.Forms { } /// Event handler for when embedded controls are clicked on - private EventHandler embeddedControlClickedHandler; + private EventHandler embeddedControlClickedDelegate; /// Controls being embedded in this ListView private ListViewEmbeddedControlCollection embeddedControls; diff --git a/Source/EmbeddedControlCollection.cs b/Source/EmbeddedControlCollection.cs index 527d1e6..396e035 100644 --- a/Source/EmbeddedControlCollection.cs +++ b/Source/EmbeddedControlCollection.cs @@ -80,7 +80,7 @@ namespace Nuclex.Windows.Forms { OnControlRemoved(value); } - // These three methods don't need to be override since their current implementations + // These three methods don't need an override since their current implementations // in the .NET Framework 2.0 all call the Remove() method on each individual control. // The ControlAdded/ControlRemoved events weren't in the original class and there // are other designs you could use to guarantee that removed controls get disposed diff --git a/Source/ProgressReporter/ProgressReporterForm.cs b/Source/ProgressReporter/ProgressReporterForm.cs index 06b4f9b..3ef3687 100644 --- a/Source/ProgressReporter/ProgressReporterForm.cs +++ b/Source/ProgressReporter/ProgressReporterForm.cs @@ -43,36 +43,36 @@ namespace Nuclex.Windows.Forms { } /// - /// Shows the progress reporter until the specified progression has ended. + /// Shows the progress reporter until the specified transaction has ended. /// - /// - /// Progression for whose duration to show the progress reporter + /// + /// Transaction for whose duration to show the progress reporter /// - public static void Track(Waitable progression) { - Track(null, progression); + public static void Track(Transaction transaction) { + Track(null, transaction); } /// - /// Shows the progress reporter until the specified progression has ended. + /// Shows the progress reporter until the specified transaction has ended. /// /// /// Text to be shown in the progress reporter's title bar /// - /// + /// /// Process for whose duration to show the progress reporter /// - public static void Track(string windowTitle, Waitable waitable) { + public static void Track(string windowTitle, Transaction transaction) { - // Small optimization to avoid the lengthy control creation when the waitable + // Small optimization to avoid the lengthy control creation when the background // process has already ended. This is an accepted race condition: If the process // finishes right after this line, it doesn't change the outcome, it just // causes the progress dialog to be constructed needlessly. - if(waitable.Ended) + if(transaction.Ended) return; - // Open the form and let it monitor the progression's state + // Open the form and let it monitor the transaction's state using(ProgressReporterForm theForm = new ProgressReporterForm()) { - theForm.track(windowTitle, waitable); + theForm.track(windowTitle, transaction); } } @@ -83,57 +83,58 @@ namespace Nuclex.Windows.Forms { base.OnClosing(e); // Only allow the form to close when the form is ready to close and the - // progression being tracked has also finished. + // transaction being tracked has also finished. e.Cancel = (Thread.VolatileRead(ref this.state) < 2); } /// - /// Shows the progress reporter until the specified progression has ended. + /// Shows the progress reporter until the specified transaction has ended. /// /// /// Text to be shown in the progress reporter's title bar /// - /// - /// Waitable for whose duration to show the progress reporter + /// + /// Transaction for whose duration to show the progress reporter /// - private void track(string windowTitle, Waitable waitable) { + private void track(string windowTitle, Transaction transaction) { // Set the window title if the user wants to use a custom one if(windowTitle != null) Text = windowTitle; - // Only enable the cancel button if the progression can be aborted - this.abortReceiver = (waitable as IAbortable); + // Only enable the cancel button if the transaction can be aborted + this.abortReceiver = (transaction as IAbortable); this.cancelButton.Enabled = (this.abortReceiver != null); // Make sure the progress bar control has been created (otherwise, we've got // a chance that BeginInvoke() would fail if the first progress notification // arrived before we called ShowDialog()!) { IntPtr tempDummy = this.progressBar.Handle; } - - // Subscribe the form to the progression it is supposed to monitor. - // Careful: With the new 'Waitable' design, this can cause the asyncEndedDelegate + + // Subscribe the form to the transaction it is supposed to monitor. + // Careful: With the new design, this can cause the asyncEndedDelegate() // callback to be called immediately and synchronously! - waitable.AsyncEnded += this.asyncEndedDelegate; - IProgressReporter progressReporter = waitable as IProgressReporter; + transaction.AsyncEnded += this.asyncEndedDelegate; + IProgressReporter progressReporter = transaction as IProgressReporter; if(progressReporter != null) progressReporter.AsyncProgressChanged += this.asyncProgressChangedDelegate; - // The progression might have ended before this line was reached, if that's + // The transaction might have ended before this line was reached, if that's // the case, we don't show the dialog at all. - if(!waitable.Ended) + if(!transaction.Ended) ShowDialog(); - // We're done, unsubscribe from the progression's events again - progressReporter = waitable as IProgressReporter; - if(progressReporter != null) + // We're done, unsubscribe from the transaction's events again + progressReporter = transaction as IProgressReporter; + if(progressReporter != null) { progressReporter.AsyncProgressChanged -= this.asyncProgressChangedDelegate; - waitable.AsyncEnded -= this.asyncEndedDelegate; + } + transaction.AsyncEnded -= this.asyncEndedDelegate; } - /// Called when the progression has ended - /// Progression that has ended + /// Called when the transaction has ended + /// Transaction that has ended /// Not used private void asyncEnded(object sender, EventArgs arguments) { @@ -143,19 +144,20 @@ namespace Nuclex.Windows.Forms { // Close the dialog. Ensure the Close() method is invoked from the // same thread the dialog was created in. - if(InvokeRequired) + if(InvokeRequired) { Invoke(new MethodInvoker(Close)); - else + } else { Close(); + } } } - /// Called when the tracked progression's progress updates - /// Progression whose progress has been updated + /// Called when the tracked transaction's progress updates + /// Transaction whose progress has been updated /// - /// Contains the new progress achieved by the progression + /// Contains the new progress achieved by the transaction /// private void asyncProgressChanged(object sender, ProgressReportEventArgs arguments) { @@ -178,8 +180,8 @@ namespace Nuclex.Windows.Forms { /// close request arrives at an inappropriate time. /// /// Timer that has ticked - /// Not used - private void controlCreationTimerTicked(object sender, EventArgs e) { + /// Not used + private void controlCreationTimerTicked(object sender, EventArgs arguments) { // This timer is intended to run only once to find out when the dialog has // been fully constructed and is running its message pump. So we'll disable @@ -188,8 +190,9 @@ namespace Nuclex.Windows.Forms { // If the new state is 2, then the form was requested to close before it had // been fully constructed, so we should close it now! - if(Interlocked.Increment(ref this.state) == 2) + if(Interlocked.Increment(ref this.state) == 2) { Close(); + } } @@ -197,8 +200,8 @@ namespace Nuclex.Windows.Forms { /// Aborts the background operation when the user clicks the cancel button /// /// Button that has been clicked - /// Not used - private void cancelClicked(object sender, EventArgs e) { + /// Not used + private void cancelClicked(object sender, EventArgs arguments) { if(this.abortReceiver != null) { @@ -226,10 +229,10 @@ namespace Nuclex.Windows.Forms { /// 2: Ready to close and close requested, triggers close /// private int state; - /// Whether we're receiving progress updates from the progression + /// Whether we're receiving progress updates from the transaction /// /// 0: No progress updates have arrived so far - /// 1: We have received at least one progress update from the progression + /// 1: We have received at least one progress update from the transaction /// private int areProgressUpdatesIncoming; /// diff --git a/Source/TrackingBar/ToolStripTrackingBar.cs b/Source/TrackingBar/ToolStripTrackingBar.cs index 9ad602c..42ab6c9 100644 --- a/Source/TrackingBar/ToolStripTrackingBar.cs +++ b/Source/TrackingBar/ToolStripTrackingBar.cs @@ -26,23 +26,23 @@ namespace Nuclex.Windows.Forms { get { return base.Control as TrackingBar; } } - /// Tracks the specified progression in the tracking bar - /// Progression to be tracked - public void Track(Waitable progression) { - TrackingBarControl.Track(progression); + /// Tracks the specified transaction in the tracking bar + /// Transaction to be tracked + public void Track(Transaction transaction) { + TrackingBarControl.Track(transaction); } - /// Tracks the specified progression in the tracking bar - /// Progression to be tracked - /// Weight of this progression in the total progress - public void Track(Waitable progression, float weight) { - TrackingBarControl.Track(progression, weight); + /// Tracks the specified transaction in the tracking bar + /// Transaction to be tracked + /// Weight of this transaction in the total progress + public void Track(Transaction transaction, float weight) { + TrackingBarControl.Track(transaction, weight); } - /// Stops tracking the specified progression - /// Progression to stop tracking - public void Untrack(Waitable progression) { - TrackingBarControl.Untrack(progression); + /// Stops tracking the specified transaction + /// Transaction to stop tracking + public void Untrack(Transaction transaction) { + TrackingBarControl.Untrack(transaction); } /// Default size of the hosted control @@ -82,8 +82,8 @@ namespace Nuclex.Windows.Forms { /// visibility changes. /// /// Tracking bar control whose visiblity has changed - /// Not used - private void trackingBarVisibleChanged(object sender, EventArgs e) { + /// Not used + private void trackingBarVisibleChanged(object sender, EventArgs arguments) { base.Visible = TrackingBarControl.Visible; } diff --git a/Source/TrackingBar/TrackingBar.cs b/Source/TrackingBar/TrackingBar.cs index cb59e00..5b1f18b 100644 --- a/Source/TrackingBar/TrackingBar.cs +++ b/Source/TrackingBar/TrackingBar.cs @@ -58,51 +58,52 @@ namespace Nuclex.Windows.Forms { this.tracker.AsyncProgressChanged += this.asyncProgressUpdateDelegate; } - /// Tracks the specified progression in the tracking bar - /// Progression to be tracked - public void Track(Waitable progression) { - this.tracker.Track(progression); + /// Tracks the specified transaction in the tracking bar + /// Transaction to be tracked + public void Track(Transaction transaction) { + this.tracker.Track(transaction); } - /// Tracks the specified progression in the tracking bar - /// Progression to be tracked - /// Weight of this progression in the total progress - public void Track(Waitable progression, float weight) { - this.tracker.Track(progression, weight); + /// Tracks the specified transaction in the tracking bar + /// Transaction to be tracked + /// Weight of this transaction in the total progress + public void Track(Transaction transaction, float weight) { + this.tracker.Track(transaction, weight); } - /// Stops tracking the specified progression - /// Progression to stop tracking - public void Untrack(Waitable progression) { - this.tracker.Untrack(progression); + /// Stops tracking the specified transaction + /// Transaction to stop tracking + public void Untrack(Transaction transaction) { + this.tracker.Untrack(transaction); } /// - /// Called when the summed progressed of the tracked progressions has changed + /// Called when the summed progressed of the tracked transaction has changed /// - /// Progression whose progress has changed - /// Contains the progress achieved by the progression + /// Transaction whose progress has changed + /// Contains the progress achieved by the transaction private void asyncProgressUpdated( object sender, ProgressReportEventArgs arguments ) { AsyncSetValue(arguments.Progress); } - + /// Called when the tracker becomes enters of leaves the idle state /// Tracker that has entered or left the idle state /// Contains the new idle state private void asyncIdleStateChanged(object sender, IdleStateEventArgs arguments) { - + // Do a fully synchronous update of the idle state. This update must not be // lost because otherwise, the progress bar might stay on-screen when in fact, // the background operation has already finished and nothing is happening anymore. this.isIdle = arguments.Idle; // Update the bar's idle state - if(InvokeRequired) + if(InvokeRequired) { Invoke(this.updateIdleStateDelegate); - else + } else { updateIdleState(); + } } @@ -123,9 +124,9 @@ namespace Nuclex.Windows.Forms { private ProgressTracker tracker; /// Delegate for the idle state update method private MethodInvoker updateIdleStateDelegate; - /// Delegate for the OnAsyncProgressionEnded method + /// Delegate for the asyncIdleStateChanged() method private EventHandler asyncIdleStateChangedDelegate; - /// Delegate for the OnAsyncProgressionProgressUpdated method + /// Delegate for the asyncProgressUpdate() method private EventHandler asyncProgressUpdateDelegate; }