Changeset 9933 for stable/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks
- Timestamp:
- 09/03/13 15:55:36 (11 years ago)
- Location:
- stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 9849,9851,9865,9867-9868,9893-9896,9900-9901,9905,9907
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.cs
r9456 r9933 31 31 [Content(typeof(OptimizerHiveTask), true)] 32 32 public partial class OptimizerHiveTaskView : HiveTaskView { 33 private Progress progress;34 private ProgressView progressView;35 36 33 public new OptimizerHiveTask Content { 37 34 get { return (OptimizerHiveTask)base.Content; } … … 45 42 public OptimizerHiveTaskView() { 46 43 InitializeComponent(); 47 progress = new Progress() {48 CanBeCanceled = false,49 ProgressState = ProgressState.Finished50 };51 44 } 52 45 … … 60 53 } 61 54 } 55 62 56 #region Content Events 63 57 protected override void RegisterContentEvents() { 64 58 base.RegisterContentEvents(); 65 59 Content.IsControllableChanged += new EventHandler(Content_IsControllableChanged); 66 progressView = new ProgressView(this, progress);60 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, Content.Progress); 67 61 } 68 62 69 63 protected override void DeregisterContentEvents() { 70 64 Content.IsControllableChanged -= new EventHandler(Content_IsControllableChanged); 71 if (progressView != null) { 72 progressView.Content = null; 73 progressView.Dispose(); 74 progressView = null; 75 } 65 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false); 76 66 base.DeregisterContentEvents(); 77 67 } … … 80 70 SetEnabledStateOfControls(); 81 71 } 82 83 72 #endregion 84 73 … … 87 76 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeTaskAsync); 88 77 task.ContinueWith((t) => { 89 progress.Finish();78 Content.Progress.Finish(); 90 79 ErrorHandling.ShowErrorDialog(this, "An error occured while resuming the task.", t.Exception); 91 80 }, TaskContinuationOptions.OnlyOnFaulted); … … 95 84 var task = System.Threading.Tasks.Task.Factory.StartNew(PauseTaskAsync); 96 85 task.ContinueWith((t) => { 97 progress.Finish();86 Content.Progress.Finish(); 98 87 ErrorHandling.ShowErrorDialog(this, "An error occured while pausing the task.", t.Exception); 99 88 }, TaskContinuationOptions.OnlyOnFaulted); … … 103 92 var task = System.Threading.Tasks.Task.Factory.StartNew(StopTaskAsync); 104 93 task.ContinueWith((t) => { 105 progress.Finish();94 Content.Progress.Finish(); 106 95 ErrorHandling.ShowErrorDialog(this, "An error occured while stopping the task.", t.Exception); 107 96 }, TaskContinuationOptions.OnlyOnFaulted); … … 110 99 111 100 private void PauseTaskAsync() { 112 progress.Status = "Pausing task. Please be patient for the command to take effect."; 113 progress.ProgressState = ProgressState.Started; 101 Content.Progress.Start("Pausing task. Please be patient for the command to take effect."); 114 102 Content.Pause(); 115 progress.Finish();103 Content.Progress.Finish(); 116 104 } 117 105 118 106 private void StopTaskAsync() { 119 progress.Status = "Stopping task. Please be patient for the command to take effect."; 120 progress.ProgressState = ProgressState.Started; 107 Content.Progress.Start("Stopping task. Please be patient for the command to take effect."); 121 108 Content.Stop(); 122 progress.Finish();109 Content.Progress.Finish(); 123 110 } 124 111 125 112 private void ResumeTaskAsync() { 126 progress.Status = "Resuming task. Please be patient for the command to take effect."; 127 progress.ProgressState = ProgressState.Started; 113 Content.Progress.Start("Resuming task. Please be patient for the command to take effect."); 128 114 Content.Restart(); 129 progress.Finish();115 Content.Progress.Finish(); 130 116 } 131 117
Note: See TracChangeset
for help on using the changeset viewer.