public async void InitializeLiveRecommend() { using (var releaser = await _UpdateLock.LockAsync()) { if (LiveProgram == null) { return; } if (IsLiveRecommendInitialized) { return; } try { if (NiconicoSession.IsLoggedIn) { _Reservations = await NiconicoSession.ToolkitContext.Timeshift.GetTimeshiftReservationsDetailAsync(); } } catch { } try { LiveRecommendResponse recommendResponse = null; if (LiveProgram?.SocialGroupId.StartsWith("co") ?? false) { recommendResponse = await NiconicoSession.ToolkitContext.Recommend.GetLiveRecommendForUserAsync(LiveProgram.Id, LiveProgram.ProviderId); } else { recommendResponse = await NiconicoSession.ToolkitContext.Recommend.GetLiveRecommendForChannelAsync(LiveProgram.Id, LiveProgram.SocialGroupId); } if (recommendResponse.IsSuccess) { foreach (var recommendItem in recommendResponse.Data.Items) { _ReccomendItems.Add(recommendItem); } } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } finally { IsLiveRecommendInitialized = true; OnPropertyChanged(nameof(IsLiveRecommendInitialized)); IsEmptyLiveRecommendItems = !_ReccomendItems.Any(); OnPropertyChanged(nameof(IsEmptyLiveRecommendItems)); } } }
public LiveSearchSource( LiveSearchOptionsQuery query, TimeshiftReservationsDetailResponse reservation, SearchProvider searchProvider, NiconicoSession niconicoSession, NicoLiveCacheRepository nicoLiveCacheRepository ) { Query = query; _reservation = reservation; SearchProvider = searchProvider; NiconicoSession = niconicoSession; _nicoLiveCacheRepository = nicoLiveCacheRepository; }