public void DragOver(IDropInfo dropInfo) { if (dropInfo.Data is Audio && Tracks.Count < 15 && Tracks.All(t => t.Id != ((Audio)dropInfo.Data).Id)) { dropInfo.Effects = DragDropEffects.All; } }
public void Drop(IDropInfo dropInfo) { if (dropInfo.Data is Audio && Tracks.Count < 15 && Tracks.All(t => t.Id != ((Audio)dropInfo.Data).Id)) { Tracks.Add((VkAudio)dropInfo.Data); } }
private void CleanupWorkspaceFolder() { if (!Workspace.Settings.DeleteNotSyncedItems || (Tracks.Count == 0)) { return; } try { foreach (var file in Directory.GetFiles(Workspace.Path)) { var name = Path.GetFileNameWithoutExtension(file); if ((!file.EndsWith(".m4a") && !file.EndsWith(".mp3")) || Tracks.All(item => item.Item.Title != name)) { try { File.Delete(file); Logger.Trace("Workspace cleanup for workspace {0}: Deleted file {1}", Workspace.Path, file); } catch (Exception ex) { Logger.Warn(ex, "Workspace cleanup for workspace {0}: Error deleting file {1}", Workspace.Path, file); } } } } catch (Exception ex) { Logger.Warn(ex, "Workspace cleanup for workspace {0}: Error obtaining files", Workspace.Path); } }