mirror of
https://github.com/Royce551/FRESHMusicPlayer.git
synced 2025-01-22 10:51:52 -05:00
dragndrop improvements
This commit is contained in:
parent
79da185c57
commit
93ca9b8dba
4 changed files with 53 additions and 5 deletions
|
@ -324,7 +324,7 @@ namespace FRESHMusicPlayer
|
|||
}
|
||||
else
|
||||
{
|
||||
CoverArtBox.Source = BitmapFrame.Create(new System.IO.MemoryStream(CurrentTrack.EmbeddedPictures[0].PictureData), BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
||||
CoverArtBox.Source = BitmapFrame.Create(new System.IO.MemoryStream(CurrentTrack.EmbeddedPictures[0].PictureData), BitmapCreateOptions.None, BitmapCacheOption.None);
|
||||
SetCoverArtVisibility(true);
|
||||
}
|
||||
progressTimer.Start();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using FRESHMusicPlayer.Handlers.Notifications;
|
||||
using FRESHMusicPlayer.Utilities;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -172,10 +173,31 @@ namespace FRESHMusicPlayer.Pages.Library
|
|||
private async void Page_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] tracks = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
await Task.Run(() =>
|
||||
if (tracks.Any(x => Directory.Exists(x)))
|
||||
{
|
||||
DatabaseUtils.Import(tracks);
|
||||
});
|
||||
foreach (var track in tracks)
|
||||
{
|
||||
if (Directory.Exists(track))
|
||||
{
|
||||
string[] paths = Directory.EnumerateFiles(tracks[0], "*", SearchOption.AllDirectories)
|
||||
.Where(name => name.EndsWith(".mp3")
|
||||
|| name.EndsWith(".wav") || name.EndsWith(".m4a") || name.EndsWith(".ogg")
|
||||
|| name.EndsWith(".flac") || name.EndsWith(".aiff")
|
||||
|| name.EndsWith(".wma")
|
||||
|| name.EndsWith(".aac")).ToArray();
|
||||
await Task.Run(() => DatabaseUtils.Import(paths));
|
||||
}
|
||||
else await Task.Run(() => DatabaseUtils.Import(track));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
DatabaseUtils.Import(tracks);
|
||||
});
|
||||
}
|
||||
LoadLibrary();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
xmlns:local="clr-namespace:FRESHMusicPlayer.Pages"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="372" d:DesignWidth="235"
|
||||
Title="QueueManagementPage" Unloaded="Page_Unloaded">
|
||||
Title="QueueManagementPage" Unloaded="Page_Unloaded" AllowDrop="True" Drop="Page_Drop">
|
||||
<Grid Background="{StaticResource SecondaryColor}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
|
|
|
@ -5,6 +5,7 @@ using Microsoft.Win32;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
@ -120,5 +121,30 @@ namespace FRESHMusicPlayer.Pages
|
|||
{
|
||||
MainWindow.Player.ClearQueue();
|
||||
}
|
||||
|
||||
private void Page_Drop(object sender, DragEventArgs e)
|
||||
{ // TODO: Have to rework drag n drop a bit in order to add this
|
||||
/*
|
||||
string[] tracks = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
if (tracks.Any(x => Directory.Exists(x)))
|
||||
{
|
||||
foreach (var track in tracks)
|
||||
{
|
||||
if (Directory.Exists(track))
|
||||
{
|
||||
string[] paths = Directory.EnumerateFiles(tracks[0], "*", SearchOption.AllDirectories)
|
||||
.Where(name => name.EndsWith(".mp3")
|
||||
|| name.EndsWith(".wav") || name.EndsWith(".m4a") || name.EndsWith(".ogg")
|
||||
|| name.EndsWith(".flac") || name.EndsWith(".aiff")
|
||||
|| name.EndsWith(".wma")
|
||||
|| name.EndsWith(".aac")).ToArray();
|
||||
MainWindow.Player.AddQueue(paths);
|
||||
}
|
||||
else MainWindow.Player.AddQueue(track);
|
||||
}
|
||||
|
||||
}
|
||||
else MainWindow.Player.AddQueue(tracks);*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue