mirror of
https://github.com/4sval/FModel.git
synced 2026-04-22 01:27:43 -05:00
fixed unable to skip to next sound if one sound is added twice
This commit is contained in:
parent
ea5ae1886c
commit
15597adac4
|
|
@ -122,31 +122,41 @@ namespace FModel.Windows.SoundPlayer
|
|||
|
||||
public void LoadFile(string filepath)
|
||||
{
|
||||
Focus();
|
||||
|
||||
var item = new ListBoxViewModel2
|
||||
ListBoxViewModel2 item = ListBoxVm.soundFiles.Where(x => x.FullPath.Equals(filepath)).FirstOrDefault();
|
||||
if (item == null)
|
||||
{
|
||||
Content = Path.GetFileName(filepath),
|
||||
Data = null,
|
||||
FullPath = filepath,
|
||||
Folder = string.Empty
|
||||
};
|
||||
ListBoxVm.soundFiles.Add(item);
|
||||
Focus();
|
||||
item = new ListBoxViewModel2
|
||||
{
|
||||
Content = Path.GetFileName(filepath),
|
||||
Data = null,
|
||||
FullPath = filepath,
|
||||
Folder = string.Empty
|
||||
};
|
||||
|
||||
if (ListBoxVm.soundFiles.Count == 1) // auto play if one in queue
|
||||
{
|
||||
output.Stop();
|
||||
output.Load(filepath);
|
||||
output.Play();
|
||||
Sound_LstBox.SelectedIndex = 0;
|
||||
ListBoxVm.soundFiles.Add(item);
|
||||
|
||||
string name = Path.GetFileName(filepath);
|
||||
InputFileVm.inputFileViewModel.Set(name, output);
|
||||
DiscordIntegration.Update(string.Empty, string.Format(Properties.Resources.Listening, name));
|
||||
PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/pause.png"));
|
||||
if (ListBoxVm.soundFiles.Count == 1) // auto play if one in queue
|
||||
{
|
||||
output.Stop();
|
||||
output.Load(filepath);
|
||||
output.Play();
|
||||
Sound_LstBox.SelectedIndex = 0;
|
||||
|
||||
string name = Path.GetFileName(filepath);
|
||||
InputFileVm.inputFileViewModel.Set(name, output);
|
||||
DiscordIntegration.Update(string.Empty, string.Format(Properties.Resources.Listening, name));
|
||||
PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/pause.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Sound_LstBox.SelectedIndex = ListBoxVm.soundFiles.IndexOf(item);
|
||||
Sound_LstBox.ScrollIntoView(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Focus();
|
||||
Sound_LstBox.SelectedIndex = ListBoxVm.soundFiles.IndexOf(item);
|
||||
Sound_LstBox.ScrollIntoView(item);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user