public QueuePageViewModel(INavigationService navigationService)
            : base(navigationService)
        {
            Title = "Queue";

            this.navigationService = navigationService;
            this.playerService     = PlayerService.Instance;
            this.trackManager      = App.Container.Resolve <ITrackManager>();

            ProgressDegree = 0;

            TapItemCommand = new DelegateCommand <Syncfusion.ListView.XForms.ItemTappedEventArgs>(tapItem);

            GoCommand = new DelegateCommand(() =>
            {
                var tracks = trackManager.GetAllTracks().GetAwaiter().GetResult();

                Tracks = new ObservableCollection <Track>(tracks);
            });

            PlayOrPauseCommand = new DelegateCommand(playOrPauseAction);
            NextCommand        = new DelegateCommand(nextTrackAction);
            PreviousCommand    = new DelegateCommand(previousTrackAction);

            playerService.UpdateProgress += delegate(object sender, PlayerArgs args)
            {
                ProgressDegree = args.ProgressDegree;
            };

            Track = playerService.CurrentTrack;
        }
Beispiel #2
0
        public IActionResult GetAllTracks()
        {
            var Trackes = TrackManager.GetAllTracks();

            if (Trackes == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(Trackes));
            }
        }
        private PlayerService()
        {
            Tracks       = new List <Track>();
            CurrentTrack = new Track();

            mediaPlayer  = App.Container.Resolve <IMyMediaPlayer>();
            trackManager = App.Container.Resolve <ITrackManager>();

            RepeatTracks  = false;
            ShuffleTracks = false;

            updateProgressThread = new Thread(updateProgres);
            updateProgressThread.IsBackground = true;
            updateProgressThread.Start();

            Tracks = trackManager.GetAllTracks().GetAwaiter().GetResult();
        }