/// <summary>
/// Get the slugs for each list selected by a user in the Multi-Select dialog
/// </summary>
/// <param name="username">username of user</param>
/// <param name="lists">List of lists created by user</param>
public static List <string> GetUserListSelections(List <TraktUserList> lists)
{
if (lists.Count == 0)
{
if (!GUIUtils.ShowYesNoDialog(Translation.Lists, Translation.NoListsFound, true))
{
// nothing to do, return
return(null);
}
TraktList list = new TraktList();
if (TraktLists.GetListDetailsFromUser(ref list))
{
TraktLogger.Info("Creating new '{0}' list '{1}'", list.Privacy, list.Name);
TraktAddListResponse response = TraktAPI.TraktAPI.ListAdd(list);
TraktAPI.TraktAPI.LogTraktResponse <TraktResponse>(response);
if (response.Status == "success")
{
ClearCache(TraktSettings.Username);
return(new List <string> {
response.Slug
});
}
}
return(null);
}
List <MultiSelectionItem> selectedItems = GUIUtils.ShowMultiSelectionDialog(Translation.SelectLists, GetMultiSelectItems(lists));
if (selectedItems == null)
{
return(null);
}
List <string> slugs = new List <string>();
foreach (var item in selectedItems.Where(l => l.Selected == true))
{
slugs.Add(item.ItemID);
}
return(slugs);
}