Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using Microsoft.Research.DynamicDataDisplay.Common;
|
---|
6 | using System.Windows.Threading;
|
---|
7 |
|
---|
8 | namespace 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.