This commit is contained in:
Royce551 2020-12-09 22:26:43 -06:00
parent b1a01d59d6
commit a98af85088
2 changed files with 15 additions and 14 deletions

View file

@ -115,6 +115,15 @@ namespace FRESHMusicPlayer
ProcessSettings(true);
await UpdateHandler.UpdateApp();
}
private void Window_Closed(object sender, EventArgs e)
{
App.Config.Volume = (int)VolumeBar.Value;
App.Config.CurrentMenu = SelectedMenu;
TrackingHandler?.Close();
ConfigurationHandler.Write(App.Config);
Libraryv2.Dispose();
Application.Current.Shutdown();
}
private void Smtc_ButtonPressed(SystemMediaTransportControls sender, SystemMediaTransportControlsButtonPressedEventArgs args)
{
switch (args.Button)
@ -426,11 +435,12 @@ namespace FRESHMusicPlayer
private void ProgressTimer_Tick(object sender, EventArgs e) => ProgressTick();
private void ProgressTick()
{
ProgressIndicator1.Text = Player.CurrentBackend.CurrentTime.ToString(@"mm\:ss");
var time = TimeSpan.FromSeconds(Math.Floor(Player.CurrentBackend.CurrentTime.TotalSeconds));
ProgressIndicator1.Text = time.ToString(@"mm\:ss");
if (App.Config.ShowRemainingProgress) ProgressIndicator2.Text
= $"-{TimeSpan.FromSeconds(Player.CurrentBackend.TotalTime.TotalSeconds - Math.Floor(Player.CurrentBackend.CurrentTime.TotalSeconds)):mm\\:ss}";
if (App.Config.ShowTimeInWindow) Title = $"{Player.CurrentBackend.CurrentTime:mm\\:ss}/{Player.CurrentBackend.TotalTime:mm\\:ss} | FRESHMusicPlayer";
if (!isDragging) ProgressBar.Value = Player.CurrentBackend.CurrentTime.TotalSeconds;
= $"-{TimeSpan.FromSeconds(time.TotalSeconds - Math.Floor(Player.CurrentBackend.TotalTime.TotalSeconds)):mm\\:ss}";
if (App.Config.ShowTimeInWindow) Title = $"{time:mm\\:ss}/{Player.CurrentBackend.TotalTime:mm\\:ss} | FRESHMusicPlayer";
if (!isDragging) ProgressBar.Value = time.TotalSeconds;
Player.AvoidNextQueue = false;
}
private void TrackTitle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) => ShowAuxilliaryPane(SelectedAuxiliaryPane.TrackInfo, 235, true);
@ -514,15 +524,6 @@ namespace FRESHMusicPlayer
Player.PlayMusic();
}
private void Window_Closed(object sender, EventArgs e)
{
App.Config.Volume = (int)VolumeBar.Value;
App.Config.CurrentMenu = SelectedMenu;
TrackingHandler?.Close();
ConfigurationHandler.Write(App.Config);
Application.Current.Shutdown();
}
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))

View file

@ -58,7 +58,7 @@
<ComboBoxItem Content="Test2"/>
</ComboBox>
</Grid>-->
<CheckBox x:Name="General_ProgressCheck" Content="{x:Static resx:Resources.SETTINGS_TIMEWINDOWTITLE}" FontSize="14" Foreground="{StaticResource PrimaryTextColor}" Checked="General_ProgressChanged" Unchecked="General_ProgressChanged"/>
<CheckBox x:Name="General_ProgressCheck" Content="{x:Static resx:Resources.SETTINGS_TIMEWINDOWTITLE}" FontSize="14" Foreground="{StaticResource PrimaryTextColor}" Checked="General_ProgressChanged" Unchecked="General_ProgressChanged" Margin="0,0,0,5"/>
<CheckBox x:Name="General_TrackingCheck" Content="Playback Tracking" FontSize="14" Foreground="{StaticResource PrimaryTextColor}" Checked="General_TrackingChanged" Unchecked="General_TrackingChanged"/>
<TextBlock Text="{x:Static resx:Resources.SETTINGS_INTEGRATION}" Foreground="{StaticResource PrimaryTextColor}" FontSize="16" FontWeight="Bold" Padding="0,0,0,5" Margin="-10,0,0,0"/>
<CheckBox x:Name="Integration_DiscordRPCCheck" Content="Discord Rich Presence" FontSize="14" Foreground="{StaticResource PrimaryTextColor}" Margin="0,0,0,5" Checked="General_DiscordRPCChanged" Unchecked="General_DiscordRPCChanged"/>