using MediaBrowser.Model.Drawing;
using ProtoBuf;
using System;
using System.Collections.Generic;
namespace MediaBrowser.Model.Entities
{
///
/// Defines the display preferences for any item that supports them (usually Folders)
///
[ProtoContract]
public class DisplayPreferences
{
///
/// The image scale
///
private const double ImageScale = .9;
///
/// Initializes a new instance of the class.
///
public DisplayPreferences()
{
RememberIndexing = false;
PrimaryImageHeight = 250;
PrimaryImageWidth = 250;
CustomPrefs = new Dictionary();
}
///
/// Gets or sets the user id.
///
/// The user id.
[ProtoMember(1)]
public Guid Id { get; set; }
///
/// Gets or sets the type of the view.
///
/// The type of the view.
[ProtoMember(2)]
public string ViewType { get; set; }
///
/// Gets or sets the sort by.
///
/// The sort by.
[ProtoMember(4)]
public string SortBy { get; set; }
///
/// Gets or sets the index by.
///
/// The index by.
[ProtoMember(5)]
public string IndexBy { get; set; }
///
/// Gets or sets a value indicating whether [remember indexing].
///
/// true if [remember indexing]; otherwise, false.
[ProtoMember(6)]
public bool RememberIndexing { get; set; }
///
/// Gets or sets the height of the primary image.
///
/// The height of the primary image.
[ProtoMember(7)]
public int PrimaryImageHeight { get; set; }
///
/// Gets or sets the width of the primary image.
///
/// The width of the primary image.
[ProtoMember(8)]
public int PrimaryImageWidth { get; set; }
///
/// Gets or sets the custom prefs.
///
/// The custom prefs.
[ProtoMember(9)]
public Dictionary CustomPrefs { get; set; }
///
/// Gets or sets the scroll direction.
///
/// The scroll direction.
[ProtoMember(10)]
public ScrollDirection ScrollDirection { get; set; }
///
/// Gets or sets a value indicating whether [remember sorting].
///
/// true if [remember sorting]; otherwise, false.
[ProtoMember(11)]
public bool RememberSorting { get; set; }
///
/// Gets or sets the sort order.
///
/// The sort order.
[ProtoMember(12)]
public SortOrder SortOrder { get; set; }
///
/// Increases the size of the image.
///
public void IncreaseImageSize()
{
var newWidth = PrimaryImageWidth / ImageScale;
var size = DrawingUtils.Resize(PrimaryImageWidth, PrimaryImageHeight, newWidth);
PrimaryImageWidth = Convert.ToInt32(size.Width);
PrimaryImageHeight = Convert.ToInt32(size.Height);
}
///
/// Decreases the size of the image.
///
public void DecreaseImageSize()
{
var size = DrawingUtils.Scale(PrimaryImageWidth, PrimaryImageHeight, ImageScale);
PrimaryImageWidth = Convert.ToInt32(size.Width);
PrimaryImageHeight = Convert.ToInt32(size.Height);
}
}
///
/// Enum ScrollDirection
///
public enum ScrollDirection
{
///
/// The horizontal
///
Horizontal,
///
/// The vertical
///
Vertical
}
///
/// Enum SortOrder
///
public enum SortOrder
{
///
/// The ascending
///
Ascending,
///
/// The descending
///
Descending
}
}