Using System.Diagnostics.Debug. First pass at player controls styling
This commit is contained in:
@ -1,12 +1,26 @@
|
||||
Label {
|
||||
color: darkgray;
|
||||
#PlayerControlContainer {
|
||||
background-color: #626363;
|
||||
}
|
||||
|
||||
Label {
|
||||
color: white;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#MediaInfoLayout label {
|
||||
margin-left: 20;
|
||||
#MediaInfoContainer {
|
||||
width: 150;
|
||||
margin-top: 10;
|
||||
margin-bottom: 10;
|
||||
}
|
||||
|
||||
#MediaInfoContainer label {
|
||||
margin-left: 20;
|
||||
}
|
||||
#AlbumArtBoxView {
|
||||
background-color: black;
|
||||
width: 80;
|
||||
}
|
||||
|
||||
ImageButton {
|
||||
|
@ -12,25 +12,30 @@
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition
|
||||
Width="100"/>
|
||||
Width="150"/>
|
||||
<ColumnDefinition
|
||||
Width="*"/>
|
||||
<ColumnDefinition
|
||||
Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackLayout
|
||||
x:Name="MediaInfoLayout"
|
||||
HorizontalOptions="StartAndExpand"
|
||||
Grid.Column="0">
|
||||
<Label
|
||||
x:Name="SongTitleLabel"
|
||||
LineBreakMode="TailTruncation"/>
|
||||
<Label
|
||||
x:Name="ArtistNameLabel"
|
||||
LineBreakMode="TailTruncation"/>
|
||||
Orientation="Horizontal">
|
||||
<BoxView
|
||||
x:Name="AlbumArtBoxView"/>
|
||||
<StackLayout
|
||||
x:Name="MediaInfoContainer"
|
||||
HorizontalOptions="StartAndExpand"
|
||||
Grid.Column="0">
|
||||
<Label
|
||||
x:Name="SongTitleLabel"
|
||||
LineBreakMode="TailTruncation"/>
|
||||
<Label
|
||||
x:Name="ArtistNameLabel"
|
||||
LineBreakMode="TailTruncation"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
<StackLayout
|
||||
x:Name="PlayerControlLayout"
|
||||
x:Name="PlayerControlContainer"
|
||||
Grid.Column="1"
|
||||
HorizontalOptions="Center"
|
||||
Orientation="Horizontal">
|
||||
@ -38,8 +43,7 @@
|
||||
x:Name="PreviousButton"
|
||||
Source="Resources/backward.png"/>
|
||||
<imgBtn:ImageButton
|
||||
x:Name="PlayButton"
|
||||
Source="Resources/play.png"/>
|
||||
x:Name="PlayButton"/>
|
||||
<imgBtn:ImageButton
|
||||
x:Name="NextButton"
|
||||
Source="Resources/forwards.png"/>
|
||||
|
@ -9,6 +9,7 @@ namespace Aurora.Design.Components.MediaPlayer
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
PlayButton.Source = ImageSource.FromFile("Resources/play.png");
|
||||
}
|
||||
|
||||
#region SongTitle Bindable
|
||||
@ -16,7 +17,11 @@ namespace Aurora.Design.Components.MediaPlayer
|
||||
BindableProperty.Create(propertyName: "SongTitle",
|
||||
returnType: typeof(string),
|
||||
declaringType: typeof(Player),
|
||||
propertyChanged: OnSongTitlePropertyChanged);
|
||||
propertyChanged: (BindableObject bindable, object oldValue, object newValue) =>
|
||||
{
|
||||
Player component = bindable as Player;
|
||||
component.SongTitleLabel.Text = (string)newValue;
|
||||
});
|
||||
|
||||
public string SongTitle
|
||||
{
|
||||
@ -30,12 +35,6 @@ namespace Aurora.Design.Components.MediaPlayer
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnSongTitlePropertyChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
Player component = bindable as Player;
|
||||
component.SongTitleLabel.Text = (string)newValue;
|
||||
}
|
||||
|
||||
#endregion SongTitle Bindable
|
||||
|
||||
#region ArtistName Bindable
|
||||
@ -43,7 +42,11 @@ namespace Aurora.Design.Components.MediaPlayer
|
||||
BindableProperty.Create(propertyName: "ArtistName",
|
||||
returnType: typeof(string),
|
||||
declaringType: typeof(Player),
|
||||
propertyChanged: OnArtistNamePropertyChanged);
|
||||
propertyChanged: (BindableObject bindable, object oldValue, object newValue) =>
|
||||
{
|
||||
Player component = bindable as Player;
|
||||
component.ArtistNameLabel.Text = (string)newValue;
|
||||
});
|
||||
|
||||
public string ArtistName
|
||||
{
|
||||
@ -57,12 +60,6 @@ namespace Aurora.Design.Components.MediaPlayer
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnArtistNamePropertyChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
Player component = bindable as Player;
|
||||
component.ArtistNameLabel.Text = (string)newValue;
|
||||
}
|
||||
|
||||
#endregion ArtistName Bindable
|
||||
|
||||
#region PreviousButton
|
||||
@ -275,5 +272,32 @@ namespace Aurora.Design.Components.MediaPlayer
|
||||
component.NextButton.IsEnabled = cmd.CanExecute(null);
|
||||
}
|
||||
#endregion PlayButton
|
||||
|
||||
#region Playing Bindable
|
||||
public static readonly BindableProperty IsPlayingProperty =
|
||||
BindableProperty.Create(
|
||||
propertyName: "IsPlaying",
|
||||
returnType: typeof(bool),
|
||||
declaringType: typeof(Player),
|
||||
propertyChanged: (BindableObject bindable, object oldValue, object newValue) =>
|
||||
{
|
||||
Player control = (Player)bindable;
|
||||
if ((bool)newValue == true)
|
||||
{
|
||||
control.PlayButton.Source = ImageSource.FromFile("Resources/pause.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
control.PlayButton.Source = ImageSource.FromFile("Resources/play.png");
|
||||
}
|
||||
});
|
||||
|
||||
public bool IsPlaying
|
||||
{
|
||||
get { return (bool)GetValue(IsPlayingProperty); }
|
||||
set { SetValue(IsPlayingProperty, value); }
|
||||
}
|
||||
|
||||
#endregion Playing Binadable
|
||||
}
|
||||
}
|
||||
|
10
Aurora/Design/Converters/PlayIconConverter.cs
Normal file
10
Aurora/Design/Converters/PlayIconConverter.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System;
|
||||
namespace Aurora.Design.Converters
|
||||
{
|
||||
public class PlayIconConverter
|
||||
{
|
||||
public PlayIconConverter()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -72,6 +72,8 @@ namespace Aurora.Design.Views
|
||||
|
||||
public SetPlayerVisibleDelegate SetPlayerVisible { get; set; }
|
||||
|
||||
public SetIsPlayingDelegate SetIsPlaying { get; set; }
|
||||
|
||||
#endregion Player
|
||||
|
||||
#region Lifecycle
|
||||
|
@ -3,7 +3,7 @@
|
||||
}
|
||||
|
||||
#Header {
|
||||
background-color: #232323;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#Header > Entry {
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#TitleContainer {
|
||||
margin-top: 10;
|
||||
background-color: #3a3a3a;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#TitleContainer Label {
|
||||
|
@ -17,10 +17,15 @@
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="60"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--Header-->
|
||||
<StackLayout
|
||||
x:Name="Header"
|
||||
Grid.Row="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Orientation="Horizontal">
|
||||
<Entry Text="Search"/>
|
||||
</StackLayout>
|
||||
@ -28,35 +33,31 @@
|
||||
<!--Title-->
|
||||
<StackLayout
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="2"
|
||||
x:Name="TitleContainer">
|
||||
<Label Text="{Binding Title}" TextColor="White"/>
|
||||
</StackLayout>
|
||||
|
||||
<!--Library Grid-->
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--Sidebar-->
|
||||
<navigation:NavigationMenu
|
||||
Grid.Column="0"
|
||||
Grid.RowSpan="3"
|
||||
x:Name="MasterPage"
|
||||
Items="{Binding Pages}"
|
||||
SelectedItem="{Binding SelectedItem}"/>
|
||||
|
||||
<navigation:NavigationMenu
|
||||
Grid.Column="0"
|
||||
x:Name="MasterPage"
|
||||
Items="{Binding Pages}"
|
||||
SelectedItem="{Binding SelectedItem}"/>
|
||||
|
||||
<views:PageContainer
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
x:Name="ContentPage"/>
|
||||
|
||||
</Grid>
|
||||
<!--Page Container-->
|
||||
<views:PageContainer
|
||||
Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
x:Name="ContentPage"/>
|
||||
|
||||
<!--Music Player-->
|
||||
<mp:Player
|
||||
x:Name="Player"
|
||||
Grid.Row="3"
|
||||
HeightRequest="50"/>
|
||||
x:Name="Player"
|
||||
Grid.Row="3"
|
||||
Grid.ColumnSpan="2"
|
||||
HeightRequest="50"/>
|
||||
</Grid>
|
||||
|
||||
</ContentPage>
|
@ -17,7 +17,9 @@ namespace Aurora.Design.Views.Main
|
||||
/// <param name="media"></param>
|
||||
public delegate void SetPlayerMetadataDelegate(BaseMedia media);
|
||||
|
||||
public delegate void SetPlayerVisibleDelegate(Boolean visible);
|
||||
public delegate void SetPlayerVisibleDelegate(bool visible);
|
||||
|
||||
public delegate void SetIsPlayingDelegate(bool playing);
|
||||
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class MainView : ContentPage//, IDisposable
|
||||
@ -139,6 +141,7 @@ namespace Aurora.Design.Views.Main
|
||||
{
|
||||
vm.SetPlayerMetadata = null;
|
||||
vm.SetPlayerVisible = null;
|
||||
vm.SetIsPlaying = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -152,8 +155,10 @@ namespace Aurora.Design.Views.Main
|
||||
_player.PreviousButtonCommand = new Command(vm.OnPreviousButtonExecute, vm.CanPreviousButtonExecute);
|
||||
|
||||
//Assign SetPlayer delegate
|
||||
|
||||
vm.SetPlayerMetadata = SetPlayer;
|
||||
vm.SetPlayerVisible = SetPlayerVisible;
|
||||
vm.SetIsPlaying = SetIsPlaying;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -178,6 +183,11 @@ namespace Aurora.Design.Views.Main
|
||||
{
|
||||
_player.IsVisible = visible;
|
||||
}
|
||||
|
||||
private void SetIsPlaying(bool playing)
|
||||
{
|
||||
_player.IsPlaying = playing;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ namespace Aurora.Design.Views.Party
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Exception occurred while receiviing events: ", ex.Message);
|
||||
System.Diagnostics.Debug.WriteLine("Exception occurred while receiviing events: ", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ namespace Aurora.Design.Views.Party
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Exception occurred while receiviing events: ", ex.Message);
|
||||
System.Diagnostics.Debug.WriteLine("Exception occurred while receiviing events: ", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,7 +419,7 @@ namespace Aurora.Design.Views.Party
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error subscribing to events: " + ex.Message);
|
||||
System.Diagnostics.Debug.WriteLine("Error subscribing to events: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,7 +449,7 @@ namespace Aurora.Design.Views.Party
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine(string.Format("CLIENT {0} - SubscribeToEvents called from client with id", SettingsService.Instance.ClientId));
|
||||
System.Diagnostics.Debug.WriteLine(string.Format("CLIENT {0} - SubscribeToEvents called from client with id", SettingsService.Instance.ClientId));
|
||||
await _client.RemoteEventClient.SubscribeToEventsAsync(req);
|
||||
}
|
||||
private async Task UnsubscribeFromEvents()
|
||||
|
@ -22,8 +22,6 @@ namespace Aurora.Design.Views.Songs
|
||||
_songsList = new ObservableCollection<BaseMedia>();
|
||||
PlayCommand = new Command(OnPlayButtonExecute, CanPlayButtonExecute);
|
||||
|
||||
_player.PlaybackStateChanged += OnPlaybackStateChanged;
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
@ -87,6 +85,10 @@ namespace Aurora.Design.Views.Songs
|
||||
|
||||
public async override void OnPlayButtonExecute()
|
||||
{
|
||||
if (_selectedSong == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
base.Media = _selectedSong;
|
||||
if (!_player.IsMediaLoaded(base.Media))
|
||||
{
|
||||
@ -98,16 +100,19 @@ namespace Aurora.Design.Views.Songs
|
||||
case PlaybackState.Buffering:
|
||||
{
|
||||
_player.Play();
|
||||
SetIsPlaying(true);
|
||||
break;
|
||||
}
|
||||
case PlaybackState.Playing:
|
||||
{
|
||||
_player.Pause();
|
||||
SetIsPlaying(false);
|
||||
break;
|
||||
}
|
||||
case PlaybackState.Stopped:
|
||||
{
|
||||
_player.Play();
|
||||
SetIsPlaying(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -124,18 +129,5 @@ namespace Aurora.Design.Views.Songs
|
||||
}
|
||||
|
||||
#endregion Commands
|
||||
|
||||
#region Events
|
||||
/// <summary>
|
||||
/// PlayerService playback state changed event handler.
|
||||
/// </summary>
|
||||
/// <param name="sender">The sending object.</param>
|
||||
/// <param name="args">Event arguments.</param>
|
||||
public void OnPlaybackStateChanged(object sender, PlaybackStateChangedEventArgs args)
|
||||
{
|
||||
OnPropertyChanged("PlayButtonText");
|
||||
}
|
||||
|
||||
#endregion Events
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user