From 6fbb8e6273203b05acc0be444df2211785c145e9 Mon Sep 17 00:00:00 2001 From: zxd Date: Sun, 5 Aug 2018 13:51:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=80=E5=85=B3=E7=81=AF?= =?UTF-8?q?=E5=8F=82=E6=95=B0=20=E9=80=9A=E4=BF=A1=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E8=AF=95(=E6=9C=AA=E4=BD=BF=E7=94=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plane.FormationCreator/MainWindow.xaml.cs | 2 +- .../ViewModels/ConnectViewModel.cs | 22 ++++++++++++++++--- .../ViewModels/ControlPanelViewModel.cs | 2 +- .../Views/ConnectWindow.xaml | 2 ++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Plane.FormationCreator/MainWindow.xaml.cs b/Plane.FormationCreator/MainWindow.xaml.cs index 59cd581..8a580c8 100644 --- a/Plane.FormationCreator/MainWindow.xaml.cs +++ b/Plane.FormationCreator/MainWindow.xaml.cs @@ -50,7 +50,7 @@ namespace Plane.FormationCreator { loginWindow = new ConnectWindow(); } - loginWindow.ShowDialog(); + loginWindow.Show(); } private void btnLogin_Click(object sender, RoutedEventArgs e) diff --git a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs index c47cb36..37a7caf 100644 --- a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs @@ -132,7 +132,21 @@ namespace Plane.FormationCreator.ViewModels { return _WriteIdCommand ?? (_WriteIdCommand = new RelayCommand(async () => { - await WriteIdCommandAsync(CopterNum); + await WriteIdCommandAsync(CopterNum, MavComm.COMMANDTYPE4); + } + )); + } + } + + + private ICommand _ChangeWriteMissionCommand; + public ICommand ChangeWriteMissionCommand + { + get + { + return _ChangeWriteMissionCommand ?? (_ChangeWriteMissionCommand = new RelayCommand(async () => + { + await WriteIdCommandAsync(0, MavComm.COMM_WRITE_MISSION); } )); } @@ -279,9 +293,11 @@ namespace Plane.FormationCreator.ViewModels } - private async Task WriteIdCommandAsync(int num) + + + private async Task WriteIdCommandAsync(int num, short messageType) { - await commModule.GeneratePacketAsync((short)num, (byte)Protocols.MavComm.COMMANDTYPE4); + await commModule.GeneratePacketAsync((short)num, messageType); } diff --git a/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs b/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs index 08b8253..d376051 100644 --- a/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs @@ -202,7 +202,7 @@ namespace Plane.FormationCreator.ViewModels } } - private const string NTF_GROUPLED_OFF = "NTF_GROUPLED_OFF"; + private const string NTF_GROUPLED_OFF = "NTF_GLED_OFF"; private ICommand _LEDOnOffCommand; public ICommand LEDOnOffCommand { diff --git a/Plane.FormationCreator/Views/ConnectWindow.xaml b/Plane.FormationCreator/Views/ConnectWindow.xaml index 3d81ccd..60110bf 100644 --- a/Plane.FormationCreator/Views/ConnectWindow.xaml +++ b/Plane.FormationCreator/Views/ConnectWindow.xaml @@ -108,6 +108,7 @@ IsProcessing="{Binding IsProcessing}" Command="{Binding Path=ConnectCommand}" CommandParameter="SerialPort" /> +