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;