private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e) { UserControl usc = null; GridMain.Children.Clear(); switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "MyProduct": usc = new ControlMyProducts(manufacturer.ID_Manufacturer); GridMain.Children.Add(usc); break; case "Account": usc = new UserProfileControl(ref manufacturer); GridMain.Children.Add(usc); break; case "CreateProduct": usc = new AddProduct(manufacturer.ID_Manufacturer); GridMain.Children.Add(usc); break; default: break; } }
public MainManufactore(User user) { InitializeComponent(); manufacturer = new Manufacturer(user); UserControl usc = null; GridMain.Children.Clear(); if (manufacturer.InitManufacturer() == 1) { usc = new UserProfileControl(ref manufacturer); GridMain.Children.Add(usc); } else { usc = new UserProfileControl(ref manufacturer); GridMain.Children.Add(usc); //init control init data } }