Using System.Diagnostics.Debug. First pass at player controls styling

This commit is contained in:
watsonb8
2019-12-04 14:53:49 -08:00
parent 22a524cfd1
commit 187de97503
25 changed files with 169 additions and 101 deletions

View File

@ -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 {

View File

@ -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"/>

View File

@ -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
}
}