/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
namespace Tizen.Content.MediaContent
{
///
/// Represents the playlist that is a group of media (usually songs).
///
public class Playlist
{
internal Playlist(IntPtr handle)
{
Name = InteropHelper.GetString(handle, Interop.Playlist.GetName);
ThumbnailPath = InteropHelper.GetString(handle, Interop.Playlist.GetThumbnailPath);
Id = InteropHelper.GetValue(handle, Interop.Playlist.GetId);
}
internal static Playlist FromHandle(IntPtr handle) => new Playlist(handle);
///
/// Gets the ID of the playlist.
///
/// The unique ID of the playlist.
public int Id { get; }
///
/// Gets the name of the playlist.
///
/// The name of the playlist.
public string Name { get; }
///
/// Gets the path to the thumbnail.
///
/// The path to the thumbnail.
public string ThumbnailPath { get; }
///
/// Returns a string representation of the playlist.
///
/// A string representation of the current playlist.
public override string ToString() =>
$"Id={Id}, Name={Name}, ThumbnailPath={ThumbnailPath}";
}
///
/// Provides means to set values used for the update command.
///
///
/// The values only set in the object will be affected to the update command.
///
///
public class PlaylistUpdateValues
{
///
/// Gets or sets the name of the playlist for an update.
///
/// If the value is null, the update operation will have no effect on the field.
/// A string for name; the field will not be updated if null.
public string Name { get; set; }
///
/// Gets or sets the thumbnail path of the playlist for an update.
///
/// If the value is null, the update operation will have no effect on the field.
/// A string for the thumbnail path; the field will not be updated if null.
public string ThumbnailPath { get; set; }
}
///
/// Represents an order of a member of the playlist.
///
public class PlayOrder
{
///
/// Initializes a new instance of the class with the specified member ID and the order value.
///
/// The ID of the member.
/// The order value.
///
/// is less than or equal to zero.
/// -or-
/// is less than zero.
///
public PlayOrder(int memberId, int orderValue)
{
MemberId = memberId;
Value = orderValue;
}
private int _memberId;
///
/// Gets or sets the member ID.
///
/// The member ID.
///
/// is less than or equal to zero.
///
public int MemberId
{
get => _memberId;
set
{
if (value <= 0)
{
throw new ArgumentOutOfRangeException(nameof(value), value,
"Member id can't be less than or equal to zero.");
}
_memberId = value;
}
}
private int _value;
///
/// Gets or sets the value indicating the order of the member in the playlist.
///
/// An integer value indicating the order of the member in the playlist.
///
/// is less than zero.
///
public int Value
{
get => _value;
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException(nameof(value), value,
"Order can't be less than zero.");
}
_value = value;
}
}
}
}