//private Point _start, _end; //List<object> MyBoardObjects; #endregion #region Window Load Events /* * private void MainWindow_Loaded(object sender, RoutedEventArgs e) * { * * }*/ private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { foreach (var obj in MyBoardObjects) { if (obj is Line) { Line line = obj as Line; line.IsEnabled = false; } else if (obj is Rectangle) { Rectangle temprect = obj as Rectangle; temprect.IsEnabled = false; } else if (obj is Ellipse) { Ellipse tempell = obj as Ellipse; tempell.IsEnabled = false; } else if (obj is PointCollection) { PointCollection pntc = obj as PointCollection; pntc.Clear(); } } MyBoardObjects.Clear(); MyBoard.Children.Clear(); }
private void btn_Clear_Click(object sender, RoutedEventArgs e) { MyBoard.Children.Clear(); if (MyBoardObjects.Count > 0) { deletedObjects.Push(MyBoardObjects); } MyBoardObjects.Clear(); }