Advertisement
RickDB

GUIOnlineVideos.cs

Mar 31st, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.86 KB | None | 0 0
  1.         void OnItemSelected(GUIListItem item, GUIControl parent)
  2.         {
  3.               // Dyamic preloading when user is near next page label (default offset 10)
  4.               /*
  5.               try
  6.               {
  7.                 if (selectedSite.HasNextPage && CurrentState == State.videos)
  8.                 {
  9.                   int totalItems = GUI_facadeView.Count;
  10.                   int selectedItemIndex = GUI_facadeView.SelectedListItemIndex;
  11.                   int itemOffset = Math.Abs(totalItems - selectedItemIndex);
  12.  
  13.                   if (itemOffset <= 10 && itemOffset > 0)
  14.                   {
  15.                     MediaPortal.GUI.Library.Log.Debug(string.Format("Loading next page automatically..[offset: {0}]", itemOffset));
  16.  
  17.                     preloadingNextPage = true;
  18.                     GUIWindowManager.SendThreadCallback((p1, p2, o) =>
  19.                     {
  20.                       DisplayVideos_NextPagePreload();
  21.                       return 0;
  22.                     }, 0, 0, null);
  23.  
  24.                     MediaPortal.GUI.Library.Log.Debug("Successfully loaded next page automatically");
  25.                   }
  26.                 }
  27.               }
  28.               catch (Exception e)
  29.               {
  30.                 preloadingNextPage = false;
  31.                 MediaPortal.GUI.Library.Log.Error("Error during preloading");
  32.                 MediaPortal.GUI.Library.Log.Error(e.Message);
  33.               }
  34.               */
  35.  
  36.               // Static preloading when user is over Next Page label
  37.               if (item.Label == Translation.Instance.NextPage && !Gui2UtilConnector.Instance.IsBusy)
  38.               {
  39.                 MediaPortal.GUI.Library.Log.Debug("Loading next page automatically..");
  40.                
  41.                 GUIWindowManager.SendThreadCallback((p1, p2, o) => { DisplayVideos_NextPagePreload(); return 0; }, 0, 0, null);
  42.  
  43.                 MediaPortal.GUI.Library.Log.Debug("Successfully loaded next page automatically");
  44.               }
  45.  
  46.  
  47.             OnlineVideosGuiListItem ovItem = item as OnlineVideosGuiListItem;
  48.             if (parent == GUI_infoList)
  49.             {
  50.                 SetGuiProperties_ExtendedVideoInfo(ovItem != null ? ovItem.Item as VideoInfo : null, true);
  51.             }
  52.             else
  53.             {
  54.                 SetGuiProperties_ExtendedVideoInfo(ovItem != null ? ovItem.Item as VideoInfo : null, false);
  55.                 GUIPropertyManager.SetProperty("#OnlineVideos.desc", ovItem != null ? ovItem.Description : string.Empty);
  56.                 GUIPropertyManager.SetProperty("#OnlineVideos.length", ovItem != null && ovItem.Item is VideoInfo ? Helpers.TimeUtils.TimeFromSeconds((ovItem.Item as VideoInfo).Length) : string.Empty);
  57.                 GUIPropertyManager.SetProperty("#OnlineVideos.aired", ovItem != null && ovItem.Item is VideoInfo ? (ovItem.Item as VideoInfo).Airdate : string.Empty);
  58.             }
  59.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement