private void Button_Click(object sender, RoutedEventArgs e) { Tool b = (sender as Button).Tag as Tool; if (b != null) { switch (b.Command) { case Commands.PlayAni: OriDrawing.Run(); break; case Commands.StopAni: OriDrawing.Stop(); break; case Commands.Still: OriDrawing.Still(); break; case Commands.CloseAnimation: CloseWindow(); break; case Commands.SwitchRoutes: OriDrawing.Stop(); switch (Opacity.ToString()) { case "0": Opacity = 0.2; OriDrawing.TransparentRoute(0.2); break; case "0.2": Opacity = 1; OriDrawing.TransparentRoute(1); break; case "1": Opacity = 0; OriDrawing.TransparentRoute(0); break; default: Opacity = 1; OriDrawing.TransparentRoute(1); break; } break; } } }