CalculateOffsetU.xaml.cs 1.5 KB

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