Exemplo n.º 1
0
        private void Window_Closed(object sender, EventArgs e)
        {
            NewWindow dialog = new NewWindow();

            dialog.text.Text = "Would you like to save your main playlist?";
            dialog.Owner     = this;
            dialog.ShowDialog();
            if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
            {
                SerializeData();
            }
        }
Exemplo n.º 2
0
        private void ChangeAudio(Audio audioContext)
        {
            ms.Source = new Uri(audioContext.DirectoryName + "\\" + audioContext.Name);

            Playing = true;
            ms.Play();

            CurrentIndex = CurrentList.IndexOf(audioContext);

            (PlayButton.Child as Image).Source = LoadImage(@"pack://application:,,,/Images/Pause.png", false);

            if (!System.IO.File.Exists(audioContext.DirectoryName + "\\" + audioContext.Name))
            {
                NewWindow dialog = new NewWindow();
                dialog.text.Text = "This file was deleted. Delete file information?";
                dialog.Owner     = this;
                dialog.ShowDialog();
                if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                {
                    mainPL.AudioList = mainPL.AudioList.Where(x => x.Name != audioContext.Name || x.DirectoryName != audioContext.DirectoryName).ToList();
                    CurrentList      = CurrentList.Where(x => x.Name != audioContext.Name || x.DirectoryName != audioContext.DirectoryName).ToList();
                    Play.ItemsSource = CurrentList;
                    if (CurrentList.Count > 0)
                    {
                        ChangeAudio(CurrentList[--CurrentIndex]);
                    }
                    return;
                }
                else
                {
                    ChangeAudio(CurrentList[++CurrentIndex]);
                    return;
                }
            }

            TagLib.File Ds = TagLib.File.Create(audioContext.DirectoryName + "\\" + audioContext.Name);
            Info.DataContext = audioContext;
        }