public PresentationWindow(MainWindow pCaller, PresentationHandling pPresentationHandler, int pStageCount) { InitializeComponent(); callerWindow = pCaller; presentationHandler = pPresentationHandler; presentationHandler.presentationWindow = this; PreviewKeyDown += (s, e) => { if (e.Key == Key.Escape) { presentationHandler.stopPresentation(); } if (e.Key == Key.Left) { previousStage(); } if (e.Key == Key.Right) { nextStage(); } }; presentationHandler.startPresentation(canvasPreview, pStageCount); }