Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4842


Ignore:
Timestamp:
11/19/10 09:38:55 (14 years ago)
Author:
swinkler
Message:

Improved management of formatters in view for display of symbolic expression trees as strings as discussed with mkommend. (#1270)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis.Extensions/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.cs

    r4841 r4842  
    4040    public SymbolicExpressionView() {
    4141      InitializeComponent();
    42       IEnumerator<ISymbolicExpressionTreeStringFormatter> formatters = ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeStringFormatter>().GetEnumerator();
     42      IEnumerable<ISymbolicExpressionTreeStringFormatter> formatters = ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeStringFormatter>();
    4343      treeFormattersList = new List<ISymbolicExpressionTreeStringFormatter>();
    44       formatters.MoveNext();
    4544      int selectedIndex = -1;
    46       while (formatters.Current != null) {
    47         if (formatters.Current is SymbolicExpressionTreeStringFormatter)
     45      foreach (ISymbolicExpressionTreeStringFormatter formatter in formatters) {
     46        if (formatter is SymbolicExpressionTreeStringFormatter)
    4847          selectedIndex = treeFormattersList.Count;
    49         ISymbolicExpressionTreeStringFormatter formatter = formatters.Current.Clone() as ISymbolicExpressionTreeStringFormatter;
    5048        treeFormattersList.Add(formatter);
    5149        formattersComboBox.Items.Add(formatter.Name);
    52         formatters.MoveNext();
    5350      }
    5451      formattersComboBox.SelectedIndex = selectedIndex;
     
    5754    protected override void OnContentChanged() {
    5855      base.OnContentChanged();
     56      UpdateTextbox();
     57    }
     58
     59    private void UpdateTextbox() {
    5960      if (Content == null)
    6061        textBox.Text = string.Empty;
     
    7071
    7172    private void formattersComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
    72       OnContentChanged();
     73      UpdateTextbox();
    7374    }
    7475  }
Note: See TracChangeset for help on using the changeset viewer.