Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/22/13 11:31:32 (11 years ago)
Author:
ascheibe
Message:

#1042

  • changed Hive views to use MainForm for progress handling
  • removed Cancel timeout
  • setter for ProgressState is now private
  • added Start methods to Progress
  • removed unused methods from RefreshableHiveJobView
Location:
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.cs

    r9893 r9894  
    2424
    2525namespace HeuristicLab.MainForm.WindowsForms {
    26   public sealed partial class ProgressView : UserControl {
     26  internal sealed partial class ProgressView : UserControl {
    2727    private readonly Control control;
    2828    public Control Control {
     
    4646        ShowProgress();
    4747      RegisterContentEvents();
     48    }
     49
     50    /// <summary>
     51    /// Clean up any resources being used.
     52    /// </summary>
     53    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
     54    protected override void Dispose(bool disposing) {
     55      DeregisterContentEvents();
     56      HideProgress();
     57
     58      if (disposing && (components != null)) {
     59        components.Dispose();
     60      }
     61      base.Dispose(disposing);
    4862    }
    4963
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.designer.cs

    r9893 r9894  
    2727    private System.ComponentModel.IContainer components = null;
    2828
    29     /// <summary>
    30     /// Clean up any resources being used.
    31     /// </summary>
    32     /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    33     protected override void Dispose(bool disposing) {
    34       DeregisterContentEvents();
    35       if (disposing && (components != null)) {
    36         components.Dispose();
    37       }
    38       base.Dispose(disposing);
    39     }
    40 
     29   
    4130    #region Component Designer generated code
    4231
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs

    r9893 r9894  
    353353    /// Adds a <see cref="ProgressView"/> to the <see cref="ContentView"/>s showing the specified content.
    354354    /// </summary>
    355     public void AddOperationProgressToContent(IContent content, string progressMessage, bool addToObjectGraphObjects = true) {
     355    public IProgress AddOperationProgressToContent(IContent content, string progressMessage, bool addToObjectGraphObjects = true) {
    356356      if (contentProgressLookup.ContainsKey(content))
    357357        throw new ArgumentException("A progress is already registered for the specified content.", "content");
     
    373373
    374374      contentProgressLookup[content] = progress;
     375      return progress;
    375376    }
    376377
     
    378379    /// Adds a <see cref="ProgressView"/> to the specified view.
    379380    /// </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.");
    383390
    384391      var control = view as Control;
    385392      if (control == null) throw new ArgumentException("The passed view must be a control.", "view");
    386393
    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
    388403      progressViews.Add(new ProgressView(control, progress));
    389404      viewProgressLookup[view] = progress;
     
    393408    /// Removes an existing <see cref="ProgressView"/> from the <see cref="ContentView"/>s showing the specified content.
    394409    /// </summary>
    395     public void RemoveOperationProgressFromContent(IContent content) {
     410    public void RemoveOperationProgressFromContent(IContent content, bool finishProgress = true) {
    396411      IProgress progress;
    397412      if (!contentProgressLookup.TryGetValue(content, out progress))
    398413        throw new ArgumentException("No progress is registered for the specified content.", "content");
    399414
    400       progress.Finish();
     415      if (finishProgress) progress.Finish();
    401416      foreach (var progressView in progressViews.Where(v => v.Content == progress).ToList()) {
    402417        progressView.Dispose();
     
    409424    /// Removes an existing <see cref="ProgressView"/> from the specified view.
    410425    /// </summary>
    411     public void RemoveOperationProgressFromView(IView view) {
     426    public void RemoveOperationProgressFromView(IView view, bool finishProgress = true) {
    412427      IProgress progress;
    413428      if (!viewProgressLookup.TryGetValue(view, out progress))
    414429        throw new ArgumentException("No progress is registered for the specified view.", "view");
    415430
    416       progress.Finish();
     431      if (finishProgress) progress.Finish();
    417432      foreach (var progressView in progressViews.Where(v => v.Content == progress).ToList()) {
    418433        progressView.Dispose();
Note: See TracChangeset for help on using the changeset viewer.