Changing folder names
This commit is contained in:
@ -0,0 +1,115 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Aurora.Models.Media;
|
||||
using Aurora.Services.Library;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Design.Views.Songs
|
||||
{
|
||||
public class SongsViewModel : BaseViewModel
|
||||
{
|
||||
#region Fields
|
||||
private ObservableCollection<BaseMedia> _songsList;
|
||||
private BaseMedia _selectedSong;
|
||||
private ILibraryService _libraryService;
|
||||
|
||||
#endregion Fields
|
||||
|
||||
#region Constructor
|
||||
public SongsViewModel(ILibraryService libraryService)
|
||||
{
|
||||
_songsList = new ObservableCollection<BaseMedia>();
|
||||
DoubleClickCommand = new Command(OnDoubleClickExecute, OnDoubleClickCanExecute);
|
||||
|
||||
this._libraryService = libraryService;
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
#endregion Constructor
|
||||
|
||||
#region Properties
|
||||
public ObservableCollection<BaseMedia> SongsList
|
||||
{
|
||||
get { return _songsList; }
|
||||
set { SetProperty(ref _songsList, value); }
|
||||
}
|
||||
|
||||
public BaseMedia SelectedSong
|
||||
{
|
||||
get { return _selectedSong; }
|
||||
set { SetProperty(ref _selectedSong, value); }
|
||||
}
|
||||
|
||||
public Command DoubleClickCommand { get; private set; }
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Methods
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
SongsList = this._libraryService.GetLibrary();
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
|
||||
#region Commmands
|
||||
public override bool CanPreviousButtonCommandExecute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override void OnPreviousButtonExecute()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool CanPlayButtonCommandExecute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnPlayButtonCommandExecute()
|
||||
{
|
||||
if (_selectedSong == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (base.IsPlaying())
|
||||
{
|
||||
base.ChangePlayerState(_selectedSong, Main.PlayAction.Pause);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.ChangePlayerState(_selectedSong, Main.PlayAction.Play);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool CanNextButtonCommandExecute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnNextButtonExecute()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void OnDoubleClickExecute()
|
||||
{
|
||||
if (_selectedSong == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
base.ChangePlayerState(_selectedSong, Main.PlayAction.Play);
|
||||
}
|
||||
|
||||
public bool OnDoubleClickCanExecute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endregion Commands
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user