private void DrawPerron(Perron p, Canvas g, bool withTrain) { PerronControl control = new PerronControl(p); control.SetValue(Canvas.LeftProperty, p.BasePoint.get_X()); control.SetValue(Canvas.TopProperty, p.BasePoint.get_Y()); control.Boarding = withTrain; g.get_Children().Add(control); }
private void ClearPerronsFromCanvas(Canvas canvasRoot) { List <UIElement> list = new List <UIElement>(); foreach (UIElement element in canvasRoot.get_Children()) { if (element is PerronControl) { PerronControl control = element as PerronControl; list.Add(element); } } foreach (UIElement element in list) { canvasRoot.get_Children().Remove(element); } }