Exemplo n.º 1
0
 // method called when an item is selected from the Category Carousel
 private void InspectCategory(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
 {
     if (CategoriesCarousel.SelectedItem != null)
     {
         int          categoryId = (CategoriesCarousel.SelectedItem as MediaData).Id;
         Category     category   = dc.Categories.Where(cat => cat.CategoryId == categoryId).Single();
         CategoryForm cf         = new CategoryForm(category);
         cf.Show();
     }
 }
Exemplo n.º 2
0
 // method called when an item is selected from the Category Carousel
 private void InspectCategory(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
 {
     if (CategoriesCarousel.SelectedItem != null)                                                     // checking if there is a selected item
     {
         int          categoryId = (CategoriesCarousel.SelectedItem as MediaData).Id;                 // getting the select item id
         Category     category   = dc.Categories.Where(cat => cat.CategoryId == categoryId).Single(); // retrieving the selected category data from the Category table
         CategoryForm cf         = new CategoryForm(category);                                        // / creates a new instance of the CategoryForm page
         cf.Show();                                                                                   // show the Category form filled with the data of the selected category
         refreshCategories();
     }
 }
Exemplo n.º 3
0
 //get selected category from category data
 private void categoryDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (categoryDataGrid.SelectedItem != null)
         {
             int categoryId = (categoryDataGrid.SelectedItem as dynamic).CategoryId;
             category = dc.Categories.Where(category => category.CategoryId == categoryId).Single();
             CategoryForm cf = new CategoryForm(category);
             cf.Show();
             this.Close();
         }
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message, " error");
     }
 }