- Timestamp:
- 11/16/17 10:30:21 (7 years ago)
- Location:
- branches/EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/HeuristicLab.MainForm.WindowsForms-3.3.csproj
r11623 r15477 151 151 </Compile> 152 152 <Compile Include="Plugin.cs" /> 153 <Compile Include="Progress.cs" /> 153 154 <Compile Include="Views\AsynchronousContentView.cs"> 154 155 <SubType>UserControl</SubType> -
branches/EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs
r15446 r15477 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 else357 progress.Start(progressMessage);358 AddOperationProgressToContent(content, progress, addToObjectGraphObjects);359 return progress;360 }361 352 /// <summary> 362 353 /// Adds a <see cref="ProgressView"/> to the <see cref="ContentView"/>s showing the specified content. 363 354 /// </summary> 364 public void Add OperationProgressToContent(IContent content, IProgress progress, bool addToObjectGraphObjects = true) {355 public void AddProgressToContent(IContent content, IProgress progress, bool addToObjectGraphObjects = true) { 365 356 if (InvokeRequired) { 366 Invoke((Action<IContent, IProgress, bool>)Add OperationProgressToContent, content, progress, addToObjectGraphObjects);357 Invoke((Action<IContent, IProgress, bool>)AddProgressToContent, content, progress, addToObjectGraphObjects); 367 358 return; 368 359 } … … 387 378 } 388 379 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 else394 progress.Start(progressMessage);395 AddOperationProgressToView(control, progress);396 return progress;397 }398 380 /// <summary> 399 381 /// Adds a <see cref="ProgressView"/> to the specified view. 400 382 /// </summary> 401 public void Add OperationProgressToView(Control control, IProgress progress) {383 public void AddProgressToView(Control control, IProgress progress) { 402 384 if (InvokeRequired) { 403 Invoke((Action<Control, IProgress>)Add OperationProgressToView, control, progress);385 Invoke((Action<Control, IProgress>)AddProgressToView, control, progress); 404 386 return; 405 387 } … … 423 405 /// Removes an existing <see cref="ProgressView"/> from the <see cref="ContentView"/>s showing the specified content. 424 406 /// </summary> 425 public void Remove OperationProgressFromContent(IContent content, bool finishProgress = true) {407 public void RemoveProgressFromContent(IContent content, bool finishProgress = true) { 426 408 if (InvokeRequired) { 427 Invoke((Action<IContent, bool>)Remove OperationProgressFromContent, content, finishProgress);409 Invoke((Action<IContent, bool>)RemoveProgressFromContent, content, finishProgress); 428 410 return; 429 411 } … … 439 421 } 440 422 contentProgressLookup.Remove(content); 441 442 423 } 443 424 … … 445 426 /// Removes an existing <see cref="ProgressView"/> from the specified view. 446 427 /// </summary> 447 public void Remove OperationProgressFromView(Control control, bool finishProgress = true) {428 public void RemoveProgressFromView(Control control, bool finishProgress = true) { 448 429 if (InvokeRequired) { 449 Invoke((Action<Control, bool>)Remove OperationProgressFromView, control, finishProgress);430 Invoke((Action<Control, bool>)RemoveProgressFromView, control, finishProgress); 450 431 return; 451 432 } -
branches/EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/Progress.cs
r15466 r15477 21 21 22 22 using System; 23 using System.Windows.Forms; 24 using HeuristicLab.Common; 23 25 24 26 namespace HeuristicLab.MainForm { … … 100 102 } 101 103 102 /// <summary> 103 /// Starts or restarts an "undefined" progress in marquee-mode 104 /// </summary> 105 public void Start(string message) { 106 ProgressState = ProgressState.Started; 107 ProgressBarMode = ProgressBarMode.Marquee; 108 Message = message; 109 } 110 /// <summary> 111 /// Starts or restarts a progress in continuous-mode 112 /// </summary> 113 public void Start(string message, double progressValue) { 104 public void Start(string message, double progressValue = 0) { 114 105 ProgressState = ProgressState.Started; 115 106 ProgressBarMode = ProgressBarMode.Continuous; 116 107 ProgressValue = progressValue; 108 Message = message; 109 } 110 public void StartMarquee(string message) { 111 ProgressState = ProgressState.Started; 112 ProgressBarMode = ProgressBarMode.Marquee; 117 113 Message = message; 118 114 } … … 137 133 } 138 134 135 #region Show/Hide Progress 136 /// <summary> 137 /// Shows a started Progress in Continuous-mode on all Views of the specified content. 138 /// </summary> 139 public static IProgress Show(IContent content, string progressMessage, double initialProgressValue = 0, bool addToObjectGraphObjects = true) { 140 var progress = new Progress(); 141 progress.Start(progressMessage, initialProgressValue); 142 MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToContent(content, progress, addToObjectGraphObjects); 143 return progress; 144 } 145 /// <summary> 146 /// Shows a started Progress in Marquee-mode on all Views of the specified content. 147 /// </summary> 148 public static IProgress ShowMarquee(IContent content, string progressMessage, bool addToObjectGraphObjects = true) { 149 var progress = new Progress(); 150 progress.StartMarquee(progressMessage); 151 MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToContent(content, progress, addToObjectGraphObjects); 152 return progress; 153 } 154 155 /// <summary> 156 /// Shows a started Progress in Continuous-mode on the specified view. 157 /// </summary> 158 public static IProgress Show(Control control, string progressMessage, double initialProgressValue = 0) { 159 var progress = new Progress(); 160 progress.Start(progressMessage, initialProgressValue); 161 MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToView(control, progress); 162 return progress; 163 } 164 /// <summary> 165 /// Shows a started Progress in Marquee-mode on the specified view. 166 /// </summary> 167 public static IProgress ShowMarquee(Control control, string progressMessage) { 168 var progress = new Progress(); 169 progress.StartMarquee(progressMessage); 170 MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToView(control, progress); 171 return progress; 172 } 173 174 /// <summary> 175 /// Hides the Progress fom all Views of the specified content. 176 /// </summary> 177 public static void Hide(IContent content) { 178 MainFormManager.GetMainForm<WindowsForms.MainForm>().RemoveProgressFromContent(content); 179 } 180 /// <summary> 181 /// Hides the Progress fom the specified view. 182 /// </summary> 183 public static void Hide(Control control) { 184 MainFormManager.GetMainForm<WindowsForms.MainForm>().RemoveProgressFromView(control); 185 } 186 #endregion 187 139 188 #region Event Handler 140 189 public event EventHandler ProgressStateChanged;
Note: See TracChangeset
for help on using the changeset viewer.