/// <summary> /// Command handler for previous image command /// </summary> /// <param name="sender">Source of the event</param> /// <param name="e">EventArgs describing the event</param> private static void OnPreviousImageCommand(object sender, ExecutedRoutedEventArgs e) { ImageViewerWindow window = sender as ImageViewerWindow; if (window != null) { if (window.CanGoToPreviousImage) { window.GoToPreviousImage(); } } }
/// <summary> /// Command handler for Scroll page down command /// </summary> /// <param name="sender">Source of the event</param> /// <param name="e">EventArgs describing the event</param> private void OnScrollPageDownCommand(object sender, ExecutedRoutedEventArgs e) { ImageViewerWindow window = sender as ImageViewerWindow; if (window != null) { if (window.CanGoToNextImage) { window.GoToNextImage(); } e.Handled = true; } }
/// <summary> /// Opens the image viewer window control /// </summary> /// <param name="imageReference"></param> /// <param name="story"></param> private void OpenImageViewerWindow(ImageReference imageReference, Story story) { // If there is no instance of image viewer currently open, create one if (_imageViewerWindow == null) { _imageViewerWindow = new ImageViewerWindow(); _imageViewerWindow.Owner = Application.Current.MainWindow; _imageViewerWindow.Closed += OnImageViewerWindowClosed; } // Configure window to control's Story and ImageReference _imageViewerWindow.ImageReference = imageReference; _imageViewerWindow.Story = story; _imageViewerWindow.Show(); }
/// <summary> /// Command handler for previous image command can execute /// </summary> /// <param name="sender">Source of the event</param> /// <param name="e">EventArgs describing the event</param> private static void OnPreviousImageCommandCanExecute(object sender, CanExecuteRoutedEventArgs e) { ImageViewerWindow window = sender as ImageViewerWindow; if (window != null) { if (window.CanGoToPreviousImage) { e.CanExecute = true; } else { e.CanExecute = false; } } }