/// <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); }
/// <summary> /// Get the ids for each list selected by a user in the Multi-Select dialog /// </summary> public static List <int> GetUserListSelections(List <TraktListDetail> lists) { if (lists.Count == 0) { if (!GUIUtils.ShowYesNoDialog(Translation.Lists, Translation.NoListsFound, true)) { // nothing to do, return return(null); } var list = new TraktListDetail(); if (TraktLists.GetListDetailsFromUser(ref list)) { TraktLogger.Info("Creating new list for user online. Privacy = '{0}', Name = '{1}'", list.Privacy, list.Name); var response = TraktAPI.TraktAPI.CreateCustomList(list); if (response != null) { ClearListCache(TraktSettings.Username); return(new List <int> { (int)response.Ids.Trakt }); } } return(null); } List <MultiSelectionItem> selectedItems = GUIUtils.ShowMultiSelectionDialog(Translation.SelectLists, GetMultiSelectItems(lists)); if (selectedItems == null) { return(null); } var listIds = new List <int>(); foreach (var item in selectedItems.Where(l => l.Selected == true)) { listIds.Add(int.Parse(item.ItemID)); } return(listIds); }