Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/21/20 17:14:46 (4 years ago)
Author:
dpiringe
Message:

#3026:

  • added a new way to setup the targeted result types
  • added new ui controls: NumericRangeControl, JsonItemArrayControl, JsonItemDefaultControl
  • redesigned export dialog -> now the user can navigate with a tree view
  • enhanced JsonItemVM
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.cs

    r17404 r17405  
    2121        }
    2222      }
     23
    2324    }
    2425
    2526    private void AddOption(string opt) {
    26       comboBoxValues.Items.Add(opt);
     27      AddComboOption(opt);
    2728      TextBox tb = new TextBox();
    2829      tb.Text = opt;
     
    3031      tb.Size = new Size(420, 20);
    3132      tb.ReadOnly = true;
    32       Button btn = new Button();
    33       btn.Text = "-";
    34       btn.Size = new Size(20, 20);
    35       btn.Click += (o, args) => {
    36         tableOptions.Controls.Remove(tb);
    37         tableOptions.Controls.Remove(btn);
    38         comboBoxValues.Items.Remove(tb.Text);
    39         IList<string> items = new List<string>();
    40         foreach(var i in comboBoxValues.Items) {
    41           items.Add((string)i);
    42         }
    43         VM.Item.Range = items;
    44         tableOptions.Refresh();
     33
     34      CheckBox checkBox = new CheckBox();
     35      checkBox.Checked = true;
     36     
     37      checkBox.CheckStateChanged += (o, args) => {
     38        if (checkBox.Checked)
     39          AddComboOption(opt);
     40        else
     41          RemoveComboOption(opt);
    4542      };
     43      tableOptions.Controls.Add(checkBox);
    4644      tableOptions.Controls.Add(tb);
    47       tableOptions.Controls.Add(btn);
    4845    }
    4946
    50     private void buttonAdd_Click(object sender, EventArgs e) {
    51       string newOption = textBoxAdd.Text;
    52       if (string.IsNullOrWhiteSpace(newOption)) return;
    53       textBoxAdd.Text = "";
    54       AddOption(newOption);
     47    private void AddComboOption(string opt) {
     48      comboBoxValues.Items.Add(opt);
     49      IList<string> items = new List<string>();
     50      foreach (var i in comboBoxValues.Items) {
     51        items.Add((string)i);
     52      }
     53      VM.Item.Range = items;
     54      tableOptions.Refresh();
    5555    }
    5656
     57    private void RemoveComboOption(string opt) {
     58      comboBoxValues.Items.Remove(opt);
     59      IList<string> items = new List<string>();
     60      foreach (var i in comboBoxValues.Items) {
     61        items.Add((string)i);
     62      }
     63      VM.Item.Range = items;
     64      tableOptions.Refresh();
     65    }
     66   
    5767    private void comboBoxValues_SelectedValueChanged(object sender, EventArgs e) {
    5868      VM.Item.Value = (string)comboBoxValues.SelectedItem;
Note: See TracChangeset for help on using the changeset viewer.