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