Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/28/14 15:34:34 (10 years ago)
Author:
rstoll
Message:
  • Fixed FindAll -> selection was very slow, CopyOfStringConvertibleMatrix had registered an event as well which slowed down everything (more or less)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/CopyOfStringConvertibleMatrixView.cs

    r10691 r10916  
    7979    }
    8080
     81    // Was private before
     82    protected virtual void dataGridView_SelectionChanged(object sender, EventArgs e) {
     83      string stringFormat = "{0,20:0.0000}";
     84      statisticsTextBox.Text = string.Empty;
     85      if (dataGridView.SelectedCells.Count > 1) {
     86        List<double> selectedValues = new List<double>();
     87        foreach (DataGridViewCell cell in dataGridView.SelectedCells) {
     88          double value;
     89          if (!double.TryParse(cell.Value.ToString(), out value)) return;
     90          selectedValues.Add(value);
     91        }
     92        if (selectedValues.Count > 1) {
     93          StringBuilder labelText = new StringBuilder();
     94          labelText.Append("Count: " + string.Format(stringFormat, selectedValues.Count) + "    ");
     95          labelText.Append("Sum: " + string.Format(stringFormat, selectedValues.Sum()) + "    ");
     96          labelText.Append("Min: " + string.Format(stringFormat, selectedValues.Min()) + "    ");
     97          labelText.Append("Max: " + string.Format(stringFormat, selectedValues.Max()) + "    ");
     98          labelText.Append("Average: " + string.Format(stringFormat, selectedValues.Average()) + "    ");
     99          labelText.Append("Standard Deviation: " + string.Format(stringFormat, selectedValues.StandardDeviation()) + "    ");
     100
     101          statisticsTextBox.Text = labelText.ToString();
     102        }
     103      }
     104    }
     105
    81106    #region unchanged copied from original - see  HeuristicLab.Data.Views.StringConvertibleMatrix
    82107
     
    572597    }
    573598
    574     private void dataGridView_SelectionChanged(object sender, EventArgs e) {
    575       string stringFormat = "{0,20:0.0000}";
    576       statisticsTextBox.Text = string.Empty;
    577       if (dataGridView.SelectedCells.Count > 1) {
    578         List<double> selectedValues = new List<double>();
    579         foreach (DataGridViewCell cell in dataGridView.SelectedCells) {
    580           double value;
    581           if (!double.TryParse(cell.Value.ToString(), out value)) return;
    582           selectedValues.Add(value);
    583         }
    584         if (selectedValues.Count > 1) {
    585           StringBuilder labelText = new StringBuilder();
    586           labelText.Append("Count: " + string.Format(stringFormat, selectedValues.Count) + "    ");
    587           labelText.Append("Sum: " + string.Format(stringFormat, selectedValues.Sum()) + "    ");
    588           labelText.Append("Min: " + string.Format(stringFormat, selectedValues.Min()) + "    ");
    589           labelText.Append("Max: " + string.Format(stringFormat, selectedValues.Max()) + "    ");
    590           labelText.Append("Average: " + string.Format(stringFormat, selectedValues.Average()) + "    ");
    591           labelText.Append("Standard Deviation: " + string.Format(stringFormat, selectedValues.StandardDeviation()) + "    ");
    592 
    593           statisticsTextBox.Text = labelText.ToString();
    594         }
    595       }
    596     }
     599   
    597600  }
    598601    #endregion
Note: See TracChangeset for help on using the changeset viewer.