public override void Load(Track track, MusicTab tab = null) { if (track == null) { return; } //if (track.path == null) return; //if (track.path == "") return; try { reader = new MediaFoundationReader(track.path); } catch { return; } if (reader == null) { return; } totalMilliseconds = reader.TotalTime.TotalMilliseconds; player = new WaveOut(); player.Init(reader); CurrentTrack = track; CurrentTab = tab; }
private void addDirectoryToolStripMenuItem_Click(object sender, EventArgs e) { var folderBrowserDialog = new FolderBrowserDialog(); folderBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer; folderBrowserDialog.ShowNewFolderButton = false; var result = folderBrowserDialog.ShowDialog(); if (result != DialogResult.OK) { return; } //{ var CurrentTab = MainTab.MainTab.SelectedTab as MusicPage; string[] FileNames = { folderBrowserDialog.SelectedPath }; // Debug.WriteLine(folderBrowserDialog.SelectedPath); // CurrentTab.musicTab.AddTrack(FileNames); //} //SavePlaylists(); var trackList = MusicTab.MakeTracksList(FileNames); CurrentTab?.musicTab?.AddTrack(trackList); SavePlaylists(); }
public void Play(Track track, MusicTab tab) { if (track == null) { return; } Stop(); CurrentTrack = track; CurrentTab = tab; Load(track); Play(); }
public Options(string SelectedDirectory = "") { InitializeComponent(); if (File.Exists(SelectedDirectory) && MusicTab.IsDirectory(SelectedDirectory)) { DefaultDirectory = SelectedDirectory; } else { var path = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic); DefaultDirectory = path; } UpdateDir(); }
public Options(String SelectedDirectory = "") { InitializeComponent(); if (System.IO.File.Exists(SelectedDirectory) && MusicTab.IsDirectory(SelectedDirectory)) { this.SelectedDirectory = SelectedDirectory; } else { string path = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic); this.SelectedDirectory = path; } UpdateDir(); }
private void AcceptChange() { if (MainTabs != null && MainTabs.SelectedTab != null) { MainTabs.SelectedTab.Text = this.Text; } else if (subItem != null) { subItem.Text = this.Text; if (Item != null) { MusicTab tab = Item.ListView.Parent as MusicTab; tab?.AfterSubItemEdit(Item); } } KillTextBox(); MainWindow.SavePlaylists(); }
public abstract void Load(Track track, MusicTab tab = null);
public override void Load(Track track, MusicTab tab = null) => player.Open(new Uri(track.path));