mirror of
https://github.com/Royce551/FRESHMusicPlayer.git
synced 2025-01-22 10:51:52 -05:00
Fix layout
This commit is contained in:
parent
1f5c7a99f9
commit
5949b0f735
2 changed files with 11 additions and 11 deletions
|
@ -21,14 +21,12 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<Image x:Name="CoverArtBox" Margin="5,10,05,0" VerticalAlignment="Top" Height="64" Width="64" HorizontalAlignment="Right"/>
|
||||
<TextBlock x:Name="TitleLabel" HorizontalAlignment="Stretch" Margin="5,5,10,0" TextWrapping="NoWrap" Text="Nothing Playing" VerticalAlignment="Top" FontWeight="Bold" FontSize="22" Grid.Column="1" Height="30" Foreground="White"/>
|
||||
<Slider x:Name="ProgressBar" Grid.Column="1" HorizontalAlignment="Stretch" Margin="38,56,40,0" VerticalAlignment="Top" Height="18" Foreground="#FFE84B4B" PreviewMouseUp="ProgressBar_MouseUp"/>
|
||||
<Slider x:Name="ProgressBar" Grid.Column="1" HorizontalAlignment="Stretch" Margin="38,56,45,0" VerticalAlignment="Top" Height="18" Foreground="#FFE84B4B" PreviewMouseUp="ProgressBar_MouseUp"/>
|
||||
<TextBlock x:Name="ProgressIndicator1" Grid.Column="1" Margin="5,56,0,0" TextWrapping="NoWrap" Text="10:00" Foreground="#FFDADADA" Height="15" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
||||
<TextBlock x:Name="ProgressIndicator2" Grid.Column="1" Margin="0,0,10,13" TextWrapping="NoWrap" Text="10:00" Foreground="#FFDADADA" Height="15" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="30"/>
|
||||
<TextBlock x:Name="ArtistLabel" HorizontalAlignment="Stretch" Margin="5,35,10,0" TextWrapping="NoWrap" Text="Nothing Playing" VerticalAlignment="Top" Grid.Column="1" Height="20" Foreground="#FFDADADA"/>
|
||||
<Button Grid.Column="2" HorizontalAlignment="Left" Margin="87,10,0,0" VerticalAlignment="Top" Width="52" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}"/>
|
||||
|
||||
|
||||
|
||||
<Path x:Name="PlayPauseButton" Data="{StaticResource PauseIcon}" Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Grid.Column="2" Margin="0,38.8,95,10" Height="35.2" Width="35" HorizontalAlignment="Right"/>
|
||||
<Path x:Name="StopButton" Data="{StaticResource StopIcon}" Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Grid.Column="2" Margin="0,46.467,55,17.533" Width="20" HorizontalAlignment="Right"/>
|
||||
<Path x:Name="NextTrackButton" Data="{StaticResource NextIcon}" Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Grid.Column="2" Margin="0,46.467,15,17.533" Width="20" HorizontalAlignment="Right" MouseLeftButtonDown="NextTrackButton_MouseLeftButtonDown"/>
|
||||
|
|
|
@ -24,15 +24,17 @@ namespace FRESHMusicPlayer.Forms.WPF
|
|||
/// </summary>
|
||||
public partial class WPFUserInterface : Window
|
||||
{
|
||||
Timer timer;
|
||||
Timer progressTimer;
|
||||
public WPFUserInterface()
|
||||
{
|
||||
InitializeComponent();
|
||||
Player.songChanged += Player_songChanged;
|
||||
Player.songStopped += Player_songStopped;
|
||||
timer = new Timer();
|
||||
timer.Interval = 1000;
|
||||
timer.Tick += DispatcherTimer_Tick;
|
||||
progressTimer = new Timer // System.Windows.Forms timer because dispatcher timer seems to have some threading issues?
|
||||
{
|
||||
Interval = 1000
|
||||
};
|
||||
progressTimer.Tick += ProgressTimer_Tick;
|
||||
}
|
||||
#region Controls
|
||||
public void PlayPauseMethod()
|
||||
|
@ -61,7 +63,7 @@ namespace FRESHMusicPlayer.Forms.WPF
|
|||
#endregion
|
||||
#region Settings
|
||||
#endregion
|
||||
private void DispatcherTimer_Tick(object sender, EventArgs e)
|
||||
private void ProgressTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
ProgressIndicator1.Text = NumberUtils.Format((int)Player.audioFile.CurrentTime.TotalSeconds);
|
||||
ProgressBar.Value = Player.audioFile.CurrentTime.TotalSeconds;
|
||||
|
@ -71,8 +73,8 @@ namespace FRESHMusicPlayer.Forms.WPF
|
|||
private void Player_songStopped(object sender, EventArgs e)
|
||||
{
|
||||
Title = "FRESHMusicPlayer WPF Test";
|
||||
TitleLabel.Text = "Nothing Playing";
|
||||
timer.Stop();
|
||||
TitleLabel.Text = ArtistLabel.Text = "Nothing Playing";
|
||||
progressTimer.Stop();
|
||||
}
|
||||
|
||||
private void Player_songChanged(object sender, EventArgs e)
|
||||
|
@ -96,7 +98,7 @@ namespace FRESHMusicPlayer.Forms.WPF
|
|||
}
|
||||
|
||||
|
||||
timer.Start();
|
||||
progressTimer.Start();
|
||||
}
|
||||
|
||||
private void PlayButton_Click(object sender, RoutedEventArgs e)
|
||||
|
|
Loading…
Reference in a new issue