Ejemplo n.º 1
0
        private void lbVehicles_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Vehicle     vehicle = (Vehicle)lbVehicles.SelectedItem;
            VehicleForm form    = new VehicleForm(vehicle);

            if (form.ShowDialog() == true)
            {
                //Update the vehicle in the database
                service.UpdateItem(vehicle);
                //Refresh the lb
                vehicles = service.GetAll();
                lbVehicles.ItemsSource = vehicles;
                lbVehicles.Items.Refresh();
            }
        }
Ejemplo n.º 2
0
        private void btnNew_Click(object sender, RoutedEventArgs e)
        {
            VehicleForm form = new VehicleForm();

            if (form.ShowDialog() == true)
            {
                //we have a good item add it to the list
                //Add the new Vehicle to database
                service.AddItem(form.Vehicle);
                //Refresh the lisbox
                vehicles = service.GetAll();
                lbVehicles.ItemsSource = vehicles;
                lbVehicles.Items.Refresh();
            }
            ;
        }