Exemple #1
0
        private void btn_Submit_Click(object sender, RoutedEventArgs e)
        {
            double testDouble;
            string testString;

            if (double.TryParse(txtbx_Price.Text, out testDouble) == true && txtbx_Manufacturer.Text != string.Empty && txtbx_Name.Text != string.Empty)
            {
                Toy userToy = new Toy();
                userToy.Manufacturer = txtbx_Manufacturer.Text;
                userToy.Name         = txtbx_Name.Text;
                userToy.Price        = Convert.ToDouble(txtbx_Price.Text);
                userToy.GetAisle();
                listbx_ToyInfo.Items.Add(userToy);
            }
            else
            {
                MessageBox.Show("Invalid Input");
            }
        }
 private void lstToys_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     Toy selectedToy = (Toy)lstToys.SelectedItem;
     //MessageBox.Show($"{GetAisle(selectedToy)}");
 }
Exemple #3
0
        private void listbx_ToyInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Toy selectedToy = (Toy)listbx_ToyInfo.SelectedItem;

            MessageBox.Show($"Manufacturer: {selectedToy.Manufacturer}\nName: {selectedToy.Name}\nPrice: {selectedToy.Price.ToString()}\nAisle: {selectedToy.GetAisle()}");
        }