mirror of
https://github.com/Royce551/FRESHMusicPlayer.git
synced 2025-01-22 10:51:52 -05:00
Increase stability n' shit
This commit is contained in:
parent
5949b0f735
commit
bcf567e827
9 changed files with 28 additions and 37 deletions
|
@ -130,23 +130,5 @@
|
|||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\round_more_horiz_white_18dp.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\round_pause_circle_outline_white_18dp.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\round_play_circle_outline_white_18dp.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\round_skip_next_white_18dp.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\round_stop_white_18dp.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\round_volume_up_white_18dp.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -38,7 +38,7 @@
|
|||
<Rectangle Stretch="Uniform" Fill="Transparent" RenderTransformOrigin="0.5,0.5" Grid.Column="2" Margin="0,46.467,15,17.533" Width="20" HorizontalAlignment="Right" MouseLeftButtonDown="NextTrackButton_MouseLeftButtonDown"/>
|
||||
<Rectangle Grid.Column="2" Stretch="Uniform" Fill="Transparent" RenderTransformOrigin="0.5,0.5" Margin="0,46.467,55,17.533" Width="20" HorizontalAlignment="Right" MouseLeftButtonDown="StopButton_MouseLeftButtonDown"/>
|
||||
<Rectangle Grid.Column="2" Margin="0,38.8,95,10" Height="35.2" Width="35" HorizontalAlignment="Right" MouseLeftButtonDown="PlayPauseButton_MouseLeftButtonDown" Fill="Transparent"/>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
<Grid Background="#FF141517">
|
||||
|
@ -46,6 +46,7 @@
|
|||
<TextBox x:Name="FilePathBox" HorizontalAlignment="Left" Height="24" Margin="427,283,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120"/>
|
||||
<Button x:Name="PlayTrackButton" Content="Play" HorizontalAlignment="Left" Margin="371,337,0,0" VerticalAlignment="Top" Width="75" Click="PlayButton_Click"/>
|
||||
<Button x:Name="QueueTrackButton" Content="Add to queue" HorizontalAlignment="Left" Margin="488,337,0,0" VerticalAlignment="Top" Width="75" Click="QueueButton_Click"/>
|
||||
<Button x:Name="BrowseButton" Content="Browse" HorizontalAlignment="Left" Margin="337,307,0,0" VerticalAlignment="Top" Width="75" Click="BrowseButton_Click"/>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
|
|
|
@ -1,22 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ATL;
|
||||
using FRESHMusicPlayer.Handlers;
|
||||
using FRESHMusicPlayer.Utilities;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using System.Windows.Forms;
|
||||
using FRESHMusicPlayer;
|
||||
using FRESHMusicPlayer.Utilities;
|
||||
using ATL;
|
||||
using Winforms = System.Windows.Forms;
|
||||
namespace FRESHMusicPlayer.Forms.WPF
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -24,18 +15,21 @@ namespace FRESHMusicPlayer.Forms.WPF
|
|||
/// </summary>
|
||||
public partial class WPFUserInterface : Window
|
||||
{
|
||||
Timer progressTimer;
|
||||
Winforms.Timer progressTimer;
|
||||
public WPFUserInterface()
|
||||
{
|
||||
InitializeComponent();
|
||||
Player.songChanged += Player_songChanged;
|
||||
Player.songStopped += Player_songStopped;
|
||||
progressTimer = new Timer // System.Windows.Forms timer because dispatcher timer seems to have some threading issues?
|
||||
Player.songException += Player_songException;
|
||||
progressTimer = new Winforms.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()
|
||||
{
|
||||
|
@ -63,6 +57,8 @@ namespace FRESHMusicPlayer.Forms.WPF
|
|||
#endregion
|
||||
#region Settings
|
||||
#endregion
|
||||
#region Events
|
||||
#endregion
|
||||
private void ProgressTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
ProgressIndicator1.Text = NumberUtils.Format((int)Player.audioFile.CurrentTime.TotalSeconds);
|
||||
|
@ -120,7 +116,7 @@ namespace FRESHMusicPlayer.Forms.WPF
|
|||
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
System.Windows.Forms.Application.Exit();
|
||||
Winforms.Application.Exit();
|
||||
}
|
||||
|
||||
|
||||
|
@ -135,5 +131,17 @@ namespace FRESHMusicPlayer.Forms.WPF
|
|||
private void QueueButton_Click(object sender, RoutedEventArgs e) => Player.AddQueue(FilePathBox.Text);
|
||||
|
||||
private void ProgressBar_MouseUp(object sender, MouseButtonEventArgs e) => Player.RepositionMusic((int)ProgressBar.Value);
|
||||
|
||||
private void Player_songException(object sender, PlaybackExceptionEventArgs e) => MessageBox.Show($"A playback error has occured. \"{e.Details}\"");
|
||||
|
||||
private void BrowseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog fileDialog = new OpenFileDialog();
|
||||
if (fileDialog.ShowDialog() == true)
|
||||
{
|
||||
Player.AddQueue(fileDialog.FileName);
|
||||
Player.PlayMusic();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 163 B |
Binary file not shown.
Before Width: | Height: | Size: 537 B |
Binary file not shown.
Before Width: | Height: | Size: 553 B |
Binary file not shown.
Before Width: | Height: | Size: 240 B |
Binary file not shown.
Before Width: | Height: | Size: 156 B |
Binary file not shown.
Before Width: | Height: | Size: 395 B |
Loading…
Reference in a new issue