CalibTool.xaml.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. using TeamAAS_VP.ViewModels.Calibration;
  16. namespace TeamAAS_VP.Views.Calibration
  17. {
  18. /// <summary>
  19. /// CalibTool.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class CalibTool : UserControl
  22. {
  23. CalibToolViewModel VM;
  24. public CalibTool()
  25. {
  26. InitializeComponent();
  27. VM = DataContext as CalibToolViewModel;
  28. VM.PropertyChanged += VM_PropertyChanged;
  29. this.display.VerticalScrollBar = false;
  30. this.display.HorizontalScrollBar = false;
  31. this.display.AutoFit = true;
  32. this.display.BackColor = System.Drawing.SystemColors.ActiveCaption;
  33. }
  34. private void VM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  35. {
  36. try
  37. {
  38. if (e.PropertyName == "Image")
  39. {
  40. this.display.Image = VM.Image;
  41. }
  42. else if (e.PropertyName == "Graphic")
  43. {
  44. this.display.StaticGraphics.Clear();
  45. if (VM.Graphic!=null)
  46. {
  47. this.display.StaticGraphics.AddList(VM.Graphic, "");
  48. }
  49. }
  50. }
  51. catch (Exception)
  52. {
  53. }
  54. }
  55. }
  56. }