예제 #1
0
 public void setSubCategory(FeatureSampleCategory currentSampleCategories, SampleInfo sample)
 {
     if (currentSampleCategories.AllSampleCategory != null && currentSampleCategories.AllSampleCategory.ContainsKey(sample.SampleCategory))
     {
         var FeatureSamples = currentSampleCategories.AllSampleCategory[sample.SampleCategory];
         FeatureSamples.AllSamples.Add(sample);
     }
     else
     {
         FeatureSampleCollection newSamples = new FeatureSampleCollection();
         newSamples.Name       = sample.Header;
         newSamples.AllSamples = new List <SampleInfo>();
         newSamples.AllSamples.Add(sample);
         currentSampleCategories.AllSampleCategory.Add(sample.SampleCategory, newSamples);
     }
 }
 private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         SelectedItem = e.AddedItems[0] as FeatureSampleCategory;
         foreach (Products p in SampleHelper.DataViewModel.AllProductsCategories.Values)
         {
             foreach (FeatureSampleCategory category in p.AllProducts.Values)
             {
                 if (category.IsSelected && category != e.AddedItems[0] as FeatureSampleCategory)
                 {
                     category.IsSelected = false;
                     break;
                 }
             }
         }
     }
     if (e.RemovedItems.Count > 0 && (!IsNavigatedFrom))
     {
         if (SelectedItem != null)
         {
             SelectedItem.IsSelected = true;
         }
     }
     if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
     {
         if (SelectedItem != null)
         {
             this.SampleContent.DataContext = SelectedItem;
         }
     }
     else
     {
         FrameNavigationService.Header.Text = (e.AddedItems[0] as FeatureSampleCategory).Name;
         FrameNavigationService.CurrentFrame.Navigate(typeof(SampleContent), e.AddedItems[0]);
     }
 }
예제 #3
0
 public void GetProducts(Products currentProducts, SampleInfo sample)
 {
     if (currentProducts.AllProducts != null && currentProducts.AllProducts.ContainsKey(sample.Product))
     {
         var currentSampleCategories = currentProducts.AllProducts[sample.Product];
         if (sample.ProductIcons != null)
         {
             currentSampleCategories.ProductIcon = sample.ProductIcons;
         }
         setSubCategory(currentSampleCategories, sample);
     }
     else
     {
         FeatureSampleCategory newSampleCategory = new FeatureSampleCategory();
         newSampleCategory.Name = sample.Product;
         if (SampleHelper.NewProduct != null && SampleHelper.NewProduct.Contains(sample.Product))
         {
             newSampleCategory.ProductTag = Tags.New;
         }
         else if (SampleHelper.PreviewProduct != null && SampleHelper.PreviewProduct.Contains(sample.Product))
         {
             newSampleCategory.ProductTag = Tags.Preview;
         }
         else if (SampleHelper.UpdatedProduct != null && SampleHelper.UpdatedProduct.Contains(sample.Product))
         {
             newSampleCategory.ProductTag = Tags.Updated;
         }
         if (sample.ProductIcons != null)
         {
             newSampleCategory.ProductIcon = sample.ProductIcons;
         }
         newSampleCategory.AllSampleCategory = new Dictionary <string, FeatureSampleCollection>();
         setSubCategory(newSampleCategory, sample);
         currentProducts.AllProducts.Add(sample.Product, newSampleCategory);
     }
 }