Ejemplo n.º 1
0
        private void btnAddDescription_Click(object sender, RoutedEventArgs e)
        {
            MediaFile            file   = lbxAlbum.SelectedItem as MediaFile;
            AddDescriptionWindow window = new AddDescriptionWindow(file.Description);

            if (window.ShowDialog() == true)
            {
                file.Description = window.ChosenText;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sparar det aktuella albumet i databasen
        /// </summary>
        private void Save(MediaAlbum album)
        {
            Repository repository = (Repository)FindResource("repository");

            if (repository.AlbumExists(album.Name))
            {
                if (MessageBox.Show("Do you want to overwrite it?", "Album exists in data base", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    repository.UpdateAlbum(album);
                }
            }
            else
            {
                AddDescriptionWindow window = new AddDescriptionWindow();
                if (window.ShowDialog() == true)
                {
                    album.Name        = window.ChosenText;
                    album.DateCreated = DateTime.Now;
                    repository.AddNewAlbum(album);
                }
            }
        }
Ejemplo n.º 3
0
        private void mnuChange_Click(object sender, RoutedEventArgs e)
        {
            MediaPlayer player     = (MediaPlayer)FindResource("player");
            Repository  repository = (Repository)FindResource("repository");

            if (repository.AlbumExists(player.Album.Name))
            {
                AddDescriptionWindow window = new AddDescriptionWindow(player.Album.Name);
                if (window.ShowDialog() == true)
                {
                    if (repository.AlbumExists(window.ChosenText))
                    {
                        MessageBox.Show(string.Format("An album with the name {0} already exists in the data base", window.ChosenText));
                        return;
                    }
                    repository.ChangeAlbumName(player.Album, window.ChosenText);
                    player.Album.Name = window.ChosenText;
                }
            }
            else
            {
                MessageBox.Show("Album is not saved");
            }
        }