diff --git a/Plane.FormationCreator/Formation/Copter.cs b/Plane.FormationCreator/Formation/Copter.cs index 6c1d209..b82209f 100644 --- a/Plane.FormationCreator/Formation/Copter.cs +++ b/Plane.FormationCreator/Formation/Copter.cs @@ -28,6 +28,14 @@ namespace Plane.FormationCreator.Formation //RaiseLocationChangedIfNeeded(); } + + internal static SolidColorBrush BlueBrush { get; } = new SolidColorBrush(Color.FromRgb(28, 151, 234)); + internal static SolidColorBrush RedBrush { get; } = new SolidColorBrush(Color.FromRgb(255, 100, 100)); + internal static SolidColorBrush GreenBrush { get; } = new SolidColorBrush(Color.FromRgb(100, 255, 100)); + internal static SolidColorBrush YellowBrush { get; } = new SolidColorBrush(Color.FromRgb(255, 215, 0)); + + + static SolidColorBrush[] _brushes = new[] { new SolidColorBrush(Color.FromArgb(180, 255, 0, 0)), @@ -44,9 +52,11 @@ namespace Plane.FormationCreator.Formation return _brushIndex++ % _brushes.Length; } //真实飞机列表默认颜色 - internal static SolidColorBrush DefaultBrush { get; } = new SolidColorBrush(Color.FromRgb(50, 205, 50)); + internal static SolidColorBrush DefaultBrush { get; } = GreenBrush;// new SolidColorBrush(Color.FromRgb(50, 205, 50)); //虚拟飞机列表默认颜色 - internal static SolidColorBrush DefaultFakeBrush { get; } = new SolidColorBrush(Color.FromRgb(28, 151, 234)); + internal static SolidColorBrush DefaultFakeBrush { get; } = BlueBrush; + + private SolidColorBrush _Brush; diff --git a/Plane.FormationCreator/Formation/FlightTaskManager.cs b/Plane.FormationCreator/Formation/FlightTaskManager.cs index 96180a5..db2e67b 100644 --- a/Plane.FormationCreator/Formation/FlightTaskManager.cs +++ b/Plane.FormationCreator/Formation/FlightTaskManager.cs @@ -2258,6 +2258,18 @@ namespace Plane.FormationCreator.Formation taskStartTime = DateTime.Now; Message.Show($"{DateTime.Now.ToString("HH:mm:ss")}:任务开始"); } + + //设置模拟飞行更新间隔,都是I7配置下 + int update_int = 50; //300以内50流畅 + if ((_copterManager.Copters.Count() > 300) && ((_copterManager.Copters.Count() <= 500))) + update_int = 100; //300-500, 100才能模拟有些跳动 + if ((_copterManager.Copters.Count() > 500) ) + update_int = 150; //极限了 500-1000可以用 + foreach (var copter in _copterManager.Copters) + copter.sim_update_int = update_int; + + + await RunAsync(); if ((IsPaused ?? false) == false) { diff --git a/Plane.FormationCreator/MainWindow.xaml b/Plane.FormationCreator/MainWindow.xaml index 2047078..3c3e992 100644 --- a/Plane.FormationCreator/MainWindow.xaml +++ b/Plane.FormationCreator/MainWindow.xaml @@ -303,6 +303,7 @@ TextChanged="LogTextChange" IsReadOnly="True" TextWrapping="Wrap" + FontSize="14" ContextMenu="{StaticResource LogMenu}"/> ChangePasswordView.xaml + + InputDialog.xaml + LoginView.xaml @@ -387,6 +390,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + Form MSBuild:Compile @@ -466,6 +473,9 @@ + + + diff --git a/Plane.FormationCreator/Resources/logo_big.png b/Plane.FormationCreator/Resources/logo_big.png new file mode 100644 index 0000000..89cdf8c Binary files /dev/null and b/Plane.FormationCreator/Resources/logo_big.png differ diff --git a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs index 85fddef..c9920a9 100644 --- a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs @@ -242,6 +242,21 @@ namespace Plane.FormationCreator.ViewModels })); } } + + private ICommand _TestModuleCommand; + public ICommand TestModuleCommand + { + get + { + return _TestModuleCommand ?? (_TestModuleCommand = new RelayCommand(async () => + { + await commModule.TestModule((short)scale3d); + })); + } + } + + + private ICommand _CommDataAsync; public ICommand CommDataAsync { @@ -266,7 +281,7 @@ namespace Plane.FormationCreator.ViewModels { int channel = int.Parse(CopterColor); if (channel >= 0 && channel <= 4) - await commModule.TestFire((short)CopterNum, channel); + await commModule.TestFire((short)CopterNum, channel); } catch { } diff --git a/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs b/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs index d3178a9..55e7607 100644 --- a/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs @@ -119,7 +119,25 @@ namespace Plane.FormationCreator.ViewModels { return _DetectionVoltage ?? (_DetectionVoltage = new RelayCommand(async () => { - Message.Show("--------------开始检测电压--------------"); + + float minVol; + InputDialog inputDialog = new InputDialog("最低检测电压( 0 恢复灯光):", "15.6"); + if (inputDialog.ShowDialog() == true) + minVol = float.Parse(inputDialog.Answer); + else return; + + //测试电池 + await _commModuleManager.TestBattery((short)0, minVol); + if (minVol == 0.0) return; + Message.Show("---请检查飞机灯光---"); + Message.Show(string.Format("---绿 色 电压高于 {0:F2}v (单节高于 {1:F2}v)--- ", minVol , minVol / 4.0f)); + Message.Show(string.Format("---黄 色 电压低于 {0:F2}v (单节低于 {1:F2}v)--- ", minVol , minVol / 4.0f)); + Message.Show(string.Format("---棕 色 电压低于 {0:F2}v (单节低于 {1:F2}v)--- ", minVol - 0.2, (minVol - 0.2) / 4.0f)); + Message.Show(string.Format("---洋红色 电压低于 {0:F2}v (单节低于 {1:F2}v)--- ", minVol - 0.4, (minVol - 0.4) / 4.0f)); + Message.Show(string.Format("---亮红色 电压低于 {0:F2}v (单节低于 {1:F2}v)--- ", minVol - 0.6, (minVol - 0.6) / 4.0f)); + Message.Show("---输入0恢复灯光---"); + + Message.Show("--------------开始检测单机电压--------------"); Dictionary dic_voltage = new Dictionary(); await Task.WhenAll(_copterManager.Copters.Select(async c => { @@ -143,14 +161,20 @@ namespace Plane.FormationCreator.ViewModels })).ConfigureAwait(false); await Task.Run(async () => { Dictionary dic_voltage_Order = dic_voltage.OrderByDescending(o => o.Value).ToDictionary(o => o.Key, o => o.Value); - + bool showch = false; foreach (KeyValuePair kv in dic_voltage_Order) { - Message.Show(string.Format("{0} --> 5秒平均电压:{1}", kv.Key, kv.Value)); + if ((!showch) &&(minVol>0.00) && (kv.Value<=minVol)) + { + Message.Show(string.Format("以下飞机电压低于[{0}V]更换值:", minVol)); + showch = true; + } + Message.Show(string.Format("{0} --> 5秒平均电压:{1:F2},单节{2:F2}", kv.Key, kv.Value, kv.Value/4)); await Task.Delay(5).ConfigureAwait(false); } Message.Show(string.Format("----检测电压完成,检测总数:{0}----", dic_voltage.Count)); }).ConfigureAwait(false); + //todo:增加电压阈值变成不同颜色灯 })); } } @@ -1496,7 +1520,7 @@ namespace Plane.FormationCreator.ViewModels await _RtcmInfoViewModel.RtcmManager.Close(_RtcmInfoViewModel.SerialPortsSelectdValue); } - Alert.Show("开始写入航点,请稍等!", "提示"); + Alert.Show("开始写入航点,请稍等!(先关灯再开可恢复飞机灯光)", "提示"); _commModuleManager.ClearMissionWriteState(); for (int i = 0; i < coptercount; i++) { @@ -1509,7 +1533,7 @@ namespace Plane.FormationCreator.ViewModels } /// - /// 收集航点信息 + /// 用通讯模块 写入航点信息 /// /// copterIndex /// diff --git a/Plane.FormationCreator/ViewModels/CopterListViewModel.cs b/Plane.FormationCreator/ViewModels/CopterListViewModel.cs index 143d69b..8ba2ceb 100644 --- a/Plane.FormationCreator/ViewModels/CopterListViewModel.cs +++ b/Plane.FormationCreator/ViewModels/CopterListViewModel.cs @@ -93,6 +93,12 @@ namespace Plane.FormationCreator.ViewModels get { return _IntervalNum; } set { Set(nameof(IntervalNum), ref _IntervalNum, value); } } + private int _RowNum; + public int RowNum + { + get { return _RowNum; } + set { Set(nameof(RowNum), ref _RowNum, value); } + } private int _ContinuousNum; public int ContinuousNum @@ -111,6 +117,19 @@ namespace Plane.FormationCreator.ViewModels public ObservableCollection CopterGroups { get; } = new ObservableCollection(); + private int getNextcopterindex( int currindex) + { + //每行数量 + int colcount = _flightTaskManager.ColumnCount; + int newind = currindex; + for (int i = 0;i< IntervalNum;i++) + { + newind +=1; + if ((newind % colcount) == 0) + newind += RowNum * colcount; + } + return newind; + } private ICommand _IntervalSelectCoptersCommand; public ICommand IntervalSelectCoptersCommand @@ -126,6 +145,21 @@ namespace Plane.FormationCreator.ViewModels _copterManager.Select(null); int index = _copterManager.Copters.IndexOf(copter); _copterManager.shiftkeydown = true; + int colcount = _flightTaskManager.ColumnCount; + + for (; index < _copterManager.Copters.Count; index= getNextcopterindex( index) ) + { + for (int i = 0; i < ContinuousNum; i++) + { + if (index >= _copterManager.Copters.Count) break; + _copterManager.Select(_copterManager.Copters[index]); + index += 1; + if ((index % colcount) == 0) + index += RowNum * colcount; + getNextcopterindex(index); + } + } + /* for (; index < _copterManager.Copters.Count; index += IntervalNum) { for (int i = 0; i < ContinuousNum; i++) @@ -135,6 +169,7 @@ namespace Plane.FormationCreator.ViewModels index++; } } + */ _copterManager.shiftkeydown = false; })); diff --git a/Plane.FormationCreator/ViewModels/ModifyTaskViewModel.cs b/Plane.FormationCreator/ViewModels/ModifyTaskViewModel.cs index b3c875a..464fd89 100644 --- a/Plane.FormationCreator/ViewModels/ModifyTaskViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ModifyTaskViewModel.cs @@ -265,7 +265,7 @@ namespace Plane.FormationCreator.ViewModels { get { - return _MitTaskVrotationCommand ?? (_MitTaskVrotationCommand = new RelayCommand(async => + return _MitTaskVrotationCommand ?? (_MitTaskVrotationCommand = new RelayCommand(async => { @@ -278,15 +278,29 @@ namespace Plane.FormationCreator.ViewModels double centalt = 0; - if ((taskstartno<=1)||(taskendno> _flightTaskManager.Tasks.Count())) - { - Alert.Show("任务范围不正确", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); - return; - - } + + int _taskstartno = 0; + int _taskendno = 0; + + if (taskstartno == 0) + _taskstartno = 0; + else _taskstartno = taskstartno - 1; + + if (taskendno == 0) + _taskendno = _flightTaskManager.Tasks.Count()-1; + else _taskendno = taskendno - 1; + + + + + + //计算旋转中心轴 - for (int i = taskstartno-1; i < taskendno; i++) + for (int i = _taskstartno ; i <= _taskendno; i++) { + if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff) || (_flightTaskManager.Tasks[i].TaskType == FlightTaskType.Land)) + continue; + for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++) { @@ -315,8 +329,11 @@ namespace Plane.FormationCreator.ViewModels double tlat = 0; - for (int i = taskstartno-1; i < taskendno; i++) + for (int i = _taskstartno; i <= _taskendno; i++) { + if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff) || (_flightTaskManager.Tasks[i].TaskType == FlightTaskType.Land)) + continue; + for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++) { @@ -396,9 +413,22 @@ namespace Plane.FormationCreator.ViewModels float lowalt = 200; + int itaskendno = taskendno; + if (taskendno == 0) itaskendno = _flightTaskManager.Tasks.Count - 1; + else itaskendno = taskendno - 1; + if (itaskendno > _flightTaskManager.Tasks.Count-1) itaskendno = _flightTaskManager.Tasks.Count-1; + // for (int i = taskstartno; i < itaskendno; i++) - int _startindex = 0; - int _endindex = _flightTaskManager.Tasks.Count - 1; + int _startindex = taskstartno; + if (taskstartno == 0) + _startindex = 0; + else + _startindex = taskstartno - 1; + + int _endindex = itaskendno; + + + int lowtask = 0; int lowCopter = 0; @@ -411,7 +441,7 @@ namespace Plane.FormationCreator.ViewModels for (int i = _startindex; i <= _endindex; i++) { - if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff)) + if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff)|| (_flightTaskManager.Tasks[i].TaskType == FlightTaskType.Land)) continue; @@ -1264,11 +1294,20 @@ public ICommand VerticlAlignmentCommand double copterlat = 0; double lng_out1 = 0; double lat_out1 = 0; - for (int i = 0; i < _flightTaskManager.Tasks.Count; i++) + + int itaskendno = taskendno; + if (itaskendno == 0) itaskendno = _flightTaskManager.Tasks.Count - 1; + else itaskendno = taskendno - 1; + if (itaskendno > _flightTaskManager.Tasks.Count-1) itaskendno = _flightTaskManager.Tasks.Count-1; + int _taskstartno = 0; + if (taskstartno == 0) _taskstartno = 0; + else _taskstartno = taskstartno - 1; + + for (int i = _taskstartno; i <= itaskendno; i++) { - for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++) + for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++) { copterlng=_flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetLng; copterlat = _flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetLat; @@ -1554,8 +1593,15 @@ public ICommand VerticlAlignmentCommand float lowalt = 200; - int _startindex = 0; - int _endindex = _flightTaskManager.Tasks.Count-1; + + int itaskendno = taskendno; + if (itaskendno == 0) itaskendno = _flightTaskManager.Tasks.Count - 1; + else itaskendno = taskendno - 1; + if (itaskendno > _flightTaskManager.Tasks.Count-1) itaskendno = _flightTaskManager.Tasks.Count-1; + // for (int i = taskstartno; i < itaskendno; i++) + int _startindex = taskstartno; + if (_startindex != 0) _startindex = taskstartno - 1; + int _endindex = itaskendno ; int lowtask = 0; int lowCopter = 0; @@ -1568,10 +1614,8 @@ public ICommand VerticlAlignmentCommand for (int i = _startindex; i <= _endindex; i++) { - if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff)) + if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff)|| (_flightTaskManager.Tasks[i].TaskType == FlightTaskType.Land)) continue; - - for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++) { _flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetAlt +=(float) cModialtvalue; @@ -1602,44 +1646,85 @@ public ICommand VerticlAlignmentCommand { get { - return _calDistinceCommand ?? (_calDistinceCommand = new RelayCommand(async => + return _calDistinceCommand ?? (_calDistinceCommand = new RelayCommand(async => { if (_copterManager.AcceptingControlCopters.Count() < 2) return; - double minDistance = double.MaxValue; - var flightTask = _flightTaskManager.SelectedTask; - List selectedCopter = new List(); - selectedCopter.AddRange(_copterManager.AcceptingControlCopters); - string minCopterId1 = "0"; - string minCopterId2 = "0"; - for (int i = 0; i < selectedCopter.Count; i++) + + + + string currselectstr = ""; + + for (int tsi = 1; tsi < _flightTaskManager.Tasks.Count ; tsi++) { - var copter1 = selectedCopter[i]; - var copterInfo1 = _flightTaskManager.SelectedTask.SingleCopterInfos.FirstOrDefault(c =>c.Copter == copter1); - - for (int j = i + 1; j < selectedCopter.Count; j++) + + if ((_flightTaskManager.Tasks[tsi].TaskType == FlightTaskType.TakeOff) || (_flightTaskManager.Tasks[tsi].TaskType == FlightTaskType.Land)) + continue; + + + + + double minDistance = double.MaxValue; + double maxDistance = 0.0; + var flightTask = _flightTaskManager.Tasks[tsi]; + List selectedCopter = new List(); + selectedCopter.AddRange(_copterManager.AcceptingControlCopters); + string minCopterId1 = "0"; + string minCopterId2 = "0"; + string maxCopterId1 = "0"; + string maxCopterId2 = "0"; + for (int i = 0; i < selectedCopter.Count; i++) { - var copter2 = selectedCopter[j]; - var copterInfo2 = _flightTaskManager.SelectedTask.SingleCopterInfos.FirstOrDefault(c => c.Copter == copter2); + var copter1 = selectedCopter[i]; + var copterInfo1 = flightTask.SingleCopterInfos.FirstOrDefault(c => c.Copter == copter1); - double distance = GeographyUtils.CalcDistance( - copterInfo1.TargetLat, copterInfo1.TargetLng, copterInfo1.TargetAlt, - copterInfo2.TargetLat, copterInfo2.TargetLng, copterInfo2.TargetAlt); - //minDistance = Math.Min(minDistance, distance); - if (distance < minDistance) + for (int j = i + 1; j < selectedCopter.Count; j++) { - minDistance = distance; - minCopterId1 = copter1.Id; - minCopterId2 = copter2.Id; - } - - } - } + var copter2 = selectedCopter[j]; + var copterInfo2 = flightTask.SingleCopterInfos.FirstOrDefault(c => c.Copter == copter2); + + double distance = GeographyUtils.CalcDistance( + copterInfo1.TargetLat, copterInfo1.TargetLng, copterInfo1.TargetAlt, + copterInfo2.TargetLat, copterInfo2.TargetLng, copterInfo2.TargetAlt); + //minDistance = Math.Min(minDistance, distance); + if (distance < minDistance) + { + minDistance = distance; + minCopterId1 = copter1.Id; + minCopterId2 = copter2.Id; + } + + if (distance > maxDistance) + { + maxDistance = distance; + maxCopterId1 = copter1.Id; + maxCopterId2 = copter2.Id; + } + + } + } + minDistance = Math.Round(minDistance, 2); + maxDistance = Math.Round(maxDistance, 2); + + string showstr = string.Format("[{0}{1}] 最小距离 = {2:F2} 飞机: {3} 和 {4}; 最大距离 = {5:F2} 飞机: {6} 和 {7}", + flightTask.TaskIndex + 1, flightTask.TaskCnName, minDistance, minCopterId1, minCopterId2, maxDistance, + maxCopterId1, maxCopterId2); + + Message.Show(showstr); + + + // Message.Show($"[{0:flightTask.TaskIndex + 1}{flightTask.TaskCnName}]最小距离 = {minDistance} 飞机:{minCopterId1}和{minCopterId2} ; 最大距离 = {maxDistance} 飞机:{maxCopterId1}和{maxCopterId2}"); + if (flightTask == _flightTaskManager.SelectedTask) + currselectstr = showstr; + } + Message.Show("选中任务:"); + Message.Show(currselectstr); + + + - //Distancevalue = minDistance; - Message.Show($"最小距离 = {minDistance} 飞机:{minCopterId1}和{minCopterId2}"); })); } @@ -2221,11 +2306,42 @@ public ICommand VerticlAlignmentCommand if (_copterManager.SelectedCopters.Count() <= 1) return; + List TempSingleCopterInfos = new List(); + //旋转飞机矩阵 if (CopterDirection != 0) { - LevelRotateCommand.Execute(CopterDirection); - await Task.Delay(100); + + var selectedCopter = _copterManager.SelectedCopters.FirstOrDefault(); + if (_flightTaskManager.SelectedTask != null) + { + for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++) + { + //得到每个选择的飞机 + selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter; + //根据飞机查找任务中的位置信息 + foreach (var capter in _copterManager.SelectedCopters) + { + //如果是选择的那架飞机 + if (capter == selectedCopter) + { + FlightTaskSingleCopterInfo vFlightTaskSingleCopterInfo = new FlightTaskSingleCopterInfo(capter); + vFlightTaskSingleCopterInfo.TargetLng = _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLng; + vFlightTaskSingleCopterInfo.TargetAlt = _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetAlt; + vFlightTaskSingleCopterInfo.TargetLat = _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLat; + TempSingleCopterInfos.Add(vFlightTaskSingleCopterInfo); + } + + + } + } + } + + + + + LevelRotateCommand.Execute(CopterDirection); + await Task.Delay(100); } @@ -2290,9 +2406,35 @@ public ICommand VerticlAlignmentCommand } await Task.Delay(100); - //旋转飞机矩阵 - if (CopterDirection != 0) - LevelRotateCommand.Execute(0 - CopterDirection); + + //使用之前保存的位置回到飞机原来的位置,不使用旋转因为转回去和原来的位置有一点点偏差 + if (CopterDirection != 0) + { + + int j = 0; + var selectedCopter1 = _copterManager.SelectedCopters.FirstOrDefault(); + if (_flightTaskManager.SelectedTask != null) + { + for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++) + { + selectedCopter1 = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter; + foreach (var capter in _copterManager.SelectedCopters) + { + if (capter == selectedCopter1) + { + _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLat = TempSingleCopterInfos[j].TargetLat; + _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLng = TempSingleCopterInfos[j].TargetLng; + _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetAlt = TempSingleCopterInfos[j].TargetAlt; + j++; + + } + + + } + } + } + // LevelRotateCommand.Execute(0 - CopterDirection); + } })); } diff --git a/Plane.FormationCreator/Views/ConnectWindow.xaml b/Plane.FormationCreator/Views/ConnectWindow.xaml index 1c4f62e..1fbf3b4 100644 --- a/Plane.FormationCreator/Views/ConnectWindow.xaml +++ b/Plane.FormationCreator/Views/ConnectWindow.xaml @@ -55,9 +55,10 @@ Grid.Row="1" Name="panel4" > - + + diff --git a/Plane.FormationCreator/Views/CopterListView.xaml b/Plane.FormationCreator/Views/CopterListView.xaml index fee2221..59fbe6a 100644 --- a/Plane.FormationCreator/Views/CopterListView.xaml +++ b/Plane.FormationCreator/Views/CopterListView.xaml @@ -91,6 +91,9 @@ + + + diff --git a/Plane.FormationCreator/Views/InputDialog.xaml b/Plane.FormationCreator/Views/InputDialog.xaml new file mode 100644 index 0000000..b71d5da --- /dev/null +++ b/Plane.FormationCreator/Views/InputDialog.xaml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + 15.6 + + + + + + + \ No newline at end of file diff --git a/Plane.FormationCreator/Views/InputDialog.xaml.cs b/Plane.FormationCreator/Views/InputDialog.xaml.cs new file mode 100644 index 0000000..5578a10 --- /dev/null +++ b/Plane.FormationCreator/Views/InputDialog.xaml.cs @@ -0,0 +1,31 @@ +using System; +using System.Windows; + +namespace Plane.FormationCreator.Views +{ + public partial class InputDialog : Window + { + public InputDialog(string question, string defaultAnswer = "") + { + InitializeComponent(); + lblQuestion.Content = question; + txtAnswer.Text = defaultAnswer; + } + + private void btnDialogOk_Click(object sender, RoutedEventArgs e) + { + this.DialogResult = true; + } + + private void Window_ContentRendered(object sender, EventArgs e) + { + txtAnswer.SelectAll(); + txtAnswer.Focus(); + } + + public string Answer + { + get { return txtAnswer.Text; } + } + } +} \ No newline at end of file diff --git a/Plane.FormationCreator/Views/ModifyTaskView.xaml b/Plane.FormationCreator/Views/ModifyTaskView.xaml index b709a26..8bc819a 100644 --- a/Plane.FormationCreator/Views/ModifyTaskView.xaml +++ b/Plane.FormationCreator/Views/ModifyTaskView.xaml @@ -580,28 +580,52 @@ -