Ejemplo n.º 1
0
        void AddCovers(List<int> list)
        {
            for(int i = 0; i < list.Count; i++) {
                tracks.Add(list[i]);
                Dispatcher.Invoke(() => {
                    var cover = new CoverItem(list[i]);
                    cover.Margin = new Thickness(10, 0, 10, 10);
                    cover.Cursor = Cursors.Hand;
                    cover.MouseDown += (sender, e) => {
                        if(Player.Tracks != tracks)
                            Player.Tracks = tracks;
                        Player.Play(panel.Children.IndexOf((CoverItem)sender));
                    };

                    panel.Children.Add(cover);
                });
            }
            busy = false;
        }
        public PlaylistPage(Playlist playlist)
        {
            InitializeComponent();

            Task.Factory.StartNew(() => {
                Core.ToggleSpinner(grid);

                for(int i = 0; i < playlist.Tracks.Count; i++) {
                    var t = playlist.Tracks[i];
                    Dispatcher.Invoke(() => {
                        var cover = new CoverItem(t);
                        cover.Margin = new Thickness(10, 0, 10, 10);
                        cover.Cursor = Cursors.Hand;
                        cover.MouseDown += (sender, e) => { Player.Tracks = playlist.Tracks; Player.Play(panel.Children.IndexOf((CoverItem)sender)); };
                        panel.Children.Add(cover);
                    });
                }

                Core.ToggleSpinner(grid);
            });
        }
Ejemplo n.º 3
0
        public PlaylistPage(Playlist playlist)
        {
            InitializeComponent();

            Task.Factory.StartNew(() => {
                Core.ToggleSpinner(grid);

                for (int i = 0; i < playlist.Tracks.Count; i++)
                {
                    var t = playlist.Tracks[i];
                    Dispatcher.Invoke(() => {
                        var cover        = new CoverItem(t);
                        cover.Margin     = new Thickness(10, 0, 10, 10);
                        cover.Cursor     = Cursors.Hand;
                        cover.MouseDown += (sender, e) => { Player.Tracks = playlist.Tracks; Player.Play(panel.Children.IndexOf((CoverItem)sender)); };
                        panel.Children.Add(cover);
                    });
                }

                Core.ToggleSpinner(grid);
            });
        }
Ejemplo n.º 4
0
        void AddCovers(List <int> list)
        {
            for (int i = 0; i < list.Count; i++)
            {
                tracks.Add(list[i]);
                Dispatcher.Invoke(() => {
                    var cover        = new CoverItem(list[i]);
                    cover.Margin     = new Thickness(10, 0, 10, 10);
                    cover.Cursor     = Cursors.Hand;
                    cover.MouseDown += (sender, e) => {
                        if (Player.Tracks != tracks)
                        {
                            Player.Tracks = tracks;
                        }
                        Player.Play(panel.Children.IndexOf((CoverItem)sender));
                    };

                    panel.Children.Add(cover);
                });
            }
            busy = false;
        }
Ejemplo n.º 5
0
        void AddCovers(List <int> list)
        {
            for (int i = 0; i < list.Count; i++)
            {
                if (tracks.Contains(list[i]))
                {
                    continue;
                }

                tracks.Add(list[i]);
                Dispatcher.Invoke(() => {
                    var cover        = new CoverItem(list[i]);
                    cover.MouseDown += (sender, e) => {
                        if (Player.Tracks != tracks)
                        {
                            Player.Tracks = tracks;
                        }
                        Player.Play(panel.Children.IndexOf((CoverItem)sender));
                    };

                    panel.Children.Add(cover);
                });
            }
        }