コード例 #1
0
    private void OnItemSelected(GUIListItem item, GUIControl parent)
    {
      GUIPropertyManager.SetProperty("#groupmovielist", string.Empty);
      string strView = string.Empty;
      int currentViewlvl = 0;
      
      if (handler != null)
      {
        strView = handler.CurrentLevelWhere.ToLowerInvariant();
        currentViewlvl = handler.CurrentLevel;

        if (handler.CurrentLevel > 0)
        {
          FilterDefinition defCurrent = (FilterDefinition) handler.View.Filters[handler.CurrentLevel - 1];
          string selectedValue = defCurrent.SelectedValue;
          Int32 iSelectedValue;
          
          if (Int32.TryParse(selectedValue, out iSelectedValue))
          {
            if (strView == "actor" || strView == "director")
            {
              selectedValue = VideoDatabase.GetActorNameById(iSelectedValue);
            }

            if (strView == "genre")
            {
              selectedValue = VideoDatabase.GetGenreById(iSelectedValue);
            }

            if (strView == "user groups")
            {
              selectedValue = VideoDatabase.GetUserGroupById(iSelectedValue);
            }
          }

          GUIPropertyManager.SetProperty("#currentmodule",
                                         String.Format("{0}/{1} - {2}", GUILocalizeStrings.Get(100006),
                                                       handler.LocalizedCurrentView, selectedValue));
        }
      }

      if (item.Label == "..")
      {
        IMDBMovie notMovie = new IMDBMovie();
        notMovie.IsEmpty = true;
        notMovie.SetProperties(true, string.Empty);
        IMDBActor notActor = new IMDBActor();
        notActor.SetProperties();
        return;
      }
      
      // Set current item if thumb thread is working (thread can still update thumbs while user changed
      // item) thus preventing sudden jump to initial selected item before thread start
      if (_setThumbs != null && _setThumbs.IsAlive)
      {
        currentSelectedItem = facadeLayout.SelectedListItemIndex;
      }

      IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;
      
      if (movie == null)
      {
        movie = new IMDBMovie();
      }
      
      if (!string.IsNullOrEmpty(movie.VideoFileName))
      {
        movie.SetProperties(false, movie.VideoFileName);
      }
      else
      {
        switch (strView)
        {
          case "actorindex":
          case "directorindex":
          case "titleindex":
            movie.IsEmpty = true;
            movie.SetProperties(false, string.Empty);
            break;

          default:
            movie.SetProperties(false, string.Empty);
            break;
        }
        
        // Set title properties for other views (year, genres..)
        if (!string.IsNullOrEmpty(item.Label))
        {
          GUIPropertyManager.SetProperty("#title", item.Label);

          if (item.MusicTag != null)
          {
            GUIPropertyManager.SetProperty("#groupmovielist", item.MusicTag.ToString());
          }
        }
      }
      
      IMDBActor actor = VideoDatabase.GetActorInfo(movie.ActorID);
      
      if (actor != null)
      {
        actor.SetProperties();
      }
      else
      {
        actor = new IMDBActor();
        actor.SetProperties();
      }

      if (movie.ID >= 0)
      {
        string titleExt = movie.Title + "{" + movie.ID + "}";
        string coverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt);
        
        if (Util.Utils.FileExistsInCache(coverArtImage))
        {
          facadeLayout.FilmstripLayout.InfoImageFileName = coverArtImage;
        }
      }
      
      if (movie.Actor != string.Empty)
      {
        GUIPropertyManager.SetProperty("#title", movie.Actor);
        string coverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieActors, movie.ActorID.ToString());
        
        if (Util.Utils.FileExistsInCache(coverArtImage))
        {
          facadeLayout.FilmstripLayout.InfoImageFileName = coverArtImage;
        }
      }
      
      // Random movieId by view (for FA) for selected group
      ArrayList mList = new ArrayList();
      GetItemViewHistory(strView, mList, currentViewlvl);
    }
コード例 #2
0
    protected override void OnPageDestroy(int newWindowId)
    {
      if ((_scanThread != null) && (_scanThread.IsAlive))
      {
        _scanThread.Abort();
        _scanThread = null;
      }
      // Refresh actor info
      _currentActor = VideoDatabase.GetActorInfo(_currentActor.ID);
      
      SaveState();

      //Clean properties
      IMDBActor actor = new IMDBActor();
      actor.SetProperties();
      
      base.OnPageDestroy(newWindowId);
    }
コード例 #3
0
    private void OnItemSelected(GUIListItem item, GUIControl parent)
    {
      if (item.Label == "..")
      {
        IMDBMovie notMovie = new IMDBMovie();
        notMovie.SetProperties(true, string.Empty);
        IMDBActor notActor = new IMDBActor();
        notActor.SetProperties();
        return;
      }
      IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;

      if (movie == null)
      {
        movie = new IMDBMovie();
      }

      ArrayList files = new ArrayList();
      VideoDatabase.GetFilesForMovie(movie.ID, ref files);

      if (files.Count > 0)
      {
        movie.SetProperties(false, (string)files[0]);
      }
      else
      {
        movie.SetProperties(false, string.Empty);
      }

      if (movie.ID >= 0)
      {
        string titleExt = movie.Title + "{" + movie.ID + "}";
        string coverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt);

        if (Util.Utils.FileExistsInCache(coverArtImage))
        {
          facadeLayout.FilmstripLayout.InfoImageFileName = coverArtImage;
        }
      }
    }
コード例 #4
0
    private void OnItemSelected(GUIListItem item, GUIControl parent)
    {
      GUIPropertyManager.SetProperty("#groupmovielist", string.Empty);
      
      if (handler.CurrentLevel > 0)
      {
        FilterDefinition defCurrent = (FilterDefinition)handler.View.Filters[handler.CurrentLevel - 1];
        string selectedValue = defCurrent.SelectedValue;

        if (Regex.Match(selectedValue, @"[\d]*").Success)
        {
          if (defCurrent.Where == "actor" || defCurrent.Where == "director")
          {
            selectedValue = VideoDatabase.GetActorNameById(Convert.ToInt32(defCurrent.SelectedValue));
          }

          if (defCurrent.Where == "genre")
          {
            selectedValue = VideoDatabase.GetGenreById(Convert.ToInt32(defCurrent.SelectedValue));
          }

          if (defCurrent.Where == "user groups")
          {
            selectedValue = VideoDatabase.GetUserGroupById(Convert.ToInt32(defCurrent.SelectedValue));
          }
        }
        GUIPropertyManager.SetProperty("#currentmodule",
                                       String.Format("{0}/{1} - {2}", GUILocalizeStrings.Get(100006),
                                                     handler.LocalizedCurrentView, selectedValue));
      }
      
      if (item.Label == "..")
      {
        IMDBMovie notMovie = new IMDBMovie();
        notMovie.SetProperties(true, string.Empty);
        IMDBActor notActor = new IMDBActor();
        notActor.SetProperties();
        return;
      }
      
      // Set current item if thumb thread is working (thread can still update thumbs while user changed
      // item) thus preventing sudden jump to initial selected item before thread start
      if (_setThumbs != null && _setThumbs.IsAlive)
      {
        currentSelectedItem = facadeLayout.SelectedListItemIndex;
      }

      IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;
      
      if (movie == null)
      {
        movie = new IMDBMovie();
      }
      
      ArrayList files = new ArrayList();
      VideoDatabase.GetFilesForMovie(movie.ID, ref files);
      
      if (files.Count > 0)
      {
        movie.SetProperties(false, (string)files[0]);
      }
      else
      {
        movie.SetProperties(false, string.Empty);

        // Set title properties for other views (year, genres..)
        if (!string.IsNullOrEmpty(item.Label))
        {
          GUIPropertyManager.SetProperty("#title", item.Label);
          GUIPropertyManager.SetProperty("#groupmovielist", SetMovieListGroupedBy(item));
        }
      }
      
      IMDBActor actor = VideoDatabase.GetActorInfo(movie.ActorID);
      
      if (actor != null)
      {
        actor.SetProperties();
      }
      else
      {
        actor = new IMDBActor();
        actor.SetProperties();
      }

      if (movie.ID >= 0)
      {
        string titleExt = movie.Title + "{" + movie.ID + "}";
        string coverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt);
        
        if (Util.Utils.FileExistsInCache(coverArtImage))
        {
          facadeLayout.FilmstripLayout.InfoImageFileName = coverArtImage;
        }
      }
      
      if (movie.Actor != string.Empty)
      {
        GUIPropertyManager.SetProperty("#title", movie.Actor);
        string coverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieActors, movie.ActorID.ToString());
        
        if (Util.Utils.FileExistsInCache(coverArtImage))
        {
          facadeLayout.FilmstripLayout.InfoImageFileName = coverArtImage;
        }
      }
      
      // Random movieId by view (for FA) for selected groups
      string view = handler.CurrentLevelWhere;
      ArrayList mList = new ArrayList();
      GetItemViewHistory(view, mList);
    }