调整设置界面

任务右键改为隐藏\显示航点
This commit is contained in:
xu 2020-02-04 03:04:14 +08:00
parent 5c6cf9ecdb
commit 08ff8c7772
4 changed files with 41 additions and 18 deletions

View File

@ -86,7 +86,7 @@ namespace Plane.FormationCreator.ViewModels
{
return _SendCommand ?? (_SendCommand = new RelayCommand(async () =>
{
await SendCommandAsync(CopterNum);
await SendCommandAsync(CopterSum);
}
));
}
@ -125,7 +125,14 @@ namespace Plane.FormationCreator.ViewModels
set { Set(nameof(CopterNum), ref _CopterNum, value); }
}
private string _CopterColor = "";
private int _CopterSum=100;
public int CopterSum
{
get { return _CopterSum; }
set { Set(nameof(CopterSum), ref _CopterSum, value); }
}
private string _CopterColor = "FFFFFF";
public string CopterColor
{
get { return _CopterColor; }
@ -234,9 +241,15 @@ namespace Plane.FormationCreator.ViewModels
{
return _TestFireCommandAsync ?? (_TestFireCommandAsync = new RelayCommand(async () =>
{
int channel = int.Parse(CopterColor);
if (channel >= 0 && channel <= 4)
await commModule.TestFire((short)CopterNum, channel);
try
{
int channel = int.Parse(CopterColor);
if (channel >= 0 && channel <= 4)
await commModule.TestFire((short)CopterNum, channel);
}
catch
{ }
}
));
}

View File

@ -51,6 +51,16 @@ namespace Plane.FormationCreator.ViewModels
case nameof(FlightTaskManager.SelectedTaskIndex):
SelectTask();
break;
case nameof(FlightTaskManager.RightSelectedTaskIndex): // 单击右键触发清除航点
int taskIndexTmp = Math.Abs(_flightTaskManager.RightSelectedTaskIndex);
if (_flightTaskManager.Tasks[taskIndexTmp].IsRightSelected)
{
if (waypointGroup == null) waypointGroup = new Model3DGroup();
waypointGroup.Children.Clear();
}
else SelectTask();
break;
default:
break;
}

View File

@ -37,19 +37,25 @@
HorizontalAlignment="Left"
Grid.Row="0"
Name="panel2" >
<TextBlock Margin="5" VerticalAlignment="Center" Text="总数:" />
<TextBox Width="45" VerticalContentAlignment="Center" Text="{Binding CopterSum}" Margin="5,5,5,5" />
<Button Content="设置总数" Width="90" Margin="5,5,5,5" Command="{Binding Path=SendCommand}" />
<Button Content="切换写航点" Width="90" Margin="5,5,5,5" Command="{Binding Path=ChangeWriteMissionCommand}" />
<Button Content="通信状态" Width="90" Margin="5,5,5,5" Command="{Binding StateInquireCommand}"/>
</StackPanel>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Left"
Grid.Row="1" >
<TextBox Width="90" VerticalContentAlignment="Center" Text="{Binding CopterNum}" Margin="5,5,5,5" />
<Button Content="对频" Width="90" Margin="5,5,5,5" Command="{Binding Path=WriteIdCommand}" />
<Button Content="闪灯 " Width="90" Margin="5,5,5,5" Command="{Binding CommDataAsync}"/>
<Button Content="拉烟" Width="90" Margin="5,5,5,5" Command="{Binding TestFireCommandAsync}"/>
<TextBox Width="50" VerticalContentAlignment="Center" Text="{Binding CopterColor}" Margin="5,5,5,5"/>
<TextBlock Margin="5" VerticalAlignment="Center" Text="ID:" />
<TextBox Width="30" VerticalContentAlignment="Center" Text="{Binding CopterNum}" Margin="5,5,5,5" />
<TextBlock Margin="5" VerticalAlignment="Center" Text="参数:" />
<TextBox Width="56" VerticalContentAlignment="Center" Text="{Binding CopterColor}" Margin="5,5,5,5"/>
<Button Content="对频" Width="67" Margin="5,5,5,5" Command="{Binding Path=WriteIdCommand}" />
<Button Content="闪灯 " Width="67" Margin="5,5,5,5" Command="{Binding CommDataAsync}"/>
<Button Content="拉烟" Width="67" Margin="5,5,5,5" Command="{Binding TestFireCommandAsync}"/>
</StackPanel>
<StackPanel Orientation="Horizontal"

View File

@ -122,14 +122,8 @@ namespace Plane.FormationCreator.Views
{
var elem = sender as FrameworkElement;
var task = elem.DataContext as FlightTask;
if (task.TaskType != FlightTaskType.FlyTo) return;
TasksControl.Focus();
string newName = task.TaskCnName;
if (PlaneMessageBox.OnShow("请输入新的名称", "重命名", ref newName))
{
task.TaskCnName = newName;
}
_flightTaskManager.RightSelect(task);
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)