mirror of
https://github.com/Royce551/FRESHMusicPlayer.git
synced 2025-01-22 10:51:52 -05:00
Update FMP Avalonia to FMP Core 4
This commit is contained in:
parent
4e49b550dd
commit
fac0f052cf
4 changed files with 23 additions and 23 deletions
|
@ -241,7 +241,7 @@ namespace FRESHMusicPlayer.Handlers.Integrations
|
||||||
|
|
||||||
public async Task StopAsync()
|
public async Task StopAsync()
|
||||||
{
|
{
|
||||||
viewModel.Player.StopMusic();
|
viewModel.Player.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SetPositionAsync(ObjectPath trackID, long position)
|
public async Task SetPositionAsync(ObjectPath trackID, long position)
|
||||||
|
|
|
@ -156,10 +156,10 @@ namespace FRESHMusicPlayer.ViewModels
|
||||||
set => Player.Queue.Shuffle = value;
|
set => Player.Queue.Shuffle = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SkipPreviousCommand()
|
public async void SkipPreviousCommand()
|
||||||
{
|
{
|
||||||
if (!Player.FileLoaded) return;
|
if (!Player.FileLoaded) return;
|
||||||
if (Player.CurrentTime.TotalSeconds <= 5) Player.PreviousSong();
|
if (Player.CurrentTime.TotalSeconds <= 5) await Player.PreviousAsync();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Player.CurrentTime = TimeSpan.FromSeconds(0);
|
Player.CurrentTime = TimeSpan.FromSeconds(0);
|
||||||
|
@ -188,12 +188,12 @@ namespace FRESHMusicPlayer.ViewModels
|
||||||
{
|
{
|
||||||
if (Player.Paused)
|
if (Player.Paused)
|
||||||
{
|
{
|
||||||
Player.ResumeMusic();
|
Player.Resume();
|
||||||
Integrations.Update(CurrentTrack, PlaybackStatus.Playing);
|
Integrations.Update(CurrentTrack, PlaybackStatus.Playing);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Player.PauseMusic();
|
Player.Pause();
|
||||||
Integrations.Update(CurrentTrack, PlaybackStatus.Paused);
|
Integrations.Update(CurrentTrack, PlaybackStatus.Paused);
|
||||||
}
|
}
|
||||||
UpdatePausedState();
|
UpdatePausedState();
|
||||||
|
@ -212,9 +212,9 @@ namespace FRESHMusicPlayer.ViewModels
|
||||||
}
|
}
|
||||||
this.RaisePropertyChanged(nameof(Shuffle));
|
this.RaisePropertyChanged(nameof(Shuffle));
|
||||||
}
|
}
|
||||||
public void SkipNextCommand()
|
public async void SkipNextCommand()
|
||||||
{
|
{
|
||||||
Player.NextSong();
|
await Player.NextAsync();
|
||||||
}
|
}
|
||||||
public void PauseAfterCurrentTrackCommand() => PauseAfterCurrentTrack = !PauseAfterCurrentTrack;
|
public void PauseAfterCurrentTrackCommand() => PauseAfterCurrentTrack = !PauseAfterCurrentTrack;
|
||||||
|
|
||||||
|
@ -375,14 +375,14 @@ namespace FRESHMusicPlayer.ViewModels
|
||||||
if (args.Count != 0)
|
if (args.Count != 0)
|
||||||
{
|
{
|
||||||
Player.Queue.Add(args.ToArray());
|
Player.Queue.Add(args.ToArray());
|
||||||
Player.PlayMusic();
|
await Player.PlayAsync();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(Program.Config.FilePath))
|
if (!string.IsNullOrEmpty(Program.Config.FilePath))
|
||||||
{
|
{
|
||||||
PauseAfterCurrentTrack = true;
|
PauseAfterCurrentTrack = true;
|
||||||
Player.PlayMusic(Program.Config.FilePath);
|
await Player.PlayAsync(Program.Config.FilePath);
|
||||||
Player.CurrentTime.Add(TimeSpan.FromSeconds(Program.Config.FilePosition));
|
Player.CurrentTime.Add(TimeSpan.FromSeconds(Program.Config.FilePosition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -563,11 +563,11 @@ namespace FRESHMusicPlayer.ViewModels
|
||||||
UpdateLibraryInfo();
|
UpdateLibraryInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayCommand(string path)
|
public async void PlayCommand(string path)
|
||||||
{
|
{
|
||||||
Player.Queue.Clear();
|
Player.Queue.Clear();
|
||||||
Player.Queue.Add(path);
|
Player.Queue.Add(path);
|
||||||
Player.PlayMusic();
|
await Player.PlayAsync();
|
||||||
}
|
}
|
||||||
public void EnqueueCommand(string path)
|
public void EnqueueCommand(string path)
|
||||||
{
|
{
|
||||||
|
@ -582,11 +582,11 @@ namespace FRESHMusicPlayer.ViewModels
|
||||||
{
|
{
|
||||||
Player.Queue.Add(AllTracks.Select(x => x.Path).ToArray());
|
Player.Queue.Add(AllTracks.Select(x => x.Path).ToArray());
|
||||||
}
|
}
|
||||||
public void PlayAllCommand()
|
public async void PlayAllCommand()
|
||||||
{
|
{
|
||||||
Player.Queue.Clear();
|
Player.Queue.Clear();
|
||||||
Player.Queue.Add(AllTracks.Select(x => x.Path).ToArray());
|
Player.Queue.Add(AllTracks.Select(x => x.Path).ToArray());
|
||||||
Player.PlayMusic();
|
await Player.PlayAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Searching
|
// Searching
|
||||||
|
@ -750,7 +750,7 @@ namespace FRESHMusicPlayer.ViewModels
|
||||||
|
|
||||||
Player.Queue.Add(reader.FilePaths.ToArray());
|
Player.Queue.Add(reader.FilePaths.ToArray());
|
||||||
await Task.Run(() => Library.Import(reader.FilePaths.ToArray()));
|
await Task.Run(() => Library.Import(reader.FilePaths.ToArray()));
|
||||||
Player.PlayMusic();
|
await Player.PlayAsync();
|
||||||
}
|
}
|
||||||
public async void BrowseFoldersCommand()
|
public async void BrowseFoldersCommand()
|
||||||
{
|
{
|
||||||
|
@ -797,7 +797,7 @@ namespace FRESHMusicPlayer.ViewModels
|
||||||
|| name.EndsWith(".aac")).ToArray();
|
|| name.EndsWith(".aac")).ToArray();
|
||||||
Player.Queue.Add(paths);
|
Player.Queue.Add(paths);
|
||||||
await Task.Run(() => Library.Import(paths));
|
await Task.Run(() => Library.Import(paths));
|
||||||
Player.PlayMusic();
|
await Player.PlayAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public async void OpenTrackCommand()
|
public async void OpenTrackCommand()
|
||||||
|
@ -823,15 +823,15 @@ namespace FRESHMusicPlayer.ViewModels
|
||||||
if (files.Length > 0)
|
if (files.Length > 0)
|
||||||
{
|
{
|
||||||
Player.Queue.Add(files);
|
Player.Queue.Add(files);
|
||||||
Player.PlayMusic();
|
await Player.PlayAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void ImportFilePathCommand()
|
public async void ImportFilePathCommand()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(FilePathOrURL)) return;
|
if (string.IsNullOrEmpty(FilePathOrURL)) return;
|
||||||
Player.Queue.Add(FilePathOrURL);
|
Player.Queue.Add(FilePathOrURL);
|
||||||
Library.Import(FilePathOrURL);
|
Library.Import(FilePathOrURL);
|
||||||
Player.PlayMusic();
|
await Player.PlayAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void GoToArtistCommand()
|
public async void GoToArtistCommand()
|
||||||
|
|
|
@ -52,10 +52,10 @@ namespace FRESHMusicPlayer.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void JumpToCommand(int position)
|
public async void JumpToCommand(int position)
|
||||||
{
|
{
|
||||||
Player.Queue.Position = position - 1;
|
Player.Queue.Position = position - 1;
|
||||||
Player.PlayMusic();
|
await Player.PlayAsync();
|
||||||
}
|
}
|
||||||
public void RemoveCommand(int position)
|
public void RemoveCommand(int position)
|
||||||
{
|
{
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace FRESHMusicPlayer.Views
|
||||||
case Key.OemTilde:
|
case Key.OemTilde:
|
||||||
var dialog = new TextEntryBox().SetStuff(Properties.Resources.FilePathOrUrl);
|
var dialog = new TextEntryBox().SetStuff(Properties.Resources.FilePathOrUrl);
|
||||||
await dialog.ShowDialog(this);
|
await dialog.ShowDialog(this);
|
||||||
if (dialog.OK) ViewModel.Player.PlayMusic((dialog.DataContext as TextEntryBoxViewModel).Text);
|
if (dialog.OK) await ViewModel.Player.PlayAsync((dialog.DataContext as TextEntryBoxViewModel).Text);
|
||||||
break;
|
break;
|
||||||
case Key.F1:
|
case Key.F1:
|
||||||
InterfaceUtils.OpenURL("https://royce551.github.io/FRESHMusicPlayer/docs/index.html");
|
InterfaceUtils.OpenURL("https://royce551.github.io/FRESHMusicPlayer/docs/index.html");
|
||||||
|
@ -199,10 +199,10 @@ namespace FRESHMusicPlayer.Views
|
||||||
{
|
{
|
||||||
e.DragEffects &= DragDropEffects.Copy;
|
e.DragEffects &= DragDropEffects.Copy;
|
||||||
}
|
}
|
||||||
private void OnDragDrop(object sender, DragEventArgs e)
|
private async void OnDragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
ViewModel.Player.Queue.Add(e.Data.GetFileNames().ToArray());
|
ViewModel.Player.Queue.Add(e.Data.GetFileNames().ToArray());
|
||||||
ViewModel.Player.PlayMusic();
|
await ViewModel.Player.PlayAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue