private void MediaButton_Click(object sender, RoutedEventArgs e) { switch ((sender as Button).Name) { case "PlayButton": DemoMovie.Play(); break; case "PauseButton": DemoMovie.Pause(); break; case "StopButton": DemoMovie.Stop(); break; } }
private void Grid_KeyDown(object sender, KeyRoutedEventArgs e) { if (e.Key == VirtualKey.Control) { isCtrlKeyPressed = true; } else if (isCtrlKeyPressed) { switch (e.Key) { case VirtualKey.P: DemoMovie.Play(); break; case VirtualKey.A: DemoMovie.Pause(); break; case VirtualKey.S: DemoMovie.Stop(); break; } } }