using MediaBrowser.Model.Entities; using System.Windows; namespace MediaBrowser.Plugins.DefaultTheme.DisplayPreferences { /// /// Interaction logic for MainPage.xaml /// public partial class MainPage : BaseDisplayPreferencesPage { /// /// Initializes a new instance of the class. /// public MainPage() { InitializeComponent(); btnScroll.Click += btnScroll_Click; btnIncrease.Click += btnIncrease_Click; btnDecrease.Click += btnDecrease_Click; ViewMenuButton.Click += ViewMenuButton_Click; SortMenuButton.Click += SortMenuButton_Click; IndexMenuButton.Click += IndexMenuButton_Click; } /// /// Handles the Click event of the IndexMenuButton control. /// /// The source of the event. /// The instance containing the event data. void IndexMenuButton_Click(object sender, RoutedEventArgs e) { DisplayPreferencesWindow.NavigateToIndexMenu(); } /// /// Handles the Click event of the SortMenuButton control. /// /// The source of the event. /// The instance containing the event data. void SortMenuButton_Click(object sender, RoutedEventArgs e) { DisplayPreferencesWindow.NavigateToSortMenu(); } /// /// Called when [loaded]. /// protected override void OnLoaded() { base.OnLoaded(); UpdateFields(); } /// /// Handles the Click event of the ViewMenuButton control. /// /// The source of the event. /// The instance containing the event data. void ViewMenuButton_Click(object sender, RoutedEventArgs e) { DisplayPreferencesWindow.NavigateToViewMenu(); } /// /// Handles the Click event of the btnDecrease control. /// /// The source of the event. /// The instance containing the event data. void btnDecrease_Click(object sender, RoutedEventArgs e) { MainPage.DisplayPreferences.DecreaseImageSize(); MainPage.NotifyDisplayPreferencesChanged(); } /// /// Handles the Click event of the btnIncrease control. /// /// The source of the event. /// The instance containing the event data. void btnIncrease_Click(object sender, RoutedEventArgs e) { MainPage.DisplayPreferences.IncreaseImageSize(); MainPage.NotifyDisplayPreferencesChanged(); } /// /// Handles the Click event of the btnScroll control. /// /// The source of the event. /// The instance containing the event data. void btnScroll_Click(object sender, RoutedEventArgs e) { MainPage.DisplayPreferences.ScrollDirection = MainPage.DisplayPreferences.ScrollDirection == ScrollDirection.Horizontal ? ScrollDirection.Vertical : ScrollDirection.Horizontal; MainPage.NotifyDisplayPreferencesChanged(); UpdateFields(); } /// /// Updates the fields. /// private void UpdateFields() { var displayPreferences = MainPage.DisplayPreferences; btnScroll.Visibility = displayPreferences.ViewType == ViewTypes.Poster ? Visibility.Visible : Visibility.Collapsed; txtScrollDirection.Text = displayPreferences.ScrollDirection == ScrollDirection.Horizontal ? "Scroll: Horizontal" : "Scroll: Vertical"; } } }