改名按钮去掉,改成双击页头
页头自动显示选中的任务
This commit is contained in:
parent
d334442d62
commit
f9428fbad2
@ -35,13 +35,10 @@ namespace Plane.FormationCreator.Formation
|
||||
get { return _TaskType; }
|
||||
set
|
||||
{
|
||||
|
||||
Set(nameof(TaskType), ref _TaskType, value);
|
||||
//if (_TaskType != value)
|
||||
{
|
||||
Set(nameof(TaskType), ref _TaskType, value);
|
||||
RaisePropertyChanged(nameof(TaskTypeIndex));
|
||||
RaisePropertyChanged(nameof(TaskCnName));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,7 +73,13 @@ namespace Plane.FormationCreator.Formation
|
||||
//name = (TaskIndex + 1).ToString() + "." + name;
|
||||
return name;
|
||||
}
|
||||
set { Set(nameof(TaskCnName), ref _TaskName, value); }
|
||||
set {
|
||||
|
||||
Set(nameof(TaskCnName), ref _TaskName, value);
|
||||
RaisePropertyChanged(nameof(TaskCnName));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int TaskTypeIndex
|
||||
|
@ -307,6 +307,10 @@ namespace Plane.FormationCreator.Formation
|
||||
SingleCopterInfoChanged?.Invoke(this, new SingleCopterInfoChangedEventArgs(singleCopterInfo));
|
||||
}
|
||||
|
||||
|
||||
public event EventHandler<FlightTaskTypeChangedEventArgs> TaskTypeChanged;
|
||||
public event EventHandler<FlightTaskcnNameChangedEventArgs> TaskcnNameChanged;
|
||||
|
||||
public event EventHandler TasksCleared;
|
||||
|
||||
public void AddTask()
|
||||
@ -382,6 +386,22 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
SelectedTask = newTask;
|
||||
SelectedTaskIndex = Tasks.Count - 1;
|
||||
|
||||
newTask.PropertyChanged+= (sender, e) =>
|
||||
{
|
||||
switch (e.PropertyName)
|
||||
{
|
||||
case nameof(FlightTask.TaskTypeIndex):
|
||||
case nameof(FlightTask.TaskCnName):
|
||||
TaskTypeChanged?.Invoke(this, new FlightTaskTypeChangedEventArgs((FlightTask)sender));
|
||||
TaskcnNameChanged?.Invoke(this, new FlightTaskcnNameChangedEventArgs((FlightTask)sender));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2173,6 +2193,32 @@ namespace Plane.FormationCreator.Formation
|
||||
public FlightTask AddedTask { get; set; }
|
||||
}
|
||||
|
||||
public class FlightTaskTypeChangedEventArgs : EventArgs
|
||||
{
|
||||
public FlightTaskTypeChangedEventArgs(FlightTask changedFlightTask)
|
||||
{
|
||||
this.ChangedFlightTask = changedFlightTask;
|
||||
}
|
||||
public FlightTask ChangedFlightTask { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class FlightTaskcnNameChangedEventArgs : EventArgs
|
||||
{
|
||||
public FlightTaskcnNameChangedEventArgs(FlightTask changedFlightTask)
|
||||
{
|
||||
this.ChangedFlightTask = changedFlightTask;
|
||||
}
|
||||
public FlightTask ChangedFlightTask { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class FlightTaskAddedOriginalEventArgs : EventArgs
|
||||
{
|
||||
public double Lat { get; set; }
|
||||
|
@ -91,7 +91,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Background="{Binding Status, Converter={StaticResource FlightTaskStatusToFillConverter}}"
|
||||
Width="90"
|
||||
Width="88"
|
||||
Height="19"
|
||||
BorderThickness="1"
|
||||
BorderBrush="Black"
|
||||
@ -135,19 +135,26 @@
|
||||
|
||||
|
||||
|
||||
<TabItem Header="起飞" x:Name="takeoffpage">
|
||||
<TabItem Header="1 起飞" x:Name="takeoffpage">
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="起飞时间"/>
|
||||
<TextBox Grid.Column="1" Margin="2"
|
||||
<TextBlock Text="起飞时间:" Margin="2" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Column="1" Margin="2" VerticalAlignment="Center"
|
||||
Text="{Binding TakeOffTime, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
|
||||
</TabItem>
|
||||
<TabItem Header="航点" x:Name="flytopage">
|
||||
<TabItem x:Name="flytopage" >
|
||||
|
||||
<TabItem.Header>
|
||||
<Label x:Name="flytoLabel" Content="航点" HorizontalAlignment="Stretch" MouseLeftButtonDown="TaskLabelLeftButtonDown"
|
||||
ToolTip="双击修改名称" />
|
||||
</TabItem.Header>
|
||||
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
@ -157,12 +164,12 @@
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="飞行时间: " />
|
||||
<TextBox Grid.Column="1" Margin="2"
|
||||
<TextBlock Grid.Row="0" Margin="2" Text="飞行时间: " VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="1" Margin="2" VerticalAlignment="Center"
|
||||
MaxLength="4"
|
||||
Text="{Binding FlytoTime, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Grid.Row="1" Text="悬停时间: " />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="2"
|
||||
<TextBlock Grid.Row="1" Margin="2" Text="悬停时间: " VerticalAlignment="Center" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="2" VerticalAlignment="Center"
|
||||
MaxLength="4"
|
||||
Text="{Binding LoiterTime, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
@ -186,7 +193,7 @@
|
||||
<StackPanel Grid.Row="1"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Bottom">
|
||||
<Button Content="添加"
|
||||
<Button Content="添加" x:Name="addtaskbtn"
|
||||
Background="#232323"
|
||||
Command="{Binding AddTaskCommand}" />
|
||||
<Button Content="清除"
|
||||
@ -196,10 +203,10 @@
|
||||
Background="#232323"
|
||||
Command="{Binding ResetTasksCommand}" />
|
||||
|
||||
<Button Content="更名"
|
||||
<Button Content="更名" Visibility="Collapsed"
|
||||
Background="#232323"
|
||||
Command="{Binding renametaskCommand}" />
|
||||
<Button Content="设原点"
|
||||
<Button Content="原点"
|
||||
Background="#232323"
|
||||
Command="{Binding SetOriginCommand}" />
|
||||
<!--<Button Content="保存" />
|
||||
|
@ -33,8 +33,22 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
hintaddtask.Visibility = Visibility.Visible;
|
||||
tasktabcont.Visibility = Visibility.Collapsed;
|
||||
_flightTaskManager.TaskTypeChanged += (sender, e) =>
|
||||
{
|
||||
if (e.ChangedFlightTask.TaskType == FlightTaskType.Land)
|
||||
addtaskbtn.IsEnabled = false;
|
||||
else addtaskbtn.IsEnabled = true;
|
||||
};
|
||||
|
||||
|
||||
_flightTaskManager.TaskcnNameChanged += (sender, e) =>
|
||||
{
|
||||
if (e.ChangedFlightTask.TaskType == FlightTaskType.Land)
|
||||
flytoLabel.Content = (_flightTaskManager.SelectedTaskIndex + 1) + " 航点";
|
||||
else
|
||||
flytoLabel.Content = (_flightTaskManager.SelectedTaskIndex + 1) + " " + _flightTaskManager.Tasks[_flightTaskManager.SelectedTaskIndex].TaskCnName;
|
||||
};
|
||||
|
||||
|
||||
_flightTaskManager.PropertyChanged += (sender, e) =>
|
||||
{
|
||||
@ -44,10 +58,9 @@ namespace Plane.FormationCreator.Views
|
||||
case nameof(FlightTaskManager.SelectedTaskIndex):
|
||||
if (_flightTaskManager.Tasks.Count == 0)
|
||||
{
|
||||
|
||||
tasktabcont.Visibility = Visibility.Collapsed;
|
||||
hintaddtask.Visibility = Visibility.Visible;
|
||||
|
||||
addtaskbtn.IsEnabled = true;
|
||||
|
||||
}
|
||||
else
|
||||
@ -60,6 +73,16 @@ namespace Plane.FormationCreator.Views
|
||||
takeoffpage.Visibility = Visibility.Visible;
|
||||
landpage.Visibility = Visibility.Collapsed;
|
||||
flytopage.Visibility = Visibility.Collapsed;
|
||||
}else
|
||||
if (_flightTaskManager.SelectedTaskIndex < (_flightTaskManager.Tasks.Count - 1))
|
||||
{
|
||||
takeoffpage.Visibility = Visibility.Collapsed;
|
||||
landpage.Visibility = Visibility.Collapsed;
|
||||
flytopage.Visibility = Visibility.Visible;
|
||||
|
||||
flytoLabel.Content = (_flightTaskManager.SelectedTaskIndex+1)+" "+ _flightTaskManager.Tasks[_flightTaskManager.SelectedTaskIndex].TaskCnName;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -68,12 +91,21 @@ namespace Plane.FormationCreator.Views
|
||||
landpage.Visibility = Visibility.Visible;
|
||||
flytopage.Visibility = Visibility.Visible;
|
||||
|
||||
|
||||
if (_flightTaskManager.Tasks[_flightTaskManager.SelectedTaskIndex].TaskType!= FlightTaskType.Land)
|
||||
flytoLabel.Content = (_flightTaskManager.SelectedTaskIndex + 1) + " " + _flightTaskManager.Tasks[_flightTaskManager.SelectedTaskIndex].TaskCnName;
|
||||
else
|
||||
flytoLabel.Content = (_flightTaskManager.SelectedTaskIndex + 1) + " 航点";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// case nameof(FlightTaskManager.SelectedTask .TaskTypeIndex):
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -86,7 +118,7 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
private FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
|
||||
|
||||
//用于更名
|
||||
//用于直接飞到航点
|
||||
public void TaskLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ClickCount > 1)
|
||||
@ -97,10 +129,27 @@ namespace Plane.FormationCreator.Views
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//用于更名
|
||||
public void TaskLabelLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ClickCount > 1)
|
||||
{
|
||||
FlightTask task = _flightTaskManager.SelectedTask;
|
||||
if ((task == null) || (task.TaskType != FlightTaskType.FlyTo)) return;
|
||||
|
||||
string newName = task.TaskCnName;
|
||||
if (PlaneMessageBox.OnShow("请输入新的名称", "重命名", ref newName))
|
||||
{
|
||||
task.TaskCnName = newName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//选择任务
|
||||
private void SelectTask(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
@ -117,7 +166,7 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
}
|
||||
|
||||
//右键功能 ---改名
|
||||
//右键功能 ---隐藏航点
|
||||
private void HideTask(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var elem = sender as FrameworkElement;
|
||||
|
Loading…
Reference in New Issue
Block a user