| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using System;
- using System.ComponentModel.Composition;
- using System.Windows;
- using Infrastructure;
- namespace Modules.Robot
- {
- /// <summary>
- /// RobotView.xaml 的交互逻辑
- /// </summary>
- [ViewExport(RegionName = "RobotRegion"), PartCreationPolicy(CreationPolicy.NonShared)]
- public partial class RobotView
- {
- public RobotView()
- {
- this.InitializeComponent();
- }
- [Import]
- private RobotViewModel ViewModel
- {
- get
- {
- return this.DataContext as RobotViewModel;
- }
- set
- {
- this.DataContext = value;
- }
- }
- private void menuReload_Click(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Reload();
- }
- private async void btnFindPlayer_Click(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.GetCharacterInfo();
- this.tcCharacterInfo.IsEnabled = true;
- this.btnForbidCharacter.IsEnabled = true;
- this.btnAllowCharacter.IsEnabled = true;
- this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
- this.tbLog.ScrollToEnd();
- }
- private void menuLogin_Click(object sender, RoutedEventArgs e)
- {
- this.ViewModel.ReLogin();
- }
- private async void menuServers_Click(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.Servers();
- this.tcAll.SelectedIndex = 0;
- this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
- this.tbLog.ScrollToEnd();
- }
- private async void btnForbidCharacter_Click(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.ForbidCharacter(cbForbiddenType.SelectedValue.ToString(), tbForbiddenTime.Text);
- this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
- this.tbLog.ScrollToEnd();
- }
- private async void btnAllowCharacter_Click(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.ForbidCharacter(cbForbiddenType.SelectedValue.ToString(), "-1");
- this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
- this.tbLog.ScrollToEnd();
- }
- private async void btnSendCommand_Click(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.SendCommand();
- this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
- this.tbLog.ScrollToEnd();
- }
- private async void btnForbiddenLogin_Click(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.ForbiddenLogin(
- cbForbiddenLogin.SelectedValue.ToString(),
- tbForbiddenLoginContent.Text, tbForbiddenLoginTime.Text);
- this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
- this.tbLog.ScrollToEnd();
- }
- private async void btnAllowLogin_Click(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.ForbiddenLogin(
- cbForbiddenLogin.SelectedValue.ToString(), tbForbiddenLoginContent.Text, "-1");
- this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
- this.tbLog.ScrollToEnd();
- }
- private async void btnSendMail_Click(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.SendMail();
- this.tbLog.AppendText(Environment.NewLine + this.ViewModel.ErrorInfo);
- this.tbLog.ScrollToEnd();
- }
- }
- }
|