- Timestamp:
- 11/03/17 11:14:27 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs
r15415 r15446 61 61 set { 62 62 if (InvokeRequired) { 63 Action<string> action = delegate (string s) { this.Title = s; };63 Action<string> action = delegate (string s) { this.Title = s; }; 64 64 Invoke(action, value); 65 65 } else … … 72 72 set { 73 73 if (InvokeRequired) { 74 Action<Cursor> action = delegate (Cursor c) { this.Cursor = c; };74 Action<Cursor> action = delegate (Cursor c) { this.Cursor = c; }; 75 75 Invoke(action, value); 76 76 } else … … 95 95 if (this.activeView != value) { 96 96 if (InvokeRequired) { 97 Action<IView> action = delegate (IView activeView) { this.ActiveView = activeView; };97 Action<IView> action = delegate (IView activeView) { this.ActiveView = activeView; }; 98 98 Invoke(action, value); 99 99 } else { … … 230 230 } 231 231 232 public IContentView ShowContent<T>(T content, bool reuseExistingView, IEqualityComparer<T> comparer = null) where T : class, IContent {232 public IContentView ShowContent<T>(T content, bool reuseExistingView, IEqualityComparer<T> comparer = null) where T : class, IContent { 233 233 if (content == null) throw new ArgumentNullException("Content cannot be null."); 234 234 if (!reuseExistingView) return ShowContent(content); … … 350 350 private readonly List<ProgressView> progressViews = new List<ProgressView>(); 351 351 352 public IProgress AddOperationProgressToContent(IContent content, string progressMessage, double? initialProgressValue = null, bool addToObjectGraphObjects = true) { 353 var progress = new Progress(); 354 if (initialProgressValue.HasValue) 355 progress.Start(progressMessage, initialProgressValue.Value); 356 else 357 progress.Start(progressMessage); 358 AddOperationProgressToContent(content, progress, addToObjectGraphObjects); 359 return progress; 360 } 352 361 /// <summary> 353 362 /// Adds a <see cref="ProgressView"/> to the <see cref="ContentView"/>s showing the specified content. 354 363 /// </summary> 355 [Obsolete] 356 public IProgress AddOperationProgressToContent(IContent content, string progressMessage, bool addToObjectGraphObjects = true) { 364 public void AddOperationProgressToContent(IContent content, IProgress progress, bool addToObjectGraphObjects = true) { 357 365 if (InvokeRequired) { 358 I Progress result = (IProgress)Invoke((Func<IContent, string, bool, IProgress>)AddOperationProgressToContent, content, progressMessage, addToObjectGraphObjects);359 return result;366 Invoke((Action<IContent, IProgress, bool>)AddOperationProgressToContent, content, progress, addToObjectGraphObjects); 367 return; 360 368 } 361 369 if (contentProgressLookup.ContainsKey(content)) … … 372 380 contentViews = contentViews.Where(v => v.Content == content); 373 381 374 var progress = new Progress();375 progress.Start(progressMessage);376 382 foreach (var contentView in contentViews) { 377 383 progressViews.Add(new ProgressView(contentView, progress)); … … 379 385 380 386 contentProgressLookup[content] = progress; 387 } 388 389 public IProgress AddOperationProgressToView(Control control, string progressMessage, double? initialProgressValue = null) { 390 var progress = new Progress(); 391 if (initialProgressValue.HasValue) 392 progress.Start(progressMessage, initialProgressValue.Value); 393 else 394 progress.Start(progressMessage); 395 AddOperationProgressToView(control, progress); 381 396 return progress; 382 397 } 383 384 398 /// <summary> 385 399 /// Adds a <see cref="ProgressView"/> to the specified view. 386 400 /// </summary> 387 [Obsolete]388 public IProgress AddOperationProgressToView(Control control, string progressMessage) {389 var progress = new Progress();390 progress.Start(progressMessage);391 AddOperationProgressToView(control, progress);392 return progress;393 }394 395 401 public void AddOperationProgressToView(Control control, IProgress progress) { 396 402 if (InvokeRequired) { … … 564 570 try { 565 571 ((IActionUserInterfaceItem)item.Tag).Execute(); 566 } 567 catch (Exception ex) { 572 } catch (Exception ex) { 568 573 ErrorHandling.ShowErrorDialog((Control)MainFormManager.MainForm, ex); 569 574 }
Note: See TracChangeset
for help on using the changeset viewer.