CalibrationVerification.xaml.cs 1.4 KB

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