Example #1
0
 /**
  * Szerkesztjük a kiválasztott elemet, a mezőket feltöltjük az eredeti értékekkel
  */
 private void buttonEdit_Click(object sender, RoutedEventArgs e)
 {
     if (lbOutput.SelectedItem is Band band)
     {
         var bandEdit = new BandEdit
         {
             ActionMode  = ActionMode.Edit,
             labelAction = { Content = "Edit Band" },
             tbName      = { Text = band.Name },
             tbFormedIn  = { Text = band.FormedIn.ToString() },
             tbCountry   = { Text = band.Country },
             EditedId    = band.Id
         };
         mainControl.Content = bandEdit;
     }
     else if (lbOutput.SelectedItem is Venue venue)
     {
         var venueEdit = new VenueEdit
         {
             ActionMode  = ActionMode.Edit,
             LabelAction = { Content = "Edit Venue" },
             tbName      = { Text = venue.Name },
             tbAddress   = { Text = venue.Address },
             tbCapacity  = { Text = venue.Capacity.ToString() },
             EditedId    = venue.Id
         };
         mainControl.Content = venueEdit;
     }
     else if (lbOutput.SelectedItem is Concert concert)
     {
         var concertEdit = new ConcertEdit
         {
             ActionMode    = ActionMode.Edit,
             labelAction   = { Content = "Edit Concert" },
             EditedConcert = concert,
             Venues        = Venues,
             Bands         = Bands
         };
         concertEdit.PopulateComboBoxes();
         concertEdit.SetDataToEdit();
         mainControl.Content = concertEdit;
     }
     SetViewToEdit();
 }
Example #2
0
 /**
  * A jelenleg kiválasztott típusból újat hozunk létre
  */
 private void buttonCreateNew_Click(object sender, RoutedEventArgs e)
 {
     if (CurrentView == typeof(Band))
     {
         //Create mód az alapértelmezett, itt nem kell állítani semmit
         var bandEdit = new BandEdit();
         mainControl.Content = bandEdit;
     }
     else if (CurrentView == typeof(Venue))
     {
         var venueEdit = new VenueEdit();
         mainControl.Content = venueEdit;
     }
     else if (CurrentView == typeof(Concert))
     {
         var concertEdit = new ConcertEdit {
             Venues = Venues, Bands = Bands
         };
         concertEdit.PopulateComboBoxes();
         mainControl.Content = concertEdit;
     }
     SetViewToEdit();
 }