ViewMenuPage.xaml.cs 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using MediaBrowser.Model.Entities;
  2. using System.Windows;
  3. namespace MediaBrowser.Plugins.DefaultTheme.DisplayPreferences
  4. {
  5. /// <summary>
  6. /// Interaction logic for ViewMenuPage.xaml
  7. /// </summary>
  8. public partial class ViewMenuPage : BaseDisplayPreferencesPage
  9. {
  10. /// <summary>
  11. /// Initializes a new instance of the <see cref="ViewMenuPage" /> class.
  12. /// </summary>
  13. public ViewMenuPage()
  14. {
  15. InitializeComponent();
  16. radioCoverFlow.Click += radioCoverFlow_Click;
  17. radioList.Click += radioList_Click;
  18. radioPoster.Click += radioPoster_Click;
  19. radioThumbstrip.Click += radioThumbstrip_Click;
  20. }
  21. /// <summary>
  22. /// Called when [loaded].
  23. /// </summary>
  24. protected override void OnLoaded()
  25. {
  26. base.OnLoaded();
  27. UpdateFields();
  28. }
  29. /// <summary>
  30. /// Handles the Click event of the radioThumbstrip control.
  31. /// </summary>
  32. /// <param name="sender">The source of the event.</param>
  33. /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
  34. void radioThumbstrip_Click(object sender, RoutedEventArgs e)
  35. {
  36. MainPage.DisplayPreferences.ScrollDirection = ScrollDirection.Horizontal;
  37. MainPage.DisplayPreferences.ViewType = ViewTypes.ThumbStrip;
  38. MainPage.NotifyDisplayPreferencesChanged();
  39. }
  40. /// <summary>
  41. /// Handles the Click event of the radioPoster control.
  42. /// </summary>
  43. /// <param name="sender">The source of the event.</param>
  44. /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
  45. void radioPoster_Click(object sender, RoutedEventArgs e)
  46. {
  47. MainPage.DisplayPreferences.ViewType = ViewTypes.Poster;
  48. MainPage.NotifyDisplayPreferencesChanged();
  49. }
  50. /// <summary>
  51. /// Handles the Click event of the radioList control.
  52. /// </summary>
  53. /// <param name="sender">The source of the event.</param>
  54. /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
  55. void radioList_Click(object sender, RoutedEventArgs e)
  56. {
  57. MainPage.DisplayPreferences.ScrollDirection = ScrollDirection.Vertical;
  58. MainPage.DisplayPreferences.ViewType = ViewTypes.List;
  59. MainPage.NotifyDisplayPreferencesChanged();
  60. }
  61. /// <summary>
  62. /// Handles the Click event of the radioCoverFlow control.
  63. /// </summary>
  64. /// <param name="sender">The source of the event.</param>
  65. /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
  66. void radioCoverFlow_Click(object sender, RoutedEventArgs e)
  67. {
  68. MainPage.DisplayPreferences.ScrollDirection = ScrollDirection.Horizontal;
  69. MainPage.DisplayPreferences.ViewType = ViewTypes.CoverFlow;
  70. MainPage.NotifyDisplayPreferencesChanged();
  71. }
  72. /// <summary>
  73. /// Updates the fields.
  74. /// </summary>
  75. private void UpdateFields()
  76. {
  77. var displayPreferences = MainPage.DisplayPreferences;
  78. radioCoverFlow.IsChecked = displayPreferences.ViewType == ViewTypes.CoverFlow;
  79. radioList.IsChecked = displayPreferences.ViewType == ViewTypes.List;
  80. radioPoster.IsChecked = displayPreferences.ViewType == ViewTypes.Poster;
  81. radioThumbstrip.IsChecked = displayPreferences.ViewType == ViewTypes.ThumbStrip;
  82. }
  83. }
  84. }