aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/DisplayPreferencesMenu.xaml.cs
blob: 04e65cd4292b9f7f38144edf8b7b003be9a4af35 (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
using MediaBrowser.UI.Controls;
using MediaBrowser.UI.Pages;
using System.Windows;

namespace MediaBrowser.Plugins.DefaultTheme.DisplayPreferences
{
    /// <summary>
    /// Interaction logic for DisplayPreferencesMenu.xaml
    /// </summary>
    public partial class DisplayPreferencesMenu : BaseModalWindow
    {
        /// <summary>
        /// Gets or sets the main page.
        /// </summary>
        /// <value>The main page.</value>
        public BaseListPage MainPage { get; set; }
        /// <summary>
        /// Gets or sets the folder id.
        /// </summary>
        /// <value>The folder id.</value>
        public string FolderId { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="DisplayPreferencesMenu" /> class.
        /// </summary>
        public DisplayPreferencesMenu()
        {
            InitializeComponent();

            btnClose.Click += btnClose_Click;
        }

        /// <summary>
        /// Handles the Click event of the btnClose 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 btnClose_Click(object sender, RoutedEventArgs e)
        {
            CloseModal();
        }

        /// <summary>
        /// Closes the modal.
        /// </summary>
        protected override void CloseModal()
        {
            if (PageFrame.CanGoBack)
            {
                PageFrame.GoBackWithTransition();
            }
            else
            {
                base.CloseModal();
            }
        }

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

            PageFrame.Navigate(new MainPage { DisplayPreferencesWindow = this });
        }

        /// <summary>
        /// Navigates to view menu.
        /// </summary>
        public void NavigateToViewMenu()
        {
            PageFrame.NavigateWithTransition(new ViewMenuPage { DisplayPreferencesWindow = this });
        }

        /// <summary>
        /// Navigates to index menu.
        /// </summary>
        public void NavigateToIndexMenu()
        {
            PageFrame.NavigateWithTransition(new IndexMenuPage { DisplayPreferencesWindow = this });
        }

        /// <summary>
        /// Navigates to sort menu.
        /// </summary>
        public void NavigateToSortMenu()
        {
            PageFrame.NavigateWithTransition(new SortMenuPage { DisplayPreferencesWindow = this });
        }
    }
}