TestProductPage.xaml.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Windows.Controls;
  2. using TeamAAS_VP.ViewModels.Product;
  3. namespace TeamAAS_VP.Views.Product
  4. {
  5. /// <summary>
  6. /// Interaction logic for TestProductPage
  7. /// </summary>
  8. public partial class TestProductPage : UserControl
  9. {
  10. TestProductPageViewModel VM;
  11. public TestProductPage()
  12. {
  13. InitializeComponent();
  14. this.display.HorizontalScrollBar = false;
  15. this.display.VerticalScrollBar = false;
  16. this.display.AutoFit = true;
  17. this.display.BackColor = System.Drawing.SystemColors.ActiveCaption;
  18. this.display1.HorizontalScrollBar = false;
  19. this.display1.VerticalScrollBar = false;
  20. this.display1.AutoFit = true;
  21. this.display1.BackColor = System.Drawing.SystemColors.ActiveCaption;
  22. VM = DataContext as TestProductPageViewModel;
  23. VM.PropertyChanged += VM_PropertyChanged;
  24. }
  25. private void VM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  26. {
  27. try
  28. {
  29. if (e.PropertyName == "Image")
  30. {
  31. this.display.Image = VM.Image;
  32. }
  33. else if (e.PropertyName == "Graphic")
  34. {
  35. this.display.StaticGraphics.Clear();
  36. if (VM.Graphic != null)
  37. {
  38. this.display.StaticGraphics.AddList(VM.Graphic, "");
  39. }
  40. }
  41. else if (e.PropertyName == "Image1")
  42. {
  43. this.display1.Image = VM.Image;
  44. }
  45. else if (e.PropertyName == "Graphic1")
  46. {
  47. this.display1.StaticGraphics.Clear();
  48. if (VM.Graphic != null)
  49. {
  50. this.display1.StaticGraphics.AddList(VM.Graphic, "");
  51. }
  52. }
  53. }
  54. catch (System.Exception)
  55. {
  56. }
  57. }
  58. }
  59. }