private void DeleteList(TraktListDetail list)
{
if (!GUIUtils.ShowYesNoDialog(Translation.Lists, Translation.ConfirmDeleteList, false))
{
return;
}
GUIBackgroundTask.Instance.ExecuteInBackgroundAndCallback(() =>
{
TraktLogger.Info("Deleting list from online. Name = '{0}', Id = '{1}'", list.Name, list.Ids.Trakt);
return TraktAPI.TraktAPI.DeleteUserList("me", list.Ids.Trakt.ToString());
},
delegate(bool success, object result)
{
if (success)
{
if ((result as bool?) == true)
{
// remove from MovingPictures categories and filters menu
if (TraktHelper.IsMovingPicturesAvailableAndEnabled)
{
// not very thread safe if we tried to delete more than one before response!
TraktHandlers.MovingPictures.RemoveCustomListNode(list.Name);
}
// reload with new list
TraktLists.ClearListCache(TraktSettings.Username);
LoadLists();
}
else
{
GUIUtils.ShowNotifyDialog(Translation.Lists, Translation.FailedDeleteList);
}
}
}, Translation.DeletingList, true);
}