Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4883 for trunk


Ignore:
Timestamp:
11/21/10 18:19:39 (14 years ago)
Author:
mkommend
Message:

Improved performance of all RunCollectionViews (ticket #1284).

Location:
trunk/sources
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBoxPlotView.cs

    r4768 r4883  
    3939    private const string BoxPlotChartAreaName = "BoxPlotChartArea";
    4040
     41    private bool suppressUpdates = false;
    4142    private string xAxisValue;
    4243    private string yAxisValue;
     
    4647    public RunCollectionBoxPlotView() {
    4748      InitializeComponent();
    48       this.categoricalMapping = new Dictionary<int, Dictionary<object, double>>();
    49       this.seriesCache = new SortedDictionary<double, Series>();
    50       this.chart.ChartAreas[0].Visible = false;
    51       this.chart.Series.Clear();
    52       this.chart.ChartAreas.Add(BoxPlotChartAreaName);
    53       this.chart.CustomizeAllChartAreas();
     49      categoricalMapping = new Dictionary<int, Dictionary<object, double>>();
     50      seriesCache = new SortedDictionary<double, Series>();
     51      chart.ChartAreas[0].Visible = false;
     52      chart.Series.Clear();
     53      chart.ChartAreas.Add(BoxPlotChartAreaName);
     54      chart.CustomizeAllChartAreas();
    5455    }
    5556
     
    7071      Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    7172      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     73      Content.UpdateOfRunsInProgress += new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
    7274      RegisterRunEvents(Content);
    7375    }
     
    7981      Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    8082      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     83      Content.UpdateOfRunsInProgress -= new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
    8184      DeregisterRunEvents(Content);
    8285    }
     
    100103    private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
    101104      RegisterRunEvents(e.Items);
     105    }
     106    private void Content_UpdateOfRunsInProgress(object sender, EventArgs<bool> e) {
     107      if (InvokeRequired)
     108        Invoke(new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress), sender, e);
     109      else {
     110        suppressUpdates = e.Value;
     111        if (!suppressUpdates) UpdateDataPoints();
     112      }
    102113    }
    103114
     
    120131      if (InvokeRequired)
    121132        this.Invoke(new EventHandler(run_Changed), sender, e);
    122       else {
     133      else if (!suppressUpdates) {
    123134        IRun run = (IRun)sender;
    124135        UpdateDataPoints();
     
    326337    #region GUI events
    327338    private void UpdateNoRunsVisibleLabel() {
    328       if (this.chart.Series.Count > 0)
     339      if (this.chart.Series.Count > 0) {
    329340        noRunsLabel.Visible = false;
    330       else
     341        splitContainer.Panel2Collapsed = !showStatisticsCheckBox.Checked;
     342      } else {
    331343        noRunsLabel.Visible = true;
     344        splitContainer.Panel2Collapsed = true;
     345      }
    332346    }
    333347
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r4846 r4883  
    4343    private string sizeAxisValue;
    4444
    45     private Dictionary<IRun, DataPoint> runToDataPointMapping;
     45    private Dictionary<IRun, List<DataPoint>> runToDataPointMapping;
    4646    private Dictionary<int, Dictionary<object, double>> categoricalMapping;
    4747    private Dictionary<IRun, double> xJitter;
     
    5151    private Random random;
    5252    private bool isSelecting = false;
     53    private bool suppressUpdates = false;
    5354
    5455    public RunCollectionBubbleChartView() {
     
    5657      chart.ContextMenuStrip.Items.Insert(0, openBoxPlotViewToolStripMenuItem);
    5758
    58       runToDataPointMapping = new Dictionary<IRun, DataPoint>();
     59      runToDataPointMapping = new Dictionary<IRun, List<DataPoint>>();
    5960      categoricalMapping = new Dictionary<int, Dictionary<object, double>>();
    6061      xJitter = new Dictionary<IRun, double>();
     
    8889      Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    8990      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     91      Content.UpdateOfRunsInProgress += new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
    9092      RegisterRunEvents(Content);
    9193    }
     
    9799      Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    98100      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     101      Content.UpdateOfRunsInProgress -= new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
    99102      DeregisterRunEvents(Content);
    100103    }
     
    128131
    129132    private void UpdateRun(IRun run) {
    130       DataPoint point = runToDataPointMapping[run];
    131       if (point != null) {
    132         point.Color = run.Color;
    133         if (!run.Visible) {
    134           this.chart.Series[0].Points.Remove(point);
    135           runToDataPointMapping.Remove(run);
     133      if (!suppressUpdates) {
     134        if (runToDataPointMapping.ContainsKey(run)) {
     135          foreach (DataPoint point in runToDataPointMapping[run]) {
     136            point.Color = run.Color;
     137            if (!run.Visible) {
     138              this.chart.Series[0].Points.Remove(point);
     139              UpdateCursorInterval();
     140              chart.ChartAreas[0].RecalculateAxesScale();
     141            }
     142          }
     143          if (!run.Visible) runToDataPointMapping.Remove(run);
     144        } else {
     145          AddDataPoint(run);
    136146          UpdateCursorInterval();
    137147          chart.ChartAreas[0].RecalculateAxesScale();
    138148        }
    139       } else {
    140         AddDataPoint(run);
    141         UpdateCursorInterval();
    142         chart.ChartAreas[0].RecalculateAxesScale();
    143       }
    144 
    145 
    146       if (this.chart.Series[0].Points.Count == 0)
    147         noRunsLabel.Visible = true;
    148       else
    149         noRunsLabel.Visible = false;
     149
     150        if (this.chart.Series[0].Points.Count == 0)
     151          noRunsLabel.Visible = true;
     152        else
     153          noRunsLabel.Visible = false;
     154      }
    150155    }
    151156
     
    199204    }
    200205
     206
     207    private void Content_UpdateOfRunsInProgress(object sender, EventArgs<bool> e) {
     208      if (InvokeRequired)
     209        Invoke(new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress), sender, e);
     210      else {
     211        suppressUpdates = e.Value;
     212        if (!suppressUpdates) UpdateDataPoints();
     213      }
     214    }
     215
    201216    private void Content_Reset(object sender, EventArgs e) {
    202217      if (InvokeRequired)
     
    252267          point.Color = run.Color;
    253268          series.Points.Add(point);
    254           runToDataPointMapping[run] = point;
     269
     270          if (!runToDataPointMapping.ContainsKey(run)) runToDataPointMapping.Add(run, new List<DataPoint>());
     271          runToDataPointMapping[run].Add(point);
    255272        }
    256273      }
     
    595612
    596613    private void ColorRuns(string axisValue) {
     614      Content.OnUpdateOfRunsInProgress(true);
    597615      var runs = Content.Select(r => new { Run = r, Value = GetValue(r, axisValue) }).Where(r => r.Value.HasValue);
    598616      double minValue = runs.Min(r => r.Value.Value);
     
    605623        r.Run.Color = ColorGradient.Colors[colorIndex];
    606624      }
     625      Content.OnUpdateOfRunsInProgress(false);
    607626    }
    608627    #endregion
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionTabularView.cs

    r4819 r4883  
    2424using System.Linq;
    2525using System.Windows.Forms;
    26 using HeuristicLab.Core;
     26using HeuristicLab.Common;
    2727using HeuristicLab.Data.Views;
    2828using HeuristicLab.MainForm;
     29using HeuristicLab.Core;
    2930
    3031namespace HeuristicLab.Optimization.Views {
     
    3334  public sealed partial class RunCollectionTabularView : StringConvertibleMatrixView {
    3435    private int[] runToRowMapping;
     36    private bool suppressUpdates = false;
    3537    public RunCollectionTabularView() {
    3638      InitializeComponent();
     
    6264      Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    6365      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     66      Content.UpdateOfRunsInProgress += new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
    6467      RegisterRunEvents(Content);
    6568    }
     
    7376      Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    7477      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     78      Content.UpdateOfRunsInProgress -= new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
    7579      DeregisterRunEvents(Content);
    7680    }
     
    113117
    114118    private void UpdateRun(IRun run) {
    115       int runIndex = GetIndexOfRun(run);
    116       int rowIndex = runToRowMapping[runIndex];
    117       this.dataGridView.Rows[rowIndex].Visible = run.Visible;
    118       this.dataGridView.Rows[rowIndex].DefaultCellStyle.ForeColor = run.Color;
     119      foreach (int runIndex in GetIndexOfRun(run)) {
     120        int rowIndex = runToRowMapping[runIndex];
     121        this.dataGridView.Rows[rowIndex].Visible = run.Visible;
     122        this.dataGridView.Rows[rowIndex].DefaultCellStyle.ForeColor = run.Color;
     123      }
    119124      this.UpdateRowHeaders();
    120125    }
    121126
    122     private int GetIndexOfRun(IRun run) {
     127
     128    private void Content_UpdateOfRunsInProgress(object sender, Common.EventArgs<bool> e) {
     129      if (InvokeRequired)
     130        Invoke(new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress), sender, e);
     131      else {
     132        suppressUpdates = e.Value;
     133        if (!suppressUpdates) UpdateRowAttributes();
     134      }
     135    }
     136
     137    private IEnumerable<int> GetIndexOfRun(IRun run) {
    123138      int i = 0;
    124139      foreach (IRun actualRun in Content) {
    125140        if (actualRun == run)
    126           return i;
     141          yield return i;
    127142        i++;
    128143      }
    129       throw new ArgumentException("Run " + run.Name + "could not be found in the RunCollection.");
    130144    }
    131145
     
    143157    protected override void ClearSorting() {
    144158      base.ClearSorting();
    145       runToRowMapping = new int[Content.Count];
    146       for (int i = 0; i < runToRowMapping.Length; i++)
    147         runToRowMapping[i] = i;
     159      runToRowMapping = Enumerable.Range(0, Content.Count).ToArray();
    148160      UpdateRowAttributes();
    149161    }
     
    176188        runIndex++;
    177189      }
     190      UpdateRowHeaders();
    178191    }
    179192
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.Designer.cs

    r4096 r4883  
    302302    #endregion
    303303
    304     protected System.Windows.Forms.SplitContainer splitContainer;
    305     protected System.Windows.Forms.ColumnHeader columnHeader1;
    306     protected GroupBox itemsGroupBox;
    307     protected ListView itemsListView;
    308     protected GroupBox detailsGroupBox;
    309     protected Button removeButton;
    310     protected ToolTip toolTip;
    311     protected ImageList imageList;
    312     protected HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
    313     protected ToolStrip toolStrip;
    314     protected ToolStripDropDownButton analyzeRunsToolStripDropDownButton;
    315     protected TabControl tabControl;
    316     protected TabPage runPage;
    317     protected TabPage constraintPage;
    318     protected RunCollectionConstraintCollectionView runCollectionConstraintCollectionView;
    319     protected Button clearButton;
    320     protected CheckBox showDetailsCheckBox;
     304    private System.Windows.Forms.SplitContainer splitContainer;
     305    private System.Windows.Forms.ColumnHeader columnHeader1;
     306    private GroupBox itemsGroupBox;
     307    private ListView itemsListView;
     308    private GroupBox detailsGroupBox;
     309    private Button removeButton;
     310    private ToolTip toolTip;
     311    private ImageList imageList;
     312    private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
     313    private ToolStrip toolStrip;
     314    private ToolStripDropDownButton analyzeRunsToolStripDropDownButton;
     315    private TabControl tabControl;
     316    private TabPage runPage;
     317    private TabPage constraintPage;
     318    private RunCollectionConstraintCollectionView runCollectionConstraintCollectionView;
     319    private Button clearButton;
     320    private CheckBox showDetailsCheckBox;
    321321  }
    322322}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r4300 r4883  
    3535  [Content(typeof(RunCollection), true)]
    3636  [Content(typeof(IItemCollection<IRun>), false)]
    37   public partial class RunCollectionView : ItemView {
     37  public sealed partial class RunCollectionView : ItemView {
     38    private Dictionary<IRun, List<ListViewItem>> runListViewItemMapping;
     39
    3840    public new IItemCollection<IRun> Content {
    3941      get { return (IItemCollection<IRun>)base.Content; }
     
    5254      InitializeComponent();
    5355      itemsGroupBox.Text = "Runs";
     56      runListViewItemMapping = new Dictionary<IRun, List<ListViewItem>>();
    5457    }
    5558
     
    6871      RegisterRunEvents(Content);
    6972    }
    70     protected virtual void RegisterRunEvents(IEnumerable<IRun> runs) {
     73    private void RegisterRunEvents(IEnumerable<IRun> runs) {
    7174      foreach (IRun run in runs)
    7275        run.Changed += new EventHandler(Run_Changed);
    7376    }
    74     protected virtual void DeregisterRunEvents(IEnumerable<IRun> runs) {
     77    private void DeregisterRunEvents(IEnumerable<IRun> runs) {
    7578      foreach (IRun run in runs)
    7679        run.Changed -= new EventHandler(Run_Changed);
     
    143146    }
    144147
    145     protected virtual ListViewItem CreateListViewItem(IRun item) {
     148    private ListViewItem CreateListViewItem(IRun item) {
    146149      ListViewItem listViewItem = new ListViewItem();
    147150      listViewItem.Text = item.ToString();
     
    160163      return listViewItem;
    161164    }
    162     protected virtual void AddListViewItem(ListViewItem listViewItem) {
     165    private void AddListViewItem(ListViewItem listViewItem) {
    163166      itemsListView.Items.Add(listViewItem);
    164       ((IRun)listViewItem.Tag).ItemImageChanged += new EventHandler(Item_ItemImageChanged);
    165       ((IRun)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
    166     }
    167     protected virtual void RemoveListViewItem(ListViewItem listViewItem) {
    168       ((IRun)listViewItem.Tag).ItemImageChanged -= new EventHandler(Item_ItemImageChanged);
    169       ((IRun)listViewItem.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged);
     167      IRun run = listViewItem.Tag as IRun;
     168      if (run != null) {
     169        if (!runListViewItemMapping.ContainsKey(run))
     170          runListViewItemMapping.Add(run, new List<ListViewItem>());
     171        runListViewItemMapping[run].Add(listViewItem);
     172        run.ItemImageChanged += new EventHandler(Item_ItemImageChanged);
     173        run.ToStringChanged += new EventHandler(Item_ToStringChanged);
     174      }
     175    }
     176    private void RemoveListViewItem(ListViewItem listViewItem) {
     177      IRun run = listViewItem.Tag as IRun;
     178      if (run != null) {
     179        runListViewItemMapping[run].Remove(listViewItem);
     180        if (runListViewItemMapping[run].Count == 0) {
     181          runListViewItemMapping.Remove(run);
     182          run.ItemImageChanged -= new EventHandler(Item_ItemImageChanged);
     183          run.ToStringChanged -= new EventHandler(Item_ToStringChanged);
     184        }
     185      }
    170186      listViewItem.Remove();
    171187      foreach (ListViewItem other in itemsListView.Items)
     
    173189      itemsListView.SmallImageList.Images.RemoveAt(listViewItem.ImageIndex);
    174190    }
    175     protected virtual void UpdateListViewItemImage(ListViewItem listViewItem) {
     191    private void UpdateListViewItemImage(ListViewItem listViewItem) {
    176192      int i = listViewItem.ImageIndex;
    177193      listViewItem.ImageList.Images[i] = ((IRun)listViewItem.Tag).ItemImage;
     
    179195      listViewItem.ImageIndex = i;
    180196    }
    181     protected virtual void UpdateListViewItemText(ListViewItem listViewItem) {
     197    private void UpdateListViewItemText(ListViewItem listViewItem) {
    182198      if (!listViewItem.Text.Equals(listViewItem.Tag.ToString()))
    183199        listViewItem.Text = listViewItem.Tag.ToString();
    184200    }
    185     protected virtual IEnumerable<ListViewItem> GetListViewItemsForItem(IRun item) {
    186       foreach (ListViewItem listViewItem in itemsListView.Items) {
    187         if (((IRun)listViewItem.Tag) == item)
    188           yield return listViewItem;
    189       }
     201    private IEnumerable<ListViewItem> GetListViewItemsForItem(IRun run) {
     202      return runListViewItemMapping[run];
    190203    }
    191204
    192205    #region ListView Events
    193     protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
     206    private void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
    194207      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && (Content != null) && !Content.IsReadOnly && !ReadOnly;
    195208      AdjustListViewColumnSizes();
     
    205218      }
    206219    }
    207     protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) {
     220    private void itemsListView_KeyDown(object sender, KeyEventArgs e) {
    208221      if (e.KeyCode == Keys.Delete) {
    209222        if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
     
    213226      }
    214227    }
    215     protected virtual void itemsListView_DoubleClick(object sender, EventArgs e) {
     228    private void itemsListView_DoubleClick(object sender, EventArgs e) {
    216229      if (itemsListView.SelectedItems.Count == 1) {
    217230        IRun item = (IRun)itemsListView.SelectedItems[0].Tag;
     
    223236      }
    224237    }
    225     protected virtual void itemsListView_ItemDrag(object sender, ItemDragEventArgs e) {
     238    private void itemsListView_ItemDrag(object sender, ItemDragEventArgs e) {
    226239      if (!Locked) {
    227240        ListViewItem listViewItem = (ListViewItem)e.Item;
     
    239252      }
    240253    }
    241     protected virtual void itemsListView_DragEnterOver(object sender, DragEventArgs e) {
     254    private void itemsListView_DragEnterOver(object sender, DragEventArgs e) {
    242255      e.Effect = DragDropEffects.None;
    243256      Type type = e.Data.GetData("Type") as Type;
     
    250263      }
    251264    }
    252     protected virtual void itemsListView_DragDrop(object sender, DragEventArgs e) {
     265    private void itemsListView_DragDrop(object sender, DragEventArgs e) {
    253266      if (e.Effect != DragDropEffects.None) {
    254267        IRun item = e.Data.GetData("Value") as IRun;
     
    260273
    261274    #region Button Events
    262     protected virtual void menuItem_Click(object sender, EventArgs e) {
     275    private void menuItem_Click(object sender, EventArgs e) {
    263276      ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
    264277      Type viewType = (Type)menuItem.Tag;
     
    269282      }
    270283    }
    271     protected virtual void removeButton_Click(object sender, EventArgs e) {
     284    private void removeButton_Click(object sender, EventArgs e) {
    272285      if (itemsListView.SelectedItems.Count > 0) {
    273286        foreach (ListViewItem item in itemsListView.SelectedItems)
     
    276289      }
    277290    }
    278     protected virtual void clearButton_Click(object sender, EventArgs e) {
     291    private void clearButton_Click(object sender, EventArgs e) {
    279292      Content.Clear();
    280293    }
     
    282295
    283296    #region CheckBox Events
    284     protected virtual void showDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
     297    private void showDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
    285298      if (showDetailsCheckBox.Checked) {
    286299        splitContainer.Panel2Collapsed = false;
     
    295308
    296309    #region Content Events
    297     protected virtual void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     310    private void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    298311      if (InvokeRequired)
    299312        Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded), sender, e);
     
    309322      }
    310323    }
    311     protected virtual void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     324    private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    312325      if (InvokeRequired)
    313326        Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved), sender, e);
     
    316329        foreach (IRun item in e.Items) {
    317330          //remove only the first matching ListViewItem, because the IRun could be contained multiple times in the ItemCollection
    318           ListViewItem listviewItem = GetListViewItemsForItem(item).FirstOrDefault();
    319           if (listviewItem != null)
    320             RemoveListViewItem(listviewItem);
     331          ListViewItem listViewItem = GetListViewItemsForItem(item).FirstOrDefault();
     332          if (listViewItem != null) RemoveListViewItem(listViewItem);
    321333        }
    322334        analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0;
     
    325337      }
    326338    }
    327     protected virtual void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     339    private void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    328340      if (InvokeRequired)
    329341        Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset), sender, e);
     
    331343        DeregisterRunEvents(e.OldItems);
    332344        foreach (IRun item in e.OldItems) {
    333           //remove only the first matching ListViewItem, because the IRun could be contained multiple times in the ItemCollection
    334           ListViewItem listviewItem = GetListViewItemsForItem(item).FirstOrDefault();
    335           if (listviewItem != null)
    336             RemoveListViewItem(listviewItem);
     345          ListViewItem listViewItem = GetListViewItemsForItem(item).FirstOrDefault();
     346          if (listViewItem != null) RemoveListViewItem(listViewItem);
    337347        }
    338348        RegisterRunEvents(e.Items);
     
    349359
    350360    #region Item Events
    351     protected virtual void Item_ItemImageChanged(object sender, EventArgs e) {
     361    private void Item_ItemImageChanged(object sender, EventArgs e) {
    352362      if (InvokeRequired)
    353363        Invoke(new EventHandler(Item_ItemImageChanged), sender, e);
     
    358368      }
    359369    }
    360     protected virtual void Item_ToStringChanged(object sender, EventArgs e) {
     370    private void Item_ToStringChanged(object sender, EventArgs e) {
    361371      if (InvokeRequired)
    362372        Invoke(new EventHandler(Item_ToStringChanged), sender, e);
     
    368378      }
    369379    }
    370     protected virtual void Run_Changed(object sender, EventArgs e) {
     380    private void Run_Changed(object sender, EventArgs e) {
    371381      if (InvokeRequired)
    372382        this.Invoke(new EventHandler(Run_Changed), sender, e);
     
    377387    }
    378388
    379     protected virtual void UpdateRun(IRun run) {
     389    private void UpdateRun(IRun run) {
    380390      foreach (ListViewItem listViewItem in GetListViewItemsForItem(run)) {
    381391        if (run.Visible) {
     
    391401
    392402    #region Helpers
    393     protected virtual void AdjustListViewColumnSizes() {
     403    private void AdjustListViewColumnSizes() {
    394404      if (itemsListView.Items.Count > 0) {
    395405        for (int i = 0; i < itemsListView.Columns.Count; i++) {
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs

    r4722 r4883  
    285285    #endregion
    286286
     287    #region
     288    public event EventHandler<EventArgs<bool>> UpdateOfRunsInProgress;
     289    public void OnUpdateOfRunsInProgress(bool inProgress) {
     290      var handler = UpdateOfRunsInProgress;
     291      if (handler != null) handler(this, new EventArgs<bool>(inProgress));
     292    }
     293    #endregion
     294
    287295    #region filtering
    288296    private void UpdateFiltering(bool reset) {
     297      OnUpdateOfRunsInProgress(true);
    289298      if (reset)
    290299        list.ForEach(r => r.Visible = true);
    291300      foreach (IRunCollectionConstraint constraint in this.constraints)
    292301        constraint.Check();
     302      OnUpdateOfRunsInProgress(false);
    293303    }
    294304
Note: See TracChangeset for help on using the changeset viewer.