From 7b024ed72619aa0d01d389ddf27aad769ada13bd Mon Sep 17 00:00:00 2001 From: xu Date: Tue, 2 Jul 2024 14:58:54 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E8=B0=83=E6=95=B4=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=20=E8=AF=A6=E7=BB=86=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- Plane.FormationCreator/Formation/CopterManager.cs | 2 +- .../Formation/FlightTaskManager.cs | 12 +++++++++++- Plane.FormationCreator/MainWindow.xaml | 2 +- .../ViewModels/ConnectViewModel.cs | 2 +- .../ViewModels/RtcmInfoViewModel.cs | 11 ++++++++--- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Plane.FormationCreator/Formation/CopterManager.cs b/Plane.FormationCreator/Formation/CopterManager.cs index 8d05899..073268e 100644 --- a/Plane.FormationCreator/Formation/CopterManager.cs +++ b/Plane.FormationCreator/Formation/CopterManager.cs @@ -367,7 +367,7 @@ namespace Plane.FormationCreator.Formation string dis_EnVCopterNumber = "<" + EnVCopterNumber.ToString() + ">"; if (EnCopterNumber == -1) dis_EnCopterNumber = "<无限>"; if (EnVCopterNumber == -1) dis_EnVCopterNumber = "<无限>"; - Loginstate ="["+ UserDisplayName + "]已登录,模拟飞机:"+ dis_EnVCopterNumber + "架,真实飞机:"+ dis_EnCopterNumber + "架"; + Loginstate ="["+ UserDisplayName + "] 模拟飞机:"+ dis_EnVCopterNumber + "架,真实飞机:"+ dis_EnCopterNumber + "架"; Logined = true; VersionControl.SetUserLever(userlever); if (UserName != supername) diff --git a/Plane.FormationCreator/Formation/FlightTaskManager.cs b/Plane.FormationCreator/Formation/FlightTaskManager.cs index 5bf2d23..804cdf7 100644 --- a/Plane.FormationCreator/Formation/FlightTaskManager.cs +++ b/Plane.FormationCreator/Formation/FlightTaskManager.cs @@ -27,6 +27,7 @@ using GMap.NET.MapProviders; using GMap.NET; using static Plane.FormationCreator.CalculationLogLatDistance; using Plane.CopterManagement; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock; namespace Plane.FormationCreator.Formation { @@ -482,7 +483,7 @@ namespace Plane.FormationCreator.Formation public void AddTask() { - //if (AppEx.Instance.CurrentMode == AppMode.PreparedForRunningTasks) + try { var copters = _copterManager.Copters; if (!copters.Any()) return; @@ -514,6 +515,11 @@ namespace Plane.FormationCreator.Formation foreach (var copter in copters) { preSingleCopterInfo = lastTask.SingleCopterInfos.Find(info => info.Copter == copter); + if (preSingleCopterInfo==null) + { + Alert.Show($"无法添加任务,{copter.Id}飞机可能是新加入的,没有找到之前的任务信息"); + return; + } if (coptindex == 0) { lastSingleCopterInfo = lastTask.SingleCopterInfos.Find(info => info.Copter == copter); @@ -567,6 +573,10 @@ namespace Plane.FormationCreator.Formation } + catch (Exception ex) + { + Alert.Show($"创建任务失败:{ex}"); + } } //是否显示计划航线 diff --git a/Plane.FormationCreator/MainWindow.xaml b/Plane.FormationCreator/MainWindow.xaml index efc6a93..f1d6aa6 100644 --- a/Plane.FormationCreator/MainWindow.xaml +++ b/Plane.FormationCreator/MainWindow.xaml @@ -267,7 +267,7 @@ - + diff --git a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs index e570af4..d9899ef 100644 --- a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs @@ -112,7 +112,7 @@ namespace Plane.FormationCreator.ViewModels { return _Openboardport ?? (_Openboardport = new RelayCommand(async connectionType => { - if (_commModuleManager.Recomisopen) + if (btnBoardPortStr== "关闭广播端口") { //关闭广播端口 //正在发送rtcm数据并且使用了广播端口 diff --git a/Plane.FormationCreator/ViewModels/RtcmInfoViewModel.cs b/Plane.FormationCreator/ViewModels/RtcmInfoViewModel.cs index e66f11d..daf0c1b 100644 --- a/Plane.FormationCreator/ViewModels/RtcmInfoViewModel.cs +++ b/Plane.FormationCreator/ViewModels/RtcmInfoViewModel.cs @@ -85,12 +85,17 @@ namespace Plane.FormationCreator.ViewModels { if (value) - { //发送 + { + //发送 + if (_commModuleManager.last_reserialport == "") + { + Alert.Show($"先在设置里打开广播端口", "提示", MessageBoxButton.OK, MessageBoxImage.Information); + }else if (!_commModuleManager.Recomisopen) { - Alert.Show($"请先在设置里面打开广播端口,否则无法发送", "提示", MessageBoxButton.OK, MessageBoxImage.Information); + Alert.Show($"广播端口未打开,无法发送", "提示", MessageBoxButton.OK, MessageBoxImage.Information); } - + } Set(nameof(ResendToComMK), ref _resendtocommk, value); _rtcmManager.ResendToCom = value;