RobotView.xaml.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.ComponentModel.Composition;
  3. using System.Windows;
  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 menuReload_Click(object sender, RoutedEventArgs e)
  30. {
  31. this.ViewModel.Reload();
  32. }
  33. private void btnFindPlayer_Click(object sender, RoutedEventArgs e)
  34. {
  35. this.ViewModel.FindPlayer();
  36. this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
  37. this.tbLog.ScrollToEnd();
  38. }
  39. private void menuLogin_Click(object sender, RoutedEventArgs e)
  40. {
  41. }
  42. private async void menuServers_Click(object sender, RoutedEventArgs e)
  43. {
  44. await this.ViewModel.Servers();
  45. this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
  46. this.tbLog.ScrollToEnd();
  47. }
  48. private async void btnForbiddenBuy_Click(object sender, RoutedEventArgs e)
  49. {
  50. await this.ViewModel.ForbiddenBuy();
  51. this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
  52. this.tbLog.ScrollToEnd();
  53. }
  54. private async void btnAllowBuy_Click(object sender, RoutedEventArgs e)
  55. {
  56. await this.ViewModel.AllowBuy();
  57. this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
  58. this.tbLog.ScrollToEnd();
  59. }
  60. }
  61. }