コード例 #1
0
        private async Task <bool> Down(LibraryHierarchyNode libraryHierarchyNode, IList <LibraryBrowserFrame> frames, bool updateSelection)
        {
            var libraryHierarchyNodes = this.LibraryHierarchyBrowser.GetNodes(libraryHierarchyNode);

            if (!libraryHierarchyNodes.Any())
            {
                return(false);
            }
            var frame = new LibraryBrowserFrame(
                libraryHierarchyNode,
                new[]
            {
                LibraryHierarchyNode.Empty
            }.Concat(libraryHierarchyNodes)
                );

            if (object.ReferenceEquals(this.Frames, frames))
            {
                await Windows.Invoke(() => frames.Add(frame)).ConfigureAwait(false);
            }
            else
            {
                frames.Add(frame);
            }
            if (updateSelection && object.ReferenceEquals(this.Frames, frames))
            {
                await Windows.Invoke(() => this.SelectedItem = libraryHierarchyNodes.FirstOrDefault()).ConfigureAwait(false);
            }
            return(true);
        }
コード例 #2
0
ファイル: LibraryBrowser.cs プロジェクト: Raimusoft/FoxTunes
 protected virtual bool Validate(LibraryBrowserFrame frame)
 {
     if (frame.Items == null)
     {
         return(false);
     }
     if (object.ReferenceEquals(frame.ItemsSource, LibraryHierarchyNode.Empty))
     {
         //Root frame.
         return(frame.Items.SequenceEqual(this.Items));
     }
     //Child frame, first element is "back" button.
     return(frame.Items.Skip(1).SequenceEqual(this.LibraryHierarchyBrowser.GetNodes(frame.ItemsSource)));
 }