aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/ViewMenuPage.xaml.cs
blob: e164809cf1f67c0c8c48ff8222a09141bc3e0dd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using MediaBrowser.Model.Entities;
using System.Windows;

namespace MediaBrowser.Plugins.DefaultTheme.DisplayPreferences
{
    /// <summary>
    /// Interaction logic for ViewMenuPage.xaml
    /// </summary>
    public partial class ViewMenuPage : BaseDisplayPreferencesPage
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewMenuPage" /> class.
        /// </summary>
        public ViewMenuPage()
        {
            InitializeComponent();

            radioCoverFlow.Click += radioCoverFlow_Click;
            radioList.Click += radioList_Click;
            radioPoster.Click += radioPoster_Click;
            radioThumbstrip.Click += radioThumbstrip_Click;
        }

        /// <summary>
        /// Called when [loaded].
        /// </summary>
        protected override void OnLoaded()
        {
            base.OnLoaded();

            UpdateFields();
        }

        /// <summary>
        /// Handles the Click event of the radioThumbstrip control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        void radioThumbstrip_Click(object sender, RoutedEventArgs e)
        {
            MainPage.DisplayPreferences.ScrollDirection = ScrollDirection.Horizontal;
            MainPage.DisplayPreferences.ViewType = ViewTypes.ThumbStrip;
            MainPage.NotifyDisplayPreferencesChanged();
        }

        /// <summary>
        /// Handles the Click event of the radioPoster control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        void radioPoster_Click(object sender, RoutedEventArgs e)
        {
            MainPage.DisplayPreferences.ViewType = ViewTypes.Poster;
            MainPage.NotifyDisplayPreferencesChanged();
        }

        /// <summary>
        /// Handles the Click event of the radioList control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        void radioList_Click(object sender, RoutedEventArgs e)
        {
            MainPage.DisplayPreferences.ScrollDirection = ScrollDirection.Vertical;
            MainPage.DisplayPreferences.ViewType = ViewTypes.List;
            MainPage.NotifyDisplayPreferencesChanged();
        }

        /// <summary>
        /// Handles the Click event of the radioCoverFlow control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        void radioCoverFlow_Click(object sender, RoutedEventArgs e)
        {
            MainPage.DisplayPreferences.ScrollDirection = ScrollDirection.Horizontal;
            MainPage.DisplayPreferences.ViewType = ViewTypes.CoverFlow;
            MainPage.NotifyDisplayPreferencesChanged();
        }

        /// <summary>
        /// Updates the fields.
        /// </summary>
        private void UpdateFields()
        {
            var displayPreferences = MainPage.DisplayPreferences;

            radioCoverFlow.IsChecked = displayPreferences.ViewType == ViewTypes.CoverFlow;
            radioList.IsChecked = displayPreferences.ViewType == ViewTypes.List;
            radioPoster.IsChecked = displayPreferences.ViewType == ViewTypes.Poster;
            radioThumbstrip.IsChecked = displayPreferences.ViewType == ViewTypes.ThumbStrip;
        }
    }
}