- Timestamp:
- 08/22/13 11:31:32 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs ¶
r9893 r9894 353 353 /// Adds a <see cref="ProgressView"/> to the <see cref="ContentView"/>s showing the specified content. 354 354 /// </summary> 355 public voidAddOperationProgressToContent(IContent content, string progressMessage, bool addToObjectGraphObjects = true) {355 public IProgress AddOperationProgressToContent(IContent content, string progressMessage, bool addToObjectGraphObjects = true) { 356 356 if (contentProgressLookup.ContainsKey(content)) 357 357 throw new ArgumentException("A progress is already registered for the specified content.", "content"); … … 373 373 374 374 contentProgressLookup[content] = progress; 375 return progress; 375 376 } 376 377 … … 378 379 /// Adds a <see cref="ProgressView"/> to the specified view. 379 380 /// </summary> 380 public void AddOperationProgressToView(IView view, string progressMessage) { 381 if (viewProgressLookup.ContainsKey(view)) 382 throw new ArgumentException("A progress is already registered for the specified view.", "view"); 381 public IProgress AddOperationProgressToView(IView view, string progressMessage) { 382 var progress = new Progress(progressMessage, ProgressState.Started); 383 AddOperationProgressToView(view, progress); 384 return progress; 385 } 386 387 public void AddOperationProgressToView(IView view, IProgress progress) { 388 if (view == null) throw new ArgumentNullException("view", "The view must not be null."); 389 if (progress == null) throw new ArgumentNullException("progress", "The progress must not be null."); 383 390 384 391 var control = view as Control; 385 392 if (control == null) throw new ArgumentException("The passed view must be a control.", "view"); 386 393 387 var progress = new Progress(progressMessage, ProgressState.Started); 394 IProgress oldProgress; 395 if (viewProgressLookup.TryGetValue(view, out oldProgress)) { 396 foreach (var progressView in progressViews.Where(v => v.Content == oldProgress).ToList()) { 397 progressView.Dispose(); 398 progressViews.Remove(progressView); 399 } 400 viewProgressLookup.Remove(view); 401 } 402 388 403 progressViews.Add(new ProgressView(control, progress)); 389 404 viewProgressLookup[view] = progress; … … 393 408 /// Removes an existing <see cref="ProgressView"/> from the <see cref="ContentView"/>s showing the specified content. 394 409 /// </summary> 395 public void RemoveOperationProgressFromContent(IContent content ) {410 public void RemoveOperationProgressFromContent(IContent content, bool finishProgress = true) { 396 411 IProgress progress; 397 412 if (!contentProgressLookup.TryGetValue(content, out progress)) 398 413 throw new ArgumentException("No progress is registered for the specified content.", "content"); 399 414 400 progress.Finish();415 if (finishProgress) progress.Finish(); 401 416 foreach (var progressView in progressViews.Where(v => v.Content == progress).ToList()) { 402 417 progressView.Dispose(); … … 409 424 /// Removes an existing <see cref="ProgressView"/> from the specified view. 410 425 /// </summary> 411 public void RemoveOperationProgressFromView(IView view ) {426 public void RemoveOperationProgressFromView(IView view, bool finishProgress = true) { 412 427 IProgress progress; 413 428 if (!viewProgressLookup.TryGetValue(view, out progress)) 414 429 throw new ArgumentException("No progress is registered for the specified view.", "view"); 415 430 416 progress.Finish();431 if (finishProgress) progress.Finish(); 417 432 foreach (var progressView in progressViews.Where(v => v.Content == progress).ToList()) { 418 433 progressView.Dispose();
Note: See TracChangeset
for help on using the changeset viewer.