Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void OnItemSelected(GUIListItem item, GUIControl parent)
- {
- // Dyamic preloading when user is near next page label (default offset 10)
- /*
- try
- {
- if (selectedSite.HasNextPage && CurrentState == State.videos)
- {
- int totalItems = GUI_facadeView.Count;
- int selectedItemIndex = GUI_facadeView.SelectedListItemIndex;
- int itemOffset = Math.Abs(totalItems - selectedItemIndex);
- if (itemOffset <= 10 && itemOffset > 0)
- {
- MediaPortal.GUI.Library.Log.Debug(string.Format("Loading next page automatically..[offset: {0}]", itemOffset));
- preloadingNextPage = true;
- GUIWindowManager.SendThreadCallback((p1, p2, o) =>
- {
- DisplayVideos_NextPagePreload();
- return 0;
- }, 0, 0, null);
- MediaPortal.GUI.Library.Log.Debug("Successfully loaded next page automatically");
- }
- }
- }
- catch (Exception e)
- {
- preloadingNextPage = false;
- MediaPortal.GUI.Library.Log.Error("Error during preloading");
- MediaPortal.GUI.Library.Log.Error(e.Message);
- }
- */
- // Static preloading when user is over Next Page label
- if (item.Label == Translation.Instance.NextPage && !Gui2UtilConnector.Instance.IsBusy)
- {
- MediaPortal.GUI.Library.Log.Debug("Loading next page automatically..");
- GUIWindowManager.SendThreadCallback((p1, p2, o) => { DisplayVideos_NextPagePreload(); return 0; }, 0, 0, null);
- MediaPortal.GUI.Library.Log.Debug("Successfully loaded next page automatically");
- }
- OnlineVideosGuiListItem ovItem = item as OnlineVideosGuiListItem;
- if (parent == GUI_infoList)
- {
- SetGuiProperties_ExtendedVideoInfo(ovItem != null ? ovItem.Item as VideoInfo : null, true);
- }
- else
- {
- SetGuiProperties_ExtendedVideoInfo(ovItem != null ? ovItem.Item as VideoInfo : null, false);
- GUIPropertyManager.SetProperty("#OnlineVideos.desc", ovItem != null ? ovItem.Description : string.Empty);
- GUIPropertyManager.SetProperty("#OnlineVideos.length", ovItem != null && ovItem.Item is VideoInfo ? Helpers.TimeUtils.TimeFromSeconds((ovItem.Item as VideoInfo).Length) : string.Empty);
- GUIPropertyManager.SetProperty("#OnlineVideos.aired", ovItem != null && ovItem.Item is VideoInfo ? (ovItem.Item as VideoInfo).Airdate : string.Empty);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement