using MediaBrowser.Model.Drawing;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Entities
{
///
/// Defines the display preferences for any item that supports them (usually Folders)
///
public class DisplayPreferences : IHasPropertyChangedEvent
{
///
/// Occurs when [property changed].
///
public event PropertyChangedEventHandler PropertyChanged;
///
/// The image scale
///
private const double ImageScale = .9;
///
/// Initializes a new instance of the class.
///
public DisplayPreferences()
{
RememberIndexing = false;
PrimaryImageHeight = 250;
PrimaryImageWidth = 250;
ShowBackdrop = true;
CustomPrefs = new Dictionary();
}
///
/// Gets or sets the user id.
///
/// The user id.
public string Id { get; set; }
///
/// Gets or sets the type of the view.
///
/// The type of the view.
public string ViewType { get; set; }
///
/// Gets or sets the sort by.
///
/// The sort by.
public string SortBy { get; set; }
///
/// Gets or sets the index by.
///
/// The index by.
public string IndexBy { get; set; }
///
/// Gets or sets a value indicating whether [remember indexing].
///
/// true if [remember indexing]; otherwise, false.
public bool RememberIndexing { get; set; }
///
/// Gets or sets the height of the primary image.
///
/// The height of the primary image.
public int PrimaryImageHeight { get; set; }
///
/// Gets or sets the width of the primary image.
///
/// The width of the primary image.
public int PrimaryImageWidth { get; set; }
///
/// Gets or sets the custom prefs.
///
/// The custom prefs.
public Dictionary CustomPrefs { get; set; }
///
/// Gets or sets the scroll direction.
///
/// The scroll direction.
public ScrollDirection ScrollDirection { get; set; }
///
/// Gets or sets a value indicating whether to show backdrops on this item.
///
/// true if showing backdrops; otherwise, false.
public bool ShowBackdrop { get; set; }
///
/// Gets or sets a value indicating whether [remember sorting].
///
/// true if [remember sorting]; otherwise, false.
public bool RememberSorting { get; set; }
///
/// Gets or sets the sort order.
///
/// The sort order.
public SortOrder SortOrder { get; set; }
///
/// Gets or sets a value indicating whether [show sidebar].
///
/// true if [show sidebar]; otherwise, false.
public bool ShowSidebar { get; set; }
///
/// Increases the size of the image.
///
public void IncreaseImageSize()
{
double newWidth = PrimaryImageWidth / ImageScale;
ImageSize size = DrawingUtils.Resize(PrimaryImageWidth, PrimaryImageHeight, newWidth, null, null, null);
PrimaryImageWidth = Convert.ToInt32(size.Width);
PrimaryImageHeight = Convert.ToInt32(size.Height);
}
///
/// Decreases the size of the image.
///
public void DecreaseImageSize()
{
ImageSize size = DrawingUtils.Scale(PrimaryImageWidth, PrimaryImageHeight, ImageScale);
PrimaryImageWidth = Convert.ToInt32(size.Width);
PrimaryImageHeight = Convert.ToInt32(size.Height);
}
}
}