Ejemplo n.º 1
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            TruckAddPrompt addPrompt = new TruckAddPrompt();


            addPrompt.ShowDialog();
            if (addPrompt.IDBox.Text == "" || addPrompt.SizeBox.SelectedIndex < 0 || addPrompt.CostBox.Text == "")
            {
                return;
            }
            trucks.AddTruck(new Truck(int.Parse(addPrompt.IDBox.Text), addPrompt.SizeBox.SelectedIndex + 1, (addPrompt.AvailableButton.IsChecked == true), double.Parse(addPrompt.CostBox.Text)));
            SaveTrucks();
            UpdateDisplay();
        }
Ejemplo n.º 2
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            if (TruckID.SelectedIndex < 0)
            {
                return;
            }
            Truck          truckItem = trucks.GetTruck(TruckID.SelectedIndex);
            TruckAddPrompt addPrompt = new TruckAddPrompt(truckItem.Id, truckItem.Size, truckItem.IsRented(), truckItem.cost);


            addPrompt.ShowDialog();

            trucks.RemoveTruckAtIndex(TruckID.SelectedIndex);
            trucks.AddTruck(new Truck(int.Parse(addPrompt.IDBox.Text), addPrompt.SizeBox.SelectedIndex + 1, (addPrompt.AvailableButton.IsChecked == true), double.Parse(addPrompt.CostBox.Text)));
            SaveTrucks();
            UpdateDisplay();
        }