SupportedBoxesWindow.xaml.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Shapes;
  13. using MatrixIO.IO.Bmff;
  14. namespace BmffViewer
  15. {
  16. /// <summary>
  17. /// Interaction logic for SupportedBoxes.xaml
  18. /// </summary>
  19. public partial class SupportedBoxesWindow : Window
  20. {
  21. SortedDictionary<string, string> SupportedBoxesList = new SortedDictionary<string, string>();
  22. public SupportedBoxesWindow()
  23. {
  24. InitializeComponent();
  25. foreach (KeyValuePair<BoxType, Type> boxTypeInfo in Box.AvailableBoxTypes)
  26. {
  27. string typeName = boxTypeInfo.Key.ToString();
  28. string description = "";
  29. foreach (BoxAttribute boxAttribute in boxTypeInfo.Value.GetCustomAttributes(typeof(BoxAttribute), true))
  30. {
  31. if (boxTypeInfo.Key == boxAttribute.Type)
  32. {
  33. description = boxAttribute.Description;
  34. break;
  35. }
  36. }
  37. SupportedBoxesList.Add(typeName, description);
  38. }
  39. BoxList.ItemsSource = SupportedBoxesList;
  40. CountBox.Text = "Count=" + SupportedBoxesList.Count();
  41. }
  42. }
  43. }