本文整理汇总了C#中IAlbum.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# IAlbum.Delete方法的具体用法?C# IAlbum.Delete怎么用?C# IAlbum.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAlbum
的用法示例。
在下文中一共展示了IAlbum.Delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteAlbum
/// <summary>
/// Permanently delete this album from the data store and optionally the hard drive. Validation is performed prior to deletion to ensure
/// current user has delete permission and the album can be safely deleted. The validation is contained in the method
/// <see cref="ValidateBeforeAlbumDelete"/> and may be invoked separately if desired.
/// </summary>
/// <param name="album">The album to delete. If null, the function returns without taking any action.</param>
/// <param name="deleteFromFileSystem">if set to <c>true</c> the files and directories associated with the album
/// are deleted from the hard disk. Set this to <c>false</c> to delete only the database records.</param>
/// <exception cref="CannotDeleteAlbumException">Thrown when the album does not meet the requirements for safe deletion.
/// This includes detecting when the media objects path is read only and when the album is or contains the user album
/// parent album and user albums are enabled.</exception>
/// <exception cref="GallerySecurityException">Thrown when the current user does not have permission to delete the album.</exception>
public static void DeleteAlbum(IAlbum album, bool deleteFromFileSystem = true)
{
if (album == null)
return;
ValidateBeforeAlbumDelete(album);
OnBeforeAlbumDelete(album);
if (deleteFromFileSystem)
{
album.Delete();
}
else
{
album.DeleteFromGallery();
}
HelperFunctions.PurgeCache();
}
示例2: DeleteAlbum
/// <summary>
/// Permanently delete this album from the data store and disk. Validation is performed prior to deletion to ensure
/// album can be safely deleted. The validation is contained in the method <see cref="ValidateBeforeAlbumDelete"/>
/// and may be invoked separately if desired. No security checks are performed; the caller must ensure the user
/// has permission to delete an album prior to invoking this method.
/// </summary>
/// <param name="album">The album to delete. If null, the function returns without taking any action.</param>
/// <exception cref="ErrorHandler.CustomExceptions.CannotDeleteAlbumException">Thrown when the album does not meet the
/// requirements for safe deletion. At this time this exception is thrown only when the album is or contains the user album
/// parent album and user albums are enabled.</exception>
public static void DeleteAlbum(IAlbum album)
{
if (album == null)
return;
ValidateBeforeAlbumDelete(album);
OnBeforeAlbumDelete(album);
album.Delete();
HelperFunctions.PurgeCache();
}