Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Common/Auxiliary/PlotterChildrenCollectionExtensions.cs @ 13862

Last change on this file since 13862 was 12503, checked in by aballeit, 10 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1000 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Microsoft.Research.DynamicDataDisplay.Common;
6using System.Windows.Threading;
7
8namespace Microsoft.Research.DynamicDataDisplay
9{
10  public static class PlotterChildrenCollectionExtensions
11  {
12    public static void RemoveAll<T>(this PlotterChildrenCollection children)
13    {
14      var childrenToDelete = children.OfType<T>().ToList();
15
16      foreach (var child in childrenToDelete)
17      {
18        children.Remove(child as IPlotterElement);
19      }
20    }
21
22    public static void BeginAdd(this PlotterChildrenCollection children, IPlotterElement child)
23    {
24      children.Plotter.Dispatcher.BeginInvoke(((Action)(() => { children.Add(child); })), DispatcherPriority.Send);
25    }
26
27    public static void BeginRemove(this PlotterChildrenCollection children, IPlotterElement child)
28    {
29      children.Plotter.Dispatcher.BeginInvoke(((Action)(() => { children.Remove(child); })), DispatcherPriority.Send);
30    }
31  }
32}
Note: See TracBrowser for help on using the repository browser.