Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/28/17 22:14:18 (7 years ago)
Author:
gkronber
Message:

#2588 merged r13682, r13683, r13684, r13690:13693, r13709, r13746 from trunk to stable

Location:
stable
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Clients.OKB.Views/3.3/HeuristicLab.Clients.OKB.Views-3.3.csproj

    r15081 r15082  
    286286      <DependentUpon>OKBRunView.cs</DependentUpon>
    287287    </Compile>
     288    <Compile Include="RunCreation\Views\SingleObjectiveOKBSolutionView.cs">
     289      <SubType>UserControl</SubType>
     290    </Compile>
     291    <Compile Include="RunCreation\Views\SingleObjectiveOKBSolutionView.Designer.cs">
     292      <DependentUpon>SingleObjectiveOKBSolutionView.cs</DependentUpon>
     293    </Compile>
    288294    <None Include="Plugin.cs.frame" />
    289295    <None Include="Properties\AssemblyInfo.cs.frame" />
  • stable/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.Designer.cs

    r15081 r15082  
    5252      this.parametersTabPage = new System.Windows.Forms.TabPage();
    5353      this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
     54      this.solutionsTabPage = new System.Windows.Forms.TabPage();
    5455      this.flaAnalysisTabPage = new System.Windows.Forms.TabPage();
     56      this.flaSplitContainer = new System.Windows.Forms.SplitContainer();
    5557      this.calculateButton = new System.Windows.Forms.Button();
    56       this.flaSplitContainer = new System.Windows.Forms.SplitContainer();
    5758      this.characteristicsMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();
    5859      this.uploadCharacteristicsButton = new System.Windows.Forms.Button();
    5960      this.downloadCharacteristicsButton = new System.Windows.Forms.Button();
     61      this.solutionsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     62      this.refreshSolutionsButton = new System.Windows.Forms.Button();
     63      this.uploadSolutionsButton = new System.Windows.Forms.Button();
    6064      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    6165      this.tabControl.SuspendLayout();
    6266      this.parametersTabPage.SuspendLayout();
     67      this.solutionsTabPage.SuspendLayout();
    6368      this.flaAnalysisTabPage.SuspendLayout();
    6469      ((System.ComponentModel.ISupportInitialize)(this.flaSplitContainer)).BeginInit();
     
    135140            | System.Windows.Forms.AnchorStyles.Right)));
    136141      this.tabControl.Controls.Add(this.parametersTabPage);
     142      this.tabControl.Controls.Add(this.solutionsTabPage);
    137143      this.tabControl.Controls.Add(this.flaAnalysisTabPage);
    138144      this.tabControl.Location = new System.Drawing.Point(6, 53);
     
    148154      this.parametersTabPage.Name = "parametersTabPage";
    149155      this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
    150       this.parametersTabPage.Size = new System.Drawing.Size(692, 314);
     156      this.parametersTabPage.Size = new System.Drawing.Size(728, 447);
    151157      this.parametersTabPage.TabIndex = 0;
    152158      this.parametersTabPage.Text = "Parameters";
     
    163169      this.parameterCollectionView.ReadOnly = true;
    164170      this.parameterCollectionView.ShowDetails = true;
    165       this.parameterCollectionView.Size = new System.Drawing.Size(686, 308);
     171      this.parameterCollectionView.Size = new System.Drawing.Size(722, 441);
    166172      this.parameterCollectionView.TabIndex = 8;
     173      //
     174      // solutionsTabPage
     175      //
     176      this.solutionsTabPage.Controls.Add(this.uploadSolutionsButton);
     177      this.solutionsTabPage.Controls.Add(this.refreshSolutionsButton);
     178      this.solutionsTabPage.Controls.Add(this.solutionsViewHost);
     179      this.solutionsTabPage.Location = new System.Drawing.Point(4, 22);
     180      this.solutionsTabPage.Name = "solutionsTabPage";
     181      this.solutionsTabPage.Padding = new System.Windows.Forms.Padding(3);
     182      this.solutionsTabPage.Size = new System.Drawing.Size(728, 447);
     183      this.solutionsTabPage.TabIndex = 3;
     184      this.solutionsTabPage.Text = "Solutions";
     185      this.solutionsTabPage.UseVisualStyleBackColor = true;
    167186      //
    168187      // flaAnalysisTabPage
     
    177196      this.flaAnalysisTabPage.UseVisualStyleBackColor = true;
    178197      //
     198      // flaSplitContainer
     199      //
     200      this.flaSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
     201      this.flaSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
     202      this.flaSplitContainer.Location = new System.Drawing.Point(3, 3);
     203      this.flaSplitContainer.Name = "flaSplitContainer";
     204      //
     205      // flaSplitContainer.Panel1
     206      //
     207      this.flaSplitContainer.Panel1.Controls.Add(this.calculateButton);
     208      //
     209      // flaSplitContainer.Panel2
     210      //
     211      this.flaSplitContainer.Panel2.Controls.Add(this.characteristicsMatrixView);
     212      this.flaSplitContainer.Panel2.Controls.Add(this.uploadCharacteristicsButton);
     213      this.flaSplitContainer.Panel2.Controls.Add(this.downloadCharacteristicsButton);
     214      this.flaSplitContainer.Size = new System.Drawing.Size(722, 441);
     215      this.flaSplitContainer.SplitterDistance = 363;
     216      this.flaSplitContainer.TabIndex = 7;
     217      //
    179218      // calculateButton
    180219      //
     
    186225      this.calculateButton.UseVisualStyleBackColor = true;
    187226      this.calculateButton.Click += new System.EventHandler(this.calculateButton_Click);
    188       //
    189       // flaSplitContainer
    190       //
    191       this.flaSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
    192       this.flaSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
    193       this.flaSplitContainer.Location = new System.Drawing.Point(3, 3);
    194       this.flaSplitContainer.Name = "flaSplitContainer";
    195       //
    196       // flaSplitContainer.Panel1
    197       //
    198       this.flaSplitContainer.Panel1.Controls.Add(this.calculateButton);
    199       //
    200       // flaSplitContainer.Panel2
    201       //
    202       this.flaSplitContainer.Panel2.Controls.Add(this.characteristicsMatrixView);
    203       this.flaSplitContainer.Panel2.Controls.Add(this.uploadCharacteristicsButton);
    204       this.flaSplitContainer.Panel2.Controls.Add(this.downloadCharacteristicsButton);
    205       this.flaSplitContainer.Size = new System.Drawing.Size(722, 441);
    206       this.flaSplitContainer.SplitterDistance = 363;
    207       this.flaSplitContainer.TabIndex = 7;
    208227      //
    209228      // characteristicsMatrixView
     
    241260      this.downloadCharacteristicsButton.UseVisualStyleBackColor = true;
    242261      this.downloadCharacteristicsButton.Click += new System.EventHandler(this.downloadCharacteristicsButton_Click);
     262      //
     263      // solutionsViewHost
     264      //
     265      this.solutionsViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     266            | System.Windows.Forms.AnchorStyles.Left)
     267            | System.Windows.Forms.AnchorStyles.Right)));
     268      this.solutionsViewHost.Caption = "View";
     269      this.solutionsViewHost.Content = null;
     270      this.solutionsViewHost.Enabled = false;
     271      this.solutionsViewHost.Location = new System.Drawing.Point(0, 35);
     272      this.solutionsViewHost.Name = "solutionsViewHost";
     273      this.solutionsViewHost.ReadOnly = false;
     274      this.solutionsViewHost.Size = new System.Drawing.Size(728, 412);
     275      this.solutionsViewHost.TabIndex = 0;
     276      this.solutionsViewHost.ViewsLabelVisible = true;
     277      this.solutionsViewHost.ViewType = null;
     278      //
     279      // refreshSolutionsButton
     280      //
     281      this.refreshSolutionsButton.Location = new System.Drawing.Point(6, 6);
     282      this.refreshSolutionsButton.Name = "refreshSolutionsButton";
     283      this.refreshSolutionsButton.Size = new System.Drawing.Size(26, 23);
     284      this.refreshSolutionsButton.TabIndex = 1;
     285      this.refreshSolutionsButton.Text = "Refresh";
     286      this.refreshSolutionsButton.UseVisualStyleBackColor = true;
     287      this.refreshSolutionsButton.Click += new System.EventHandler(this.refreshSolutionsButton_Click);
     288      //
     289      // uploadSolutionsButton
     290      //
     291      this.uploadSolutionsButton.Location = new System.Drawing.Point(38, 6);
     292      this.uploadSolutionsButton.Name = "uploadSolutionsButton";
     293      this.uploadSolutionsButton.Size = new System.Drawing.Size(26, 23);
     294      this.uploadSolutionsButton.TabIndex = 1;
     295      this.uploadSolutionsButton.Text = "Upload";
     296      this.uploadSolutionsButton.UseVisualStyleBackColor = true;
     297      this.uploadSolutionsButton.Click += new System.EventHandler(this.uploadSolutionsButton_Click);
    243298      //
    244299      // OKBProblemView
     
    264319      this.tabControl.ResumeLayout(false);
    265320      this.parametersTabPage.ResumeLayout(false);
     321      this.solutionsTabPage.ResumeLayout(false);
    266322      this.flaAnalysisTabPage.ResumeLayout(false);
    267323      this.flaSplitContainer.Panel1.ResumeLayout(false);
     
    289345    private System.Windows.Forms.Button uploadCharacteristicsButton;
    290346    private System.Windows.Forms.Button downloadCharacteristicsButton;
     347    private System.Windows.Forms.TabPage solutionsTabPage;
     348    private MainForm.WindowsForms.ViewHost solutionsViewHost;
     349    private System.Windows.Forms.Button uploadSolutionsButton;
     350    private System.Windows.Forms.Button refreshSolutionsButton;
    291351
    292352
  • stable/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.cs

    r15081 r15082  
    7373      uploadCharacteristicsButton.Text = string.Empty;
    7474      uploadCharacteristicsButton.Image = VSImageLibrary.PublishToWeb;
     75      refreshSolutionsButton.Text = string.Empty;
     76      refreshSolutionsButton.Image = VSImageLibrary.Refresh;
     77      uploadSolutionsButton.Text = string.Empty;
     78      uploadSolutionsButton.Image = VSImageLibrary.PublishToWeb;
    7579    }
    7680
     
    9397      base.RegisterContentEvents();
    9498      Content.ProblemChanged += new EventHandler(Content_ProblemChanged);
     99      Content.Solutions.ItemsAdded += SolutionsOnChanged;
     100      Content.Solutions.ItemsReplaced += SolutionsOnChanged;
     101      Content.Solutions.ItemsRemoved += SolutionsOnChanged;
     102      Content.Solutions.CollectionReset += SolutionsOnChanged;
     103    }
     104
     105    private void SolutionsOnChanged(object sender, EventArgs e) {
     106      if (InvokeRequired) { Invoke((Action<object, EventArgs>)SolutionsOnChanged, sender, e); return; }
     107      SetEnabledStateOfControls();
    95108    }
    96109
     
    100113        problemComboBox.SelectedIndex = -1;
    101114        parameterCollectionView.Content = null;
     115        solutionsViewHost.Content = null;
    102116      } else {
    103117        problemComboBox.SelectedItem = RunCreationClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId);
    104118        parameterCollectionView.Content = Content.Parameters;
     119        solutionsViewHost.Content = Content.Solutions;
    105120      }
    106121      UpdateCharacteristicCalculators();
     
    118133        && characteristicsMatrixView.Content != null && characteristicsMatrixView.Content.Rows > 0;
    119134      calculateButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked && !ReadOnly && calculatorList.CheckedItems.Any();
     135      refreshSolutionsButton.Enabled = Content != null && !ReadOnly && !Locked && Content.ProblemId != -1;
     136      uploadSolutionsButton.Enabled = Content != null && !ReadOnly && !Locked && Content.ProblemId != -1 && Content.Solutions.Any(x => x.SolutionId == -1);
    120137    }
    121138
     
    183200    }
    184201    private void downloadCharacteristicsButton_Click(object sender, EventArgs e) {
    185       var values = RunCreationClient.GetCharacteristicValues(Content.ProblemId).ToList();
     202      var values = RunCreationClient.Instance.GetCharacteristicValues(Content.ProblemId).ToList();
    186203      var content = new StringMatrix(values.Count, 3);
    187204      for (var i = 0; i < values.Count; i++) {
     
    204221      }
    205222      try {
    206         RunCreationClient.SetCharacteristicValues(Content.ProblemId, values);
     223        RunCreationClient.Instance.SetCharacteristicValues(Content.ProblemId, values);
    207224      } catch (Exception ex) { ErrorHandling.ShowErrorDialog(ex); }
    208225    }
     
    217234      }
    218235      var matrix = (characteristicsMatrixView.Content as StringMatrix) ?? (new StringMatrix(results.Count, 3));
    219       for (var i = 0; i < matrix.Rows; i++) {
    220         Value r;
    221         if (results.TryGetValue(matrix[i, 0], out r)) {
    222           matrix[i, 1] = r.GetValue();
    223           matrix[i, 2] = r.GetType().Name;
    224           results.Remove(matrix[i, 0]);
     236      try {
     237        for (var i = 0; i < matrix.Rows; i++) {
     238          Value r;
     239          if (results.TryGetValue(matrix[i, 0], out r)) {
     240            matrix[i, 1] = r.GetValue();
     241            matrix[i, 2] = r.GetType().Name;
     242            results.Remove(matrix[i, 0]);
     243          }
    225244        }
    226       }
    227       if (results.Count == 0) return;
    228       var resultsList = results.ToList();
    229       var counter = resultsList.Count - 1;
    230       for (var i = 0; i < matrix.Rows; i++) {
    231         if (string.IsNullOrEmpty(matrix[i, 0])) {
    232           matrix[i, 0] = resultsList[counter].Key;
    233           matrix[i, 1] = resultsList[counter].Value.GetValue();
    234           matrix[i, 2] = resultsList[counter].Value.GetType().Name;
    235           resultsList.RemoveAt(counter);
    236           counter--;
    237           if (counter < 0) return;
     245        if (results.Count == 0) return;
     246        var resultsList = results.ToList();
     247        var counter = resultsList.Count - 1;
     248        for (var i = 0; i < matrix.Rows; i++) {
     249          if (string.IsNullOrEmpty(matrix[i, 0])) {
     250            matrix[i, 0] = resultsList[counter].Key;
     251            matrix[i, 1] = resultsList[counter].Value.GetValue();
     252            matrix[i, 2] = resultsList[counter].Value.GetType().Name;
     253            resultsList.RemoveAt(counter);
     254            counter--;
     255            if (counter < 0) return;
     256          }
    238257        }
    239       }
    240       if (counter >= 0) {
    241         ((IStringConvertibleMatrix)matrix).Rows += counter + 1;
    242         for (var i = matrix.Rows - 1; counter >= 0; i--) {
    243           matrix[i, 0] = resultsList[0].Key;
    244           matrix[i, 1] = resultsList[0].Value.GetValue();
    245           matrix[i, 2] = resultsList[0].Value.GetType().Name;
    246           resultsList.RemoveAt(0);
    247           counter--;
     258        if (counter >= 0) {
     259          ((IStringConvertibleMatrix)matrix).Rows += counter + 1;
     260          for (var i = matrix.Rows - 1; counter >= 0; i--) {
     261            matrix[i, 0] = resultsList[0].Key;
     262            matrix[i, 1] = resultsList[0].Value.GetValue();
     263            matrix[i, 2] = resultsList[0].Value.GetType().Name;
     264            resultsList.RemoveAt(0);
     265            counter--;
     266          }
    248267        }
    249       }
    250       characteristicsMatrixView.Content = matrix;
    251       SetEnabledStateOfControls();
     268      } finally {
     269        characteristicsMatrixView.Content = matrix;
     270        SetEnabledStateOfControls();
     271      }
    252272    }
    253273    #endregion
     
    261281    #endregion
    262282
     283    private void refreshSolutionsButton_Click(object sender, EventArgs e) {
     284      Content.RefreshSolutions();
     285    }
     286
     287    private void uploadSolutionsButton_Click(object sender, EventArgs e) {
     288      foreach (var solution in Content.Solutions.Where(x => x.SolutionId == -1))
     289        solution.Upload();
     290      SetEnabledStateOfControls();
     291    }
     292
    263293  }
    264294}
Note: See TracChangeset for help on using the changeset viewer.