public static ObservableCollection <ListItem> FetchAndAddDetailsToListView(ResultResponse result, string query) { var source = new ObservableCollection <ListItem>(); if (result.MediaType == MediaTypes.TV) { var ob = (SearchContainer <SearchTv>)result.Result; source = Tmdb.ExtractTvDetailsIntoListItem(ob); } else if (result.MediaType == MediaTypes.Movie) { if (query.ToLower().Contains("collection")) { var ob = (SearchContainer <SearchCollection>)result.Result; source = Tmdb.ExtractCollectionDetailsIntoListItem(ob); } else { dynamic ob; try { ob = (SearchContainer <SearchMovie>)result.Result; source = Tmdb.ExtractMoviesDetailsIntoListItem(ob); } catch (Exception) { ob = (SearchContainer <SearchCollection>)result.Result; source = Tmdb.ExtractCollectionDetailsIntoListItem(ob); } } } else if (result.MediaType == MediaTypes.MTV) { var ob = (SearchContainer <SearchBase>)result.Result; source = Tmdb.ExtractResourceDetailsIntoListItem(ob); } else if (result.MediaType == MediaTypes.Game) { var ob = (Game[])result.Result; source = IgdbClass.ExtractGameDetailsIntoListItem(ob); } return(source); }
public static void ShowSearchResult(this IDialogService dialogService, string searchMode, string query, string folderPath, ResultResponse result, Tmdb tmdbObject, IgdbClass igdbObject, Action <IDialogResult> callBack) { var p = new DialogParameters { { "query", query }, { "result", result }, { "searchmode", searchMode }, { "tmdbObject", tmdbObject }, { "igdbObject", igdbObject }, { "folderpath", folderPath } }; dialogService.ShowDialog("SearchResult", p, callBack); }