private void SaveEntry(object sender, RoutedEventArgs e)
 {
     if (EntryEditor.IsValid())
     {
         bool create = this.song == null;
         if (create)
         {
             this.song = new Data.Song();
         }
         this.song.Title      = EntryEditor.TitleBox.Text;
         this.song.Erschienen = EntryEditor.ReleasedBox.DisplayDate;
         this.song.Artist     = EntryEditor.ArtistBox.Text;
         this.song.Favorit    = true;
         this.song.Gerne      = EntryEditor.GerneBox.Text;
         this.song.Laenge     = EntryEditor.LengthBox.Text;
         this.song.YouTubeID  = EntryEditor.YouTubeIdBox.Text;
         if (create)
         {
             this.song.Erstellen();
         }
         else
         {
             this.song.Aktualisieren();
         }
         ChangeState(State.Empty);
         LoadSongs();
     }
 }
Пример #2
0
 // Update
 public static void DemoAUpdate()
 {
     Debug.Print("--- DemoAUpdate ---");
     // KlasseA ändert Attribute
     Data.Song klasseA1 = Data.Song.LesenID(1);
     klasseA1.Title = "Artikel 1 nach Update";
     klasseA1.Aktualisieren();
 }
Пример #3
0
        public static void DemoACreateKurz()
        {
            Data.Song klasseA2 = new Data.Song {
                Title = "Artikel 2", Favorit = true, Erschienen = DateTime.Today, Artist = "Artist", Gerne = "Pop", Laenge = "", YouTubeID = "345"
            };
            Int64 klasseA2Id = klasseA2.Erstellen();

            Debug.Print("Artikel erstellt mit Id:" + klasseA2Id);
        }
Пример #4
0
 public void loadSong(Data.Song song)
 {
     TitleBox.Text            = song.Title;
     ArtistBox.Text           = song.Artist;
     ReleasedBox.SelectedDate = song.Erschienen;
     GerneBox.Text            = song.Gerne;
     LengthBox.Text           = song.Laenge;
     FavoritBox.IsChecked     = song.Favorit;
     YouTubeIdBox.Text        = song.YouTubeID;
     _unsaved = false;
 }
Пример #5
0
        // Create
        public static void DemoACreate()
        {
            Debug.Print("--- DemoACreate ---");
            // KlasseA
            Data.Song klasseA1 = new Data.Song();
            klasseA1.Title      = "Artikel 1";
            klasseA1.Erschienen = DateTime.Today;
            klasseA1.Artist     = "Artist";
            klasseA1.Favorit    = true;
            klasseA1.Gerne      = "Pop";
            klasseA1.Laenge     = "";
            klasseA1.YouTubeID  = "123";

            Int64 klasseA1Id = klasseA1.Erstellen();

            Debug.Print("Artikel erstellt mit Id:" + klasseA1Id);
        }
 private void ChangeState(State newstate)
 {
     this.state = newstate;
     this.SetDefaultState();
     if (this.state == State.Empty || this.state == State.Sclected)
     {
         this.Title = "Musik Bibliothek";
     }
     if (this.state == State.Empty)
     {
         this.song = null;
         SongList.UnselectAll();
         NewButton.IsEnabled = true;
         SongList.Visibility = Visibility.Visible;
     }
     if (this.state == State.Sclected)
     {
         NewButton.IsEnabled    = true;
         EditButton.IsEnabled   = true;
         DeleteButton.IsEnabled = true;
         SongList.Visibility    = Visibility.Visible;
         if (SongList.SelectedItems.Count < 1)
         {
             this.ChangeState(State.Empty);
         }
     }
     if (this.state == State.New)
     {
         BackButton.IsEnabled = true;
         EntryEditor.ResetForm();
         EntryEditor.Visibility = Visibility.Visible;
         SaveButton.IsEnabled   = true;
         this.Title             = "Neuer Song erstellen";
     }
     if (this.state == State.Edit)
     {
         BackButton.IsEnabled = true;
         EntryEditor.loadSong(this.song);
         EntryEditor.Visibility = Visibility.Visible;
         SaveButton.IsEnabled   = true;
         this.Title             = "Song bearbeiten";
     }
 }
 private void EditEntry(object sender, RoutedEventArgs e)
 {
     this.song = GetSelectedSong();
     ChangeState(State.Edit);
 }
 public Data.Song GetSelectedSong()
 {
     Data.Song song = (Data.Song)SongList.SelectedItem;
     return(song);
 }