Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/28/12 12:00:51 (12 years ago)
Author:
ascheibe
Message:

#1762 implemented review comments:

  • removed self disposing. The progress view now reacts if a progress is set and Finish() is now called on the progress object and not the view.
  • Moved Cancel event from ProgressView to Progress
  • throw ArgumentNullException if the parent view is null
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBExperimentUploadView.cs

    r8117 r8145  
    5757    Problem selectedProblem = null;
    5858    private ProgressView progressView;
     59    private IProgress progress;
    5960
    6061    public OKBExperimentUploadView() {
    6162      InitializeComponent();
     63      progressView = new ProgressView(this);
    6264    }
    6365
     
    176178        Invoke(new EventHandler(RunCreationClient_Refreshing), sender, e);
    177179      } else {
    178         IProgress prog = new Progress();
    179         prog.Status = "Refreshing algorithms and problems...";
    180         SetProgressView(prog);
     180        progress = new Progress();
     181        progress.Status = "Refreshing algorithms and problems...";
     182        SetProgressView(progress);
    181183      }
    182184    }
     
    200202
    201203    private void UploadAsync() {
    202       IProgress prog = new Progress();
    203       prog.Status = "Uploading runs to OKB...";
    204       prog.ProgressValue = 0;
     204      progress = new Progress();
     205      progress.Status = "Uploading runs to OKB...";
     206      progress.ProgressValue = 0;
    205207      double count = dataGridView.Rows.Count;
    206208      int i = 0;
    207209
    208       SetProgressView(prog);
     210      SetProgressView(progress);
    209211      foreach (DataGridViewRow row in dataGridView.Rows) {
    210212        selectedAlgorithm = algorithms.Where(x => x.Name == row.Cells[algorithmColumnIndex].Value.ToString()).FirstOrDefault();
     
    217219        run.Store();
    218220        i++;
    219         prog.ProgressValue = ((double)i) / count;
     221        progress.ProgressValue = ((double)i) / count;
    220222      }
    221223      FinishProgressView();
     
    226228        Invoke(new Action<IProgress>(SetProgressView), progress);
    227229      } else {
    228         if (progressView == null) {
    229           progressView = new ProgressView(this, progress);
    230         } else {
    231           progressView.Progress = progress;
    232         }
     230        progressView.Progress = progress;
    233231      }
    234232    }
     
    238236        Invoke(new Action(FinishProgressView));
    239237      } else {
    240         if (progressView != null) {
    241           progressView.Finish();
    242           progressView = null;
    243           SetEnabledStateOfControls();
    244           ClearRuns();
    245         }
     238        progress.Finish();
     239        SetEnabledStateOfControls();
     240        ClearRuns();
    246241      }
    247242    }
Note: See TracChangeset for help on using the changeset viewer.