Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/12 16:46:35 (12 years ago)
Author:
gkronber
Message:

#1847: merged r8084:8205 from trunk into GP move operators branch

Location:
branches/GP-MoveOperators
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/GP-MoveOperators

  • branches/GP-MoveOperators/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/EqualityComparisonBoolFilterView.cs

    r8055 r8206  
    5252    private void valueComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
    5353      if (Content != null) {
    54         Content.Value = valueComboBox.SelectedItem == "true" ? true : false;
     54        Content.Value = valueComboBox.SelectedItem.ToString() == "true";
    5555      }
    5656    }
  • branches/GP-MoveOperators/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/EqualityComparisonFilterView.cs

    r8055 r8206  
    5454    private void comparisonComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
    5555      if (Content != null) {
    56         if (comparisonComboBox.SelectedItem == "=")
     56        if (comparisonComboBox.SelectedItem.ToString() == "=")
    5757          Content.Comparison = EqualityComparison.Equal;
    58         else if (comparisonComboBox.SelectedItem == "<>")
     58        else if (comparisonComboBox.SelectedItem.ToString() == "<>")
    5959          Content.Comparison = EqualityComparison.NotEqual;
    6060      }
  • branches/GP-MoveOperators/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/OrdinalComparisonFilterView.cs

    r8055 r8206  
    6363    private void comparisonComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
    6464      if (Content != null) {
    65         if (comparisonComboBox.SelectedItem == "<")
     65        if (comparisonComboBox.SelectedItem.ToString() == "<")
    6666          Content.Comparison = OrdinalComparison.Less;
    67         else if (comparisonComboBox.SelectedItem == "<=")
     67        else if (comparisonComboBox.SelectedItem.ToString() == "<=")
    6868          Content.Comparison = OrdinalComparison.LessOrEqual;
    69         else if (comparisonComboBox.SelectedItem == "=")
     69        else if (comparisonComboBox.SelectedItem.ToString() == "=")
    7070          Content.Comparison = OrdinalComparison.Equal;
    71         else if (comparisonComboBox.SelectedItem == ">=")
     71        else if (comparisonComboBox.SelectedItem.ToString() == ">=")
    7272          Content.Comparison = OrdinalComparison.GreaterOrEqual;
    73         else if (comparisonComboBox.SelectedItem == ">")
     73        else if (comparisonComboBox.SelectedItem.ToString() == ">")
    7474          Content.Comparison = OrdinalComparison.Greater;
    75         else if (comparisonComboBox.SelectedItem == "<>")
     75        else if (comparisonComboBox.SelectedItem.ToString() == "<>")
    7676          Content.Comparison = OrdinalComparison.NotEqual;
    7777      }
  • branches/GP-MoveOperators/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/StringComparisonAvailableValuesFilterView.cs

    r8055 r8206  
    6666    private void comparisonComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
    6767      if (Content != null) {
    68         if (comparisonComboBox.SelectedItem == "=")
     68        if (comparisonComboBox.SelectedItem.ToString() == "=")
    6969          Content.Comparison = StringComparison.Equal;
    70         else if (comparisonComboBox.SelectedItem == "<>")
     70        else if (comparisonComboBox.SelectedItem.ToString() == "<>")
    7171          Content.Comparison = StringComparison.NotEqual;
    72         else if (comparisonComboBox.SelectedItem == "contains")
     72        else if (comparisonComboBox.SelectedItem.ToString() == "contains")
    7373          Content.Comparison = StringComparison.Contains;
    74         else if (comparisonComboBox.SelectedItem == "not contains")
     74        else if (comparisonComboBox.SelectedItem.ToString() == "not contains")
    7575          Content.Comparison = StringComparison.NotContains;
    76         else if (comparisonComboBox.SelectedItem == "like")
     76        else if (comparisonComboBox.SelectedItem.ToString() == "like")
    7777          Content.Comparison = StringComparison.Like;
    78         else if (comparisonComboBox.SelectedItem == "not like")
     78        else if (comparisonComboBox.SelectedItem.ToString() == "not like")
    7979          Content.Comparison = StringComparison.NotLike;
    8080      }
  • branches/GP-MoveOperators/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/StringComparisonFilterView.cs

    r8055 r8206  
    6666    private void comparisonComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
    6767      if (Content != null) {
    68         if (comparisonComboBox.SelectedItem == "=")
     68        if (comparisonComboBox.SelectedItem.ToString() == "=")
    6969          Content.Comparison = StringComparison.Equal;
    70         else if (comparisonComboBox.SelectedItem == "<>")
     70        else if (comparisonComboBox.SelectedItem.ToString() == "<>")
    7171          Content.Comparison = StringComparison.NotEqual;
    72         else if (comparisonComboBox.SelectedItem == "contains")
     72        else if (comparisonComboBox.SelectedItem.ToString() == "contains")
    7373          Content.Comparison = StringComparison.Contains;
    74         else if (comparisonComboBox.SelectedItem == "not contains")
     74        else if (comparisonComboBox.SelectedItem.ToString() == "not contains")
    7575          Content.Comparison = StringComparison.NotContains;
    76         else if (comparisonComboBox.SelectedItem == "like")
     76        else if (comparisonComboBox.SelectedItem.ToString() == "like")
    7777          Content.Comparison = StringComparison.Like;
    78         else if (comparisonComboBox.SelectedItem == "not like")
     78        else if (comparisonComboBox.SelectedItem.ToString() == "not like")
    7979          Content.Comparison = StringComparison.NotLike;
    8080      }
  • branches/GP-MoveOperators/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBExperimentUploadView.cs

    r8055 r8206  
    3535namespace HeuristicLab.Clients.OKB.RunCreation {
    3636  [View("OKBExperimentUpload View")]
    37   [Content(typeof(RunCollection), false)]
    3837  [Content(typeof(IOptimizer), false)]
    3938  public partial class OKBExperimentUploadView : ItemView {
    4039    public new IOptimizer Content {
    4140      get { return (IOptimizer)base.Content; }
    42       set {
    43         base.Content = value;
    44       }
     41      set { base.Content = value; }
    4542    }
    4643
     
    5855    Problem selectedProblem = null;
    5956    private ProgressView progressView;
     57    private Progress progress;
    6058
    6159    public OKBExperimentUploadView() {
    6260      InitializeComponent();
     61      progress = new Progress() {
     62        CanBeCanceled = false,
     63        ProgressState = ProgressState.Finished
     64      };
    6365    }
    6466
     
    9496      RunCreationClient.Instance.Refreshing += new EventHandler(RunCreationClient_Refreshing);
    9597      RunCreationClient.Instance.Refreshed += new EventHandler(RunCreationClient_Refreshed);
     98      progressView = new ProgressView(this, progress);
    9699    }
    97100
     
    99102      RunCreationClient.Instance.Refreshing -= new EventHandler(RunCreationClient_Refreshing);
    100103      RunCreationClient.Instance.Refreshed -= new EventHandler(RunCreationClient_Refreshed);
     104      if (progressView != null) {
     105        progressView.Content = null;
     106        progressView.Dispose();
     107        progressView = null;
     108      }
    101109      base.DeregisterContentEvents();
    102110    }
     
    108116    private void DisplayRuns(RunCollection runs) {
    109117      if (RunCreationClient.Instance.Algorithms == null || RunCreationClient.Instance.Algorithms.Count() == 0) {
    110         RunCreationClient.Instance.RefreshAsync(DisplayError);
     118        Action a = new Action(delegate {
     119          RunCreationClient.Instance.Refresh();
     120          CreateUI(runs);
     121        });
     122
     123        Task.Factory.StartNew(a).ContinueWith((t) => { DisplayError(t.Exception); }, TaskContinuationOptions.OnlyOnFaulted);
    111124      } else {
    112125        CreateUI(runs);
     
    115128
    116129    private void CreateUI(RunCollection runs) {
    117       if (problems.Count == 0)
    118         problems.AddRange(RunCreationClient.Instance.Problems);
    119       if (algorithms.Count == 0)
    120         algorithms.AddRange(RunCreationClient.Instance.Algorithms);
    121 
    122       IItem algorithmType;
    123       IItem problemType;
    124       IItem algorithmName;
    125       IItem problemName;
    126 
    127       DataGridViewComboBoxColumn cmbAlgorithm = dataGridView.Columns[algorithmColumnIndex] as DataGridViewComboBoxColumn;
    128       cmbAlgorithm.DataSource = algorithms;
    129       cmbAlgorithm.DisplayMember = "Name";
    130 
    131       DataGridViewComboBoxColumn cmbProblem = dataGridView.Columns[problemColumnIndex] as DataGridViewComboBoxColumn;
    132       cmbProblem.DataSource = problems;
    133       cmbProblem.DisplayMember = "Name";
    134 
    135       foreach (IRun run in runs) {
    136         int idx = dataGridView.Rows.Add(run.Name);
    137         DataGridViewRow curRow = dataGridView.Rows[idx];
    138         curRow.Tag = run;
    139 
    140         if (run.Parameters.TryGetValue(algorithmTypeParameterName, out algorithmType)) {
    141           HeuristicLab.Data.StringValue algStr = algorithmType as HeuristicLab.Data.StringValue;
    142           if (algStr != null) {
    143             curRow.Cells[1].Value = algStr;
    144           }
    145         }
    146 
    147         if (run.Parameters.TryGetValue(algorithmNameParameterName, out algorithmName)) {
    148           HeuristicLab.Data.StringValue algStr = algorithmName as HeuristicLab.Data.StringValue;
    149           if (algStr != null) {
    150             curRow.Cells[2].Value = algStr;
    151           }
    152         }
    153 
    154         if (run.Parameters.TryGetValue(problemTypeParameterName, out problemType)) {
    155           HeuristicLab.Data.StringValue prbStr = problemType as HeuristicLab.Data.StringValue;
    156           if (prbStr != null) {
    157             curRow.Cells[4].Value = prbStr;
    158           }
    159         }
    160 
    161         if (run.Parameters.TryGetValue(problemNameParameterName, out problemName)) {
    162           HeuristicLab.Data.StringValue prbStr = problemName as HeuristicLab.Data.StringValue;
    163           if (prbStr != null) {
    164             curRow.Cells[5].Value = prbStr;
     130      if (InvokeRequired) {
     131        Invoke(new Action<RunCollection>(CreateUI), runs);
     132      } else {
     133        if (problems.Count == 0)
     134          problems.AddRange(RunCreationClient.Instance.Problems);
     135        if (algorithms.Count == 0)
     136          algorithms.AddRange(RunCreationClient.Instance.Algorithms);
     137
     138        IItem algorithmType;
     139        IItem problemType;
     140        IItem algorithmName;
     141        IItem problemName;
     142
     143        DataGridViewComboBoxColumn cmbAlgorithm = dataGridView.Columns[algorithmColumnIndex] as DataGridViewComboBoxColumn;
     144        cmbAlgorithm.DataSource = algorithms;
     145        cmbAlgorithm.DisplayMember = "Name";
     146
     147        DataGridViewComboBoxColumn cmbProblem = dataGridView.Columns[problemColumnIndex] as DataGridViewComboBoxColumn;
     148        cmbProblem.DataSource = problems;
     149        cmbProblem.DisplayMember = "Name";
     150
     151        foreach (IRun run in runs) {
     152          int idx = dataGridView.Rows.Add(run.Name);
     153          DataGridViewRow curRow = dataGridView.Rows[idx];
     154          curRow.Tag = run;
     155
     156          if (run.Parameters.TryGetValue(algorithmTypeParameterName, out algorithmType)) {
     157            HeuristicLab.Data.StringValue algStr = algorithmType as HeuristicLab.Data.StringValue;
     158            if (algStr != null) {
     159              curRow.Cells[1].Value = algStr;
     160            }
     161          }
     162
     163          if (run.Parameters.TryGetValue(algorithmNameParameterName, out algorithmName)) {
     164            HeuristicLab.Data.StringValue algStr = algorithmName as HeuristicLab.Data.StringValue;
     165            if (algStr != null) {
     166              curRow.Cells[2].Value = algStr;
     167            }
     168          }
     169
     170          if (run.Parameters.TryGetValue(problemTypeParameterName, out problemType)) {
     171            HeuristicLab.Data.StringValue prbStr = problemType as HeuristicLab.Data.StringValue;
     172            if (prbStr != null) {
     173              curRow.Cells[4].Value = prbStr;
     174            }
     175          }
     176
     177          if (run.Parameters.TryGetValue(problemNameParameterName, out problemName)) {
     178            HeuristicLab.Data.StringValue prbStr = problemName as HeuristicLab.Data.StringValue;
     179            if (prbStr != null) {
     180              curRow.Cells[5].Value = prbStr;
     181            }
    165182          }
    166183        }
     
    169186
    170187    private void ClearRuns() {
    171       dataGridView.Rows.Clear();
    172       runs.Clear();
     188      if (InvokeRequired) {
     189        Invoke(new Action(ClearRuns));
     190      } else {
     191        dataGridView.Rows.Clear();
     192        runs.Clear();
     193      }
    173194    }
    174195
     
    177198        Invoke(new EventHandler(RunCreationClient_Refreshing), sender, e);
    178199      } else {
    179         IProgress prog = new Progress();
    180         prog.Status = "Refreshing algorithms and problems...";
    181         SetProgressView(prog);
     200        progress.Status = "Refreshing algorithms and problems...";
     201        progress.ProgressState = ProgressState.Started;
    182202      }
    183203    }
     
    187207        Invoke(new EventHandler(RunCreationClient_Refreshed), sender, e);
    188208      } else {
    189         FinishProgressView();
     209        progress.Finish();
    190210        SetEnabledStateOfControls();
    191211      }
     
    195215      var task = System.Threading.Tasks.Task.Factory.StartNew(UploadAsync);
    196216      task.ContinueWith((t) => {
    197         FinishProgressView();
     217        progress.Finish();
    198218        PluginInfrastructure.ErrorHandling.ShowErrorDialog("An exception occured while uploading the runs to the OKB.", t.Exception);
    199219      }, TaskContinuationOptions.OnlyOnFaulted);
     
    201221
    202222    private void UploadAsync() {
    203       IProgress prog = new Progress();
    204       prog.Status = "Uploading runs to OKB...";
    205       prog.ProgressValue = 0;
     223      progress.Status = "Uploading runs to OKB...";
     224      progress.ProgressValue = 0;
     225      progress.ProgressState = ProgressState.Started;
    206226      double count = dataGridView.Rows.Count;
    207227      int i = 0;
    208 
    209       SetProgressView(prog);
    210228      foreach (DataGridViewRow row in dataGridView.Rows) {
    211229        selectedAlgorithm = algorithms.Where(x => x.Name == row.Cells[algorithmColumnIndex].Value.ToString()).FirstOrDefault();
     
    218236        run.Store();
    219237        i++;
    220         prog.ProgressValue = ((double)i) / count;
    221       }
    222       FinishProgressView();
    223     }
    224 
    225     private void SetProgressView(IProgress progress) {
    226       if (InvokeRequired) {
    227         Invoke(new Action<IProgress>(SetProgressView), progress);
    228       } else {
    229         if (progressView == null) {
    230           progressView = new ProgressView(this, progress);
    231         } else {
    232           progressView.Progress = progress;
    233         }
    234       }
    235     }
    236 
    237     private void FinishProgressView() {
    238       if (InvokeRequired) {
    239         Invoke(new Action(FinishProgressView));
    240       } else {
    241         if (progressView != null) {
    242           progressView.Finish();
    243           progressView = null;
    244           SetEnabledStateOfControls();
    245           ClearRuns();
    246         }
    247       }
     238        progress.ProgressValue = ((double)i) / count;
     239      }
     240      progress.Finish();
     241      ClearRuns();
    248242    }
    249243
Note: See TracChangeset for help on using the changeset viewer.