Changeset 15446 for branches/EnhancedProgress
- Timestamp:
- 11/03/17 11:14:27 (7 years ago)
- Location:
- branches/EnhancedProgress
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/EnhancedProgress/HeuristicLab.Analysis.Statistics.Views/3.3/ChartAnalysisView.cs
r14185 r15446 273 273 var task = Task.Factory.StartNew(() => { 274 274 sem.Wait(); 275 progress = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Calculating values..." );275 progress = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Calculating values...", 0); 276 276 RebuildDataTable(resultName, rowName); 277 277 }); -
branches/EnhancedProgress/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r15415 r15446 284 284 // upload tasks 285 285 refreshableJob.Progress.Message = "Uploading tasks..."; 286 286 refreshableJob.Progress.ProgressBarMode = ProgressBarMode.Continuous; 287 refreshableJob.Progress.ProgressValue = 0; 288 287 289 var tasks = new List<TS.Task>(); 288 290 foreach (HiveTask hiveTask in refreshableJob.HiveTasks) { … … 417 419 418 420 refreshableJob.Progress.Message = "Downloading tasks..."; 421 refreshableJob.Progress.ProgressBarMode = ProgressBarMode.Continuous; 422 refreshableJob.Progress.ProgressValue = 0.0; 419 423 downloader = new TaskDownloader(allTasks.Select(x => x.Id)); 420 424 downloader.StartAsync(); … … 433 437 434 438 refreshableJob.Progress.Message = "Downloading/deserializing complete. Displaying tasks..."; 439 refreshableJob.Progress.ProgressBarMode = ProgressBarMode.Marquee; 440 435 441 // build child-task tree 436 442 foreach (HiveTask hiveTask in parents) { -
branches/EnhancedProgress/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBExperimentUploadView.cs
r14185 r15446 210 210 private void UploadAsync() { 211 211 var message = "Uploading runs to OKB..."; 212 IProgress progress = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message );212 IProgress progress = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message, 0); 213 213 double count = dataGridView.Rows.Count; 214 214 int i = 0; -
branches/EnhancedProgress/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs
r15370 r15446 174 174 175 175 try { 176 var progress = mainForm.AddOperationProgressToContent(activeView.Content, "Loading problem instance." );176 var progress = mainForm.AddOperationProgressToContent(activeView.Content, "Loading problem instance.", 0); 177 177 178 178 instanceProvider.ProgressChanged += (o, args) => { progress.ProgressValue = args.ProgressPercentage / 100.0; }; -
branches/EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.cs
r15445 r15446 158 158 159 159 private void UpdateProgressValue() { 160 // prevent problems with object disposal and invoke as suggested by http://stackoverflow.com/a/18647091161 if (!IsHandleCreated) return;162 160 if (InvokeRequired) { 163 try { 164 Invoke((Action)UpdateProgressValue); 165 } catch (InvalidOperationException) { 166 // swallow ObjectDisposedException 167 // which might occur if the invoke call is executed after or while the control is disposing 168 } 161 Invoke((Action)UpdateProgressValue); 169 162 return; 170 163 } -
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 } -
branches/EnhancedProgress/HeuristicLab.MainForm/3.3/Progress.cs
r15445 r15446 101 101 102 102 /// <summary> 103 /// Starts an "undefined" progress in marquee-mode103 /// Starts or restarts an "undefined" progress in marquee-mode 104 104 /// </summary> 105 105 public void Start(string message) { … … 109 109 } 110 110 /// <summary> 111 /// Starts a progress in continuous-mode111 /// Starts or restarts a progress in continuous-mode 112 112 /// </summary> 113 113 public void Start(string message, double progressValue) { -
branches/EnhancedProgress/HeuristicLab.Optimizer/3.3/StartPage.cs
r15235 r15446 88 88 89 89 private void LoadSamples(object state) { 90 progress = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(samplesListView, "Loading..." );90 progress = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(samplesListView, "Loading...", 0); 91 91 try { 92 92 var assembly = Assembly.GetExecutingAssembly(); … … 138 138 }; 139 139 groupLookup[standardProblemsGroup] = standardProblems; 140 var dataAnalysisProblems = new List<string> { "ALPSGP_SymReg", "SGP_SymbClass", "SGP_SymbReg", "OSGP_SymReg", "OSGP_TimeSeries", "GE_SymbReg", "GPR" };140 var dataAnalysisProblems = new List<string> { "ALPSGP_SymReg", "SGP_SymbClass", "SGP_SymbReg", "OSGP_SymReg", "OSGP_TimeSeries", "GE_SymbReg", "GPR" }; 141 141 groupLookup[dataAnalysisGroup] = dataAnalysisProblems; 142 142 var scripts = new List<string> { "GA_QAP_Script", "GUI_Automation_Script", "OSGA_Rastrigin_Script", -
branches/EnhancedProgress/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionInstanceProviderView.cs
r15372 r15446 52 52 try { 53 53 var progress = mainForm.AddOperationProgressToContent(activeView.Content, 54 "Loading problem instance." );54 "Loading problem instance.", 0); 55 55 56 56 Content.ProgressChanged +=
Note: See TracChangeset
for help on using the changeset viewer.