RobotView.xaml.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.GetCharacterInfo();
  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. this.ViewModel.ReLogin();
  42. }
  43. private async void menuServers_Click(object sender, RoutedEventArgs e)
  44. {
  45. await this.ViewModel.Servers();
  46. this.tcAll.SelectedIndex = 0;
  47. this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
  48. this.tbLog.ScrollToEnd();
  49. }
  50. private async void btnForbiddenBuy_Click(object sender, RoutedEventArgs e)
  51. {
  52. await this.ViewModel.ForbiddenBuy();
  53. this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
  54. this.tbLog.ScrollToEnd();
  55. }
  56. private async void btnAllowBuy_Click(object sender, RoutedEventArgs e)
  57. {
  58. await this.ViewModel.AllowBuy();
  59. this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
  60. this.tbLog.ScrollToEnd();
  61. }
  62. private async void btnSendCommand_Click(object sender, RoutedEventArgs e)
  63. {
  64. await this.ViewModel.SendCommand();
  65. this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
  66. this.tbLog.ScrollToEnd();
  67. }
  68. private async void btnForbiddenAccountLoginButton_Click(object sender, RoutedEventArgs e)
  69. {
  70. await this.ViewModel.ForbiddenAccountLogin();
  71. this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
  72. this.tbLog.ScrollToEnd();
  73. }
  74. private async void btnAllowAccountLogin_Click(object sender, RoutedEventArgs e)
  75. {
  76. await this.ViewModel.AllowAccountLogin();
  77. this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
  78. this.tbLog.ScrollToEnd();
  79. }
  80. }
  81. }