当前位置: 首页>>代码示例>>C#>>正文


C# IMDBMovie.SetProperties方法代码示例

本文整理汇总了C#中MediaPortal.Video.Database.IMDBMovie.SetProperties方法的典型用法代码示例。如果您正苦于以下问题:C# IMDBMovie.SetProperties方法的具体用法?C# IMDBMovie.SetProperties怎么用?C# IMDBMovie.SetProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MediaPortal.Video.Database.IMDBMovie的用法示例。


在下文中一共展示了IMDBMovie.SetProperties方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnItemSelected

    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)
//.........这里部分代码省略.........
开发者ID:edalex86,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIVideoTitle.cs

示例2: LoadDirectory


//.........这里部分代码省略.........
      // Sort
      facadeLayout.Sort(new VideoSort(CurrentSortMethod, CurrentSortAsc));
      int itemIndex = 0;
      string viewFolder = SetItemViewHistory();
      string selectedItemLabel = m_history.Get(viewFolder);
      
      if (string.IsNullOrEmpty(selectedItemLabel) && facadeLayout.SelectedListItem != null)
      {
        selectedItemLabel = facadeLayout.SelectedListItem.Label;
      }

      int itemCount = itemlist.Count;
      
      if (itemlist.Count > 0)
      {
        GUIListItem rootItem = (GUIListItem)itemlist[0];
        if (rootItem.Label == "..")
        {
          itemCount--;
        }
      }

      //set object count label
      GUIPropertyManager.SetProperty("#itemcount", Util.Utils.GetObjectCountLabel(itemCount));

      // Clear info for zero result
      if (itemlist.Count == 0)
      {
        GUIListItem item = new GUIListItem();
        item.Label = GUILocalizeStrings.Get(284);
        IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;
        movie = new IMDBMovie();
        item.AlbumInfoTag = movie;
        movie.SetProperties(false, string.Empty);
        itemlist.Add(item);
        facadeLayout.Add(item);
      }

      bool itemSelected = false;
      
      if (handler.CurrentLevel < handler.MaxLevels)
      {
        for (int i = 0; i < facadeLayout.Count; ++i)
        {
          GUIListItem item = facadeLayout[itemIndex];
          
          if (item.Label == selectedItemLabel)
          {
            currentSelectedItem = itemIndex;
            itemSelected = true;
            break;
          }

          itemIndex++;
        }
        
        switch (handler.CurrentLevelWhere.ToLowerInvariant())
        {
          case "genre":
            SetGenreThumbs(itemlist);
            break;

          case "user groups":
            SetUserGroupsThumbs(itemlist);
            break;
开发者ID:edalex86,项目名称:MediaPortal-1,代码行数:66,代码来源:GUIVideoTitle.cs

示例3: OnItemSelected

    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;
        }
      }
    }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:40,代码来源:GUIVideoPlaylist.cs

示例4: SetMovieProperties

 private void SetMovieProperties(string path)
 {
   bool isFile = false;
   if (Util.Utils.IsVideo(path))
     isFile = true;
   IMDBMovie info = new IMDBMovie();
   if (path == "..")
   {
     info.Reset();
     info.SetProperties(true);
     return;
   }
   bool isDirectory = false;
   bool isMultiMovieFolder = false;
   bool isFound = false;
   try
   {
     if (Directory.Exists(path))
     {
       isDirectory = true;
       string[] files = Directory.GetFiles(path);
       foreach (string file in files)
       {
         IMDBMovie movie = new IMDBMovie();
         VideoDatabase.GetMovieInfo(file, ref movie);
         if (!movie.IsEmpty)
         {
           if (!isFound)
           {
             info = movie;
             isFound = true;
           }
           else
           {
             isMultiMovieFolder = true;
             break;
           }
         }
       }
     }
     else
     {
       VideoDatabase.GetMovieInfo(path, ref info);
     }
     if (info.IsEmpty)
     {
       FetchMatroskaInfo(path, isDirectory, ref info);
     }
     if (info.IsEmpty && File.Exists(path + @"\VIDEO_TS\VIDEO_TS.IFO")) //still empty and is ripped DVD
     {
       VideoDatabase.GetMovieInfo(path + @"\VIDEO_TS\VIDEO_TS.IFO", ref info);
       isFile = true;
     }
     if (info.IsEmpty)
     {
       if (_markWatchedFiles)
       {
         int fID = VideoDatabase.GetFileId(path);
         byte[] resumeData = null;
         int timeStopped = VideoDatabase.GetMovieStopTimeAndResumeData(fID, out resumeData);
         if (timeStopped > 0 || resumeData != null)
           info.Watched = 1;
       }
     }
     if (isMultiMovieFolder || !isFile)
     {
       info.Reset();
       info.SetProperties(true);
       return;
     }
     info.SetProperties(false);
   }
   catch (Exception) {}
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:74,代码来源:GUIVideoFiles.cs

示例5: LoadDirectory


//.........这里部分代码省略.........
            {
              int nDuration = item.Duration;
              if (nDuration > 0)
              {
                string str = Util.Utils.SecondsToHMSString(nDuration);
                pItem.Label2 = str;
              }
              else
              {
                pItem.Label2 = string.Empty;
              }
            }
            pItem.OnItemSelected += OnItemSelected;
            itemlist.Add(pItem);
            Util.Utils.SetDefaultIcons(pItem);
          }

          iCurrentSong = 0;
          strFileName = string.Empty;
          //	Search current playlist item
          if ((m_nTempPlayListWindow == GetID && m_strTempPlayListDirectory.IndexOf(currentFolder) >= 0 &&
               g_Player.Playing
               && playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO_TEMP)
              ||
              (GetID == (int)Window.WINDOW_VIDEO_PLAYLIST &&
               playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO
               && g_Player.Playing))
          {
            iCurrentSong = playlistPlayer.CurrentSong;
            if (iCurrentSong >= 0)
            {
              playlist = playlistPlayer.GetPlaylist(playlistPlayer.CurrentPlaylistType);
              if (iCurrentSong < playlist.Count)
              {
                PlayListItem item = playlist[iCurrentSong];
                strFileName = item.FileName;
              }
            }
          }

          SetIMDBThumbs(itemlist);

          string strSelectedItem = m_history.Get(currentFolder);
          int iItem = 0;
          foreach (GUIListItem item in itemlist)
          {
            facadeLayout.Add(item);

            //	synchronize playlist with current directory
            if (strFileName.Length > 0 && item.Path == strFileName)
            {
              item.Selected = true;
            }
          }
          for (int i = 0; i < facadeLayout.Count; ++i)
          {
            GUIListItem item = facadeLayout[i];
            if (item.Label == strSelectedItem)
            {
              GUIControl.SelectItemControl(GetID, facadeLayout.GetID, iItem);
              break;
            }
            iItem++;
          }
          int iTotalItems = itemlist.Count;
          if (itemlist.Count > 0)
          {
            GUIListItem rootItem = (GUIListItem)itemlist[0];
            if (rootItem.Label == "..")
            {
              iTotalItems--;
            }
          }

          //set object count label
          GUIPropertyManager.SetProperty("#itemcount", Util.Utils.GetObjectCountLabel(iTotalItems));

          if (currentSelectedItem >= 0)
          {
            GUIControl.SelectItemControl(GetID, facadeLayout.GetID, currentSelectedItem);
          }
          else if (itemlist.Count > 0)
          {
            GUIControl.SelectItemControl(GetID, facadeLayout.GetID, 0);
          }
          else
          {
            IMDBMovie movie = new IMDBMovie();
            movie.SetProperties(false, string.Empty);
          }
          UpdateButtonStates();
          GUIWaitCursor.Hide();
        }
        catch (Exception ex)
        {
          GUIWaitCursor.Hide();
          Log.Error("GUIVideoPlaylist: An error occured while loading the directory - {0}", ex.Message);
        }
      }
    }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIVideoPlaylist.cs

示例6: OnPageLoad

    protected override void OnPageLoad()
    {
      base.OnPageLoad();
      
      currentLayout = Layout.Playlist;
      facadeLayout.CurrentLayout = currentLayout;

      LoadDirectory(string.Empty);
      if (g_Player.Playing && playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO)
      {
        int iSong = playlistPlayer.CurrentSong;
        if (iSong >= 0 && iSong <= facadeLayout.Count)
        {
          GUIControl.SelectItemControl(GetID, facadeLayout.GetID, iSong);
        }
      }
      if (facadeLayout.Count <= 0)
      {
        GUIControl.FocusControl(GetID, btnLayouts.GetID);
        IMDBMovie movie = new IMDBMovie();
        movie.SetProperties(false, string.Empty);
      }


      using (Profile.Settings settings = new Profile.MPSettings())
      {
        playlistPlayer.RepeatPlaylist = settings.GetValueAsBool("movies", "repeat", true);
      }

      if (btnRepeatPlaylist != null)
      {
        btnRepeatPlaylist.Selected = playlistPlayer.RepeatPlaylist;
      }
    }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:34,代码来源:GUIVideoPlaylist.cs

示例7: SetMovieProperties

    private void SetMovieProperties(string path, string filename)
    {
      IMDBMovie info = new IMDBMovie();

      if (path == ".." || string.IsNullOrEmpty(path) || (!Directory.Exists(path) && !Util.Utils.IsVideo(filename)))
      {
        info.Reset(true);
        info.SetProperties(true, string.Empty);
        return;
      }

      if (Directory.Exists(path) && !Util.Utils.IsVideo(filename))
      {
        info.SetProperties(true, path);
        return;
      }

      try
      {
        VideoDatabase.GetMovieInfo(filename, ref info);

        // Get recording/nfo xml
        if (info.IsEmpty)
        {
          FetchMatroskaInfo(filename, false, ref info);

          if (info.IsEmpty)
          {
            FetchMovieNfo(path, filename, ref info);
          }
        }

        info.SetProperties(false, filename);
      }
      catch (Exception)
      {
      }
    }
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:38,代码来源:GUIVideoFiles.cs

示例8: OnItemSelected

    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());
//.........这里部分代码省略.........
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIVideoTitle.cs

示例9: LoadDirectory

    protected override void LoadDirectory(string strNewDirectory)
    {
      GUIWaitCursor.Show();
      GUIListItem selectedItem = facadeLayout.SelectedListItem;
      if (selectedItem != null)
      {
        if (selectedItem.IsFolder && selectedItem.Label != "..")
        {
          m_history.Set(selectedItem.Label, currentFolder);
        }
      }
      currentFolder = strNewDirectory;

      GUIControl.ClearControl(GetID, facadeLayout.GetID);

      string objectCount = string.Empty;

      ArrayList itemlist = new ArrayList();
      ArrayList movies = ((VideoViewHandler)handler).Execute();

      if (handler.CurrentLevel > 0)
      {
        GUIListItem listItem = new GUIListItem("..");
        listItem.Path = string.Empty;
        listItem.IsFolder = true;
        Util.Utils.SetDefaultIcons(listItem);
        itemlist.Add(listItem);
      }

      foreach (IMDBMovie movie in movies)
      {
        GUIListItem item = new GUIListItem();
        item.Label = movie.Title;
        if (handler.CurrentLevel + 1 < handler.MaxLevels)
        {
          item.IsFolder = true;
        }
        else
        {
          item.IsFolder = false;
        }
       
        item.Path = movie.File;

        // Protected movies validation, checks item and if it is inside protected shares.
        // If item is inside PIN protected share, checks if user validate PIN with Unlock
        // command from context menu and returns "True" if all is ok and item will be visible
        // in movie list. Non-protected item will skip check and will be always visible.
        if (!string.IsNullOrEmpty(item.Path))
        {
          if(!CheckItem(item))
            continue;
        }
        //
        item.Duration = movie.RunTime * 60;
        item.AlbumInfoTag = movie;
        item.Year = movie.Year;
        item.DVDLabel = movie.DVDLabel;
        item.Rating = movie.Rating;
        item.IsPlayed = movie.Watched > 0 ? true : false;

        item.OnItemSelected += new GUIListItem.ItemSelectedHandler(item_OnItemSelected);

        itemlist.Add(item);
      }

      // Clear info for zero result
      if (itemlist.Count == 0)
      {
        GUIListItem item = new GUIListItem();
        item.Label = GUILocalizeStrings.Get(284);
        IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;
        movie = new IMDBMovie();
        item.AlbumInfoTag = movie;
        movie.SetProperties(false);
        itemlist.Add(item);
      }

      int itemIndex = 0;

      foreach (GUIListItem item in itemlist)
      {
        facadeLayout.Add(item);
      }

      string selectedItemLabel = m_history.Get(currentFolder);
      if (string.IsNullOrEmpty(selectedItemLabel) && facadeLayout.SelectedListItem != null)
      {
        selectedItemLabel = facadeLayout.SelectedListItem.Label;
      }

      int itemCount = itemlist.Count;
      if (itemlist.Count > 0)
      {
        GUIListItem rootItem = (GUIListItem)itemlist[0];
        if (rootItem.Label == "..")
        {
          itemCount--;
        }
      }
//.........这里部分代码省略.........
开发者ID:djblu,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIVideoTitle.cs


注:本文中的MediaPortal.Video.Database.IMDBMovie.SetProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。