Changing folder names
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:library="clr-namespace:Aurora.Design.Components.Library"
|
||||
x:Class="Aurora.Design.Views.Songs.SongsView">
|
||||
<ContentView.Content>
|
||||
<library:Library
|
||||
ItemsSource="{Binding SongsList}"
|
||||
SelectedItem="{Binding SelectedSong}"
|
||||
ItemDoubleClicked="{Binding DoubleClickCommand}"/>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Design.Views.Songs
|
||||
{
|
||||
public partial class SongsView : ContentView
|
||||
{
|
||||
public SongsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -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