RobotView.xaml.cs 776 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.ComponentModel.Composition;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using Infrastructure;
  5. namespace Modules.Robot
  6. {
  7. /// <summary>
  8. /// RobotView.xaml 的交互逻辑
  9. /// </summary>
  10. [ViewExport(RegionName = "RobotRegion"), PartCreationPolicy(CreationPolicy.NonShared)]
  11. public partial class RobotView
  12. {
  13. public RobotView()
  14. {
  15. this.InitializeComponent();
  16. }
  17. [Import]
  18. private RobotViewModel ViewModel
  19. {
  20. get
  21. {
  22. return this.DataContext as RobotViewModel;
  23. }
  24. set
  25. {
  26. this.DataContext = value;
  27. }
  28. }
  29. private void btnStart_Click(object sender, RoutedEventArgs e)
  30. {
  31. this.ViewModel.Start();
  32. }
  33. private void tbLog_TextChanged(object sender, TextChangedEventArgs e)
  34. {
  35. this.tbLog.ScrollToEnd();
  36. }
  37. }
  38. }