Beispiel #1
0
        private void ItemClickedExecute(Object param)
        {
            try
            {
                if (param is Manufacturer)
                {
                    var manufacturer = (Manufacturer)param;
                    SelectedCarModel     = null;
                    SelectedManufacturer = manufacturer;

                    TreeViewItemSelectedEventArgs args = new TreeViewItemSelectedEventArgs();
                    args.Manufacturer = manufacturer;
                    args.Model        = null;
                    OnItemSelected(args);
                }
                else if (param is CarModel)
                {
                    var model = (CarModel)param;
                    SelectedManufacturer = null;
                    SelectedCarModel     = model;

                    TreeViewItemSelectedEventArgs args = new TreeViewItemSelectedEventArgs();
                    args.Manufacturer = null;
                    args.Model        = model;
                    OnItemSelected(args);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Invalid treeview item object: {ex.Message}");
            }
        }
Beispiel #2
0
        protected virtual void OnItemSelected(TreeViewItemSelectedEventArgs e)
        {
            OnItemSelectedEventHandler handler = ItemSelected;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #3
0
 public void c_ItemSelected(object sender, TreeViewItemSelectedEventArgs e)
 {
     SelectedModel        = e.Model;
     SelectedManufacturer = e.Manufacturer;
     //using (var service = new RentACarService.)
     //{
     //    if (SelectedModel != null)
     //    {
     //        Cars = service.GetCarByModel(SelectedModel);
     //    }
     //    else if (SelectedManufacturer != null)
     //    {
     //        Cars = service.GetCarByManufacturer(SelectedManufacturer);
     //    }
     //}
 }