Ejemplo n.º 1
0
        /// <summary>
        /// Callback for the "Add" button
        /// </summary>
        /// <param name="sender"> The source of the event. </param>
        /// <param name="e"> An object that contains event data. </param>
        private void button_add_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new AddSongDialog(this, _service);

            dlg.Owner = this;

            processAddSongDialogResult(dlg.ShowDialog(), dlg);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Method that processes result of AddSongDialog
 /// </summary>
 /// <param name="result"> Result of AddSongDialog.ShowDialog() call</param>
 /// <param name="dlg">AddSongDialog that was called</param>
 private void processAddSongDialogResult(Nullable <bool> result, AddSongDialog dlg)
 {
     if (result == true)
     {
         _service.AddSong(new Song()
         {
             Title = dlg.SongTitle, Directory = dlg.Directory, Author = dlg.Author
         });
         _service.Commit();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Callback for "YT Search" button
        /// </summary>
        /// <param name="sender"> The source of the event. </param>
        /// <param name="e"> An object that contains event data. </param>
        private void button_yt_Click(object sender, RoutedEventArgs e)
        {
            var youtubeDlg = new YouTubeSearch();

            youtubeDlg.Owner = this;
            Nullable <bool> result = youtubeDlg.ShowDialog();

            if (result == true)
            {
                var addSongDlg = new AddSongDialog(this, _service);
                addSongDlg.Owner     = this;
                addSongDlg.SongTitle = youtubeDlg.Video.name;
                addSongDlg.Directory = youtubeDlg.Video.linkYT;

                processAddSongDialogResult(addSongDlg.ShowDialog(), addSongDlg);
            }
        }