private void loadMainSections()
        {
            gvServerTrack.DataSource = null;
            tvServerSection.Nodes.Clear();
            // Add the root node
            TreeNode rootNode = tvServerSection.Nodes.Add(String.Format("{0} [{1}]", PMSServer.Name, PMSServer.baseUrl));

            foreach (LibrarySection section in PMSServer.musicSections())
            {
                TreeNode tn = rootNode.Nodes.Add(section.Key, section.Title);
                tn.Tag = section;
                loadSubSection(tn);
            }

            if (AllowVideos)
            {
                foreach (LibrarySection section in PMSServer.movieSections())
                {
                    TreeNode tn = rootNode.Nodes.Add(section.Key, section.Title);
                    tn.Tag = section;
                    loadSubSection(tn);
                }
            }
            rootNode.ExpandAll();
        }
Пример #2
0
 public void setMainSections()
 {
     this.reset();
     foreach (LibrarySection section in PMSServer.musicSections())
     {
         this.addMainSection(section as MainSection);
     }
 }
        private void loadSubSection(TreeNode _parentNode)
        {
            LibrarySection librarySection = (LibrarySection)_parentNode.Tag;

            if (librarySection != null)
            {
                List <LibrarySection> sections = PMSServer.librarySections(librarySection);
                if (!librarySection.HasTracks)
                {
                    foreach (LibrarySection section in sections)
                    {
                        TreeNode tn = _parentNode.Nodes.Add(section.Key, section.Title);
                        tn.Tag = section;
                    }
                }
            }
        }
Пример #4
0
        public bool matchOnTitle(ImportEntry _singleEntry, bool _checkAll)
        {
            bool anyMatched = false;

            var entries =
                from entry in m_importFile.Entries
                where ((_checkAll || !entry.Matched) && !String.IsNullOrEmpty(entry.Title)) && (_singleEntry == null || entry == _singleEntry)
                select entry;

            string baseMessage = "Find matches based on title.... ";

            progressMessage(baseMessage, true);
            foreach (ImportEntry entry in entries)
            {
                progressMessage(entry.Title, false);
                entry.resetMatches(false);
                foreach (MainSection mainSection in m_mainSections)
                {
                    SearchSection  searchSection  = mainSection.TitleSearchSection();
                    LibrarySection librarySection = (searchSection != null) ? searchSection.createFromSearch(entry.Title) : null;
                    if (librarySection != null)
                    {
                        librarySection.IsMusic = mainSection.IsMusic;
                        var tracks =
                            from track in PMSServer.getSectionElements(librarySection, false)
                            select track;

                        foreach (XElement trackElement in tracks)
                        {
                            if (entry.AddMatch(new MatchEntry(mainSection, trackElement)))
                            {
                                anyMatched = true;
                            }
                        }
                    }
                }
                entry.CheckBestMatch();
            }
            progressMessage("", true);
            return(anyMatched);
        }
 private void tvServerSection_AfterSelect(object sender, TreeViewEventArgs e)
 {
     gvServerTrack.DataSource = null;
     if (e.Node != null && e.Node.Tag != null)
     {
         LibrarySection librarySection = e.Node.Tag as LibrarySection;
         if (librarySection != null)
         {
             if (!librarySection.HasTracks && e.Node.Nodes.Count == 0)
             {
                 loadSubSection(e.Node);
                 e.Node.Expand();
             }
             if (librarySection.HasTracks)
             {
                 gvServerTrack.DataSource = PMSServer.librarySections(librarySection);
             }
         }
     }
     enableServerSectionCommands();
 }