public AudioPlayerPage()
 {
     InitializeComponent();
     BindingContext = new AudioPlayerViewModel()
     {
         ContentType = Constants.ContentType.Remote,
         Source      = "https://swaong.azurewebsites.net/Uploads/messagedd58c21a-d4af-460d-9ae5-8e966b017a54-20170705132008aac-msg..wav"
     };
 }
        public override async void Init(object obj = null)
        {
            await App.Configuration.InitialAsync(this);

            _model = new AudioPlayerViewModel()
            {
                Root = (RootPage)obj,
                DisplaySortByListAction = DisplaySortByList
            };
            _model.SetActivityResource(false, true);
            BindingContext = _model;
            await _model.GetFilesAsync();
        }
Пример #3
0
 protected override void HandleOnNavigatedTo(NavigationEventArgs e)
 {
     base.HandleOnNavigatedTo(e);
     if (!this._isInitialized)
     {
         AudioPlayerViewModel audioPlayerViewModel = new AudioPlayerViewModel();
         audioPlayerViewModel.PreventPositionUpdates = true;
         base.DataContext = audioPlayerViewModel;
         audioPlayerViewModel.PreventPositionUpdates = false;
         //int num = ((Page)this).NavigationContext.QueryString["startPlaying"] == bool.TrueString ? 1 : 0;
         this._isInitialized = true;
     }
     this.VM.Activate(true);
     this.UpdateAppBar();
 }
Пример #4
0
        private async void Init(object obj)
        {
            await App.Configuration.InitialAsync(this);

            _model = new AudioPlayerViewModel()
            {
                Root = (RootPage)obj,
                DisplaySortByListAction = DisplaySortByList
            };
            BindingContext = _model;
            if (await _devicePermissionServices.RequestDeviceKeepWakePermission())
            {
                _model.IsPermissionGranted = true;
            }
            await _model.GetFilesAsync();
        }
Пример #5
0
        public IActionResult AudioPlayer(int id, int firstSongIndex)
        {
            if (!_appDbContext.UserOwnsPlaylist(User.FindFirstValue(ClaimTypes.NameIdentifier), id))
                return RedirectToAction("Index", "Home");

            List<Song> songs = _appDbContext.GetSongsOfPlaylist(id);
            string[] songsPaths = new string[songs.Count];
            string[] songsTitles = new string[songs.Count];

            for(int i = 0; i < songs.Count; i++)
            {
                songsPaths[i] = songs[i].Path;
                songsTitles[i] = songs[i].Title;
            }

            AudioPlayerViewModel model = new AudioPlayerViewModel()
            {
                Playlist = _appDbContext.GetPlaylist(id),
                SongsPaths = songsPaths,
                SongsTitles = songsTitles,
                FirstSongIndex = firstSongIndex,
            };
            return View(model);
        }
Пример #6
0
 public NowPlayingPage()
 {
     InitializeComponent();
     BindingContext = new AudioPlayerViewModel(DependencyService.Get <IAudioPlayerService>());
 }
Пример #7
0
        //private DownloadedAudio item;

        //public AudioPlayerViewModel Vm => BindingContext as AudioPlayerViewModel;

        public PlayAudioPage(ChurchMedia media, string v)
        {
            InitializeComponent();
            BindingContext = new AudioPlayerViewModel(media, v);
        }