Ejemplo n.º 1
0
        private void btnPedalNew_Click(object sender, RoutedEventArgs e)
        {
            var name = txtPedalName.Text;
            var notes = txtPedalNotes.Text;

            if (name.Length > 0)
            {
                Pedal newPedal = new Pedal();
                newPedal.Name = name;
                newPedal.Notes = notes;
                _context.Pedals.Add(newPedal);
                var changed = _context.SaveChanges();
                pedalDataGrid.Items.Refresh();
                Status = "";
                Status = newPedal.Name + " added.";
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves a reference to the selected pedal.
        /// Updates the pedal cost shown on the components tab.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pedalDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (pedalDataGrid.SelectedValue != null)
            {
                _selectedPedal = (Pedal)(pedalDataGrid.SelectedItem);
                lblPedalName.Content = _selectedPedal.Name;

                updatePedalCost();
            }
        }