一些调整,已做了较多测试,基本稳定版本
[FlightTaskManager.cs]加入强制下一个 [ModifyTaskViewModel.cs]加入调整所有任务高度 [MapView.xaml.cs]加入是否显示所有点
This commit is contained in:
parent
bdad49ce6d
commit
70e70e182c
@ -16,10 +16,18 @@ namespace Plane.FormationCreator.Converters
|
|||||||
{
|
{
|
||||||
static SolidColorBrush _normalFill = new SolidColorBrush(Colors.LightGray);
|
static SolidColorBrush _normalFill = new SolidColorBrush(Colors.LightGray);
|
||||||
static SolidColorBrush _runningFill = new SolidColorBrush(Colors.OrangeRed);
|
static SolidColorBrush _runningFill = new SolidColorBrush(Colors.OrangeRed);
|
||||||
|
static SolidColorBrush _PausedFill = new SolidColorBrush(Colors.Yellow);
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
var status = (FlightTaskStatus)value;
|
var status = (FlightTaskStatus)value;
|
||||||
return status == FlightTaskStatus.Running ? _runningFill : _normalFill;
|
if (status == FlightTaskStatus.Running)
|
||||||
|
return _runningFill;
|
||||||
|
|
||||||
|
if (status == FlightTaskStatus.Paused)
|
||||||
|
return _PausedFill;
|
||||||
|
|
||||||
|
|
||||||
|
return _normalFill;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
@ -22,7 +22,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
|
|
||||||
private ILogger _logger = ServiceLocator.Current.GetInstance<ILogger>();
|
private ILogger _logger = ServiceLocator.Current.GetInstance<ILogger>();
|
||||||
|
|
||||||
private FlightTaskStatus _Status = FlightTaskStatus.Created;
|
private FlightTaskStatus _Status = FlightTaskStatus.Stop;
|
||||||
public FlightTaskStatus Status
|
public FlightTaskStatus Status
|
||||||
{
|
{
|
||||||
get { return _Status; }
|
get { return _Status; }
|
||||||
|
@ -189,6 +189,14 @@ namespace Plane.FormationCreator.Formation
|
|||||||
private set { Set(nameof(CurrentRunningTaskIndex), ref _CurrentRunningTaskIndex, value); }
|
private set { Set(nameof(CurrentRunningTaskIndex), ref _CurrentRunningTaskIndex, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private TasksStatus _TaskState = TasksStatus.Stop;
|
||||||
|
public TasksStatus TaskState
|
||||||
|
{
|
||||||
|
get { return _TaskState; }
|
||||||
|
private set { Set(nameof(TaskState), ref _TaskState, value); }
|
||||||
|
}
|
||||||
|
|
||||||
public event EventHandler<FlightTaskAddedEventArgs> TaskAdded;
|
public event EventHandler<FlightTaskAddedEventArgs> TaskAdded;
|
||||||
|
|
||||||
public event EventHandler<SingleCopterInfoChangedEventArgs> SingleCopterInfoChanged;
|
public event EventHandler<SingleCopterInfoChangedEventArgs> SingleCopterInfoChanged;
|
||||||
@ -288,14 +296,33 @@ namespace Plane.FormationCreator.Formation
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ForceNextTasks()
|
|
||||||
|
public async Task ForceNextTasks()
|
||||||
{
|
{
|
||||||
|
if (CurrentRunningTaskIndex == Tasks.Count - 1)
|
||||||
|
return;
|
||||||
|
|
||||||
Pause();
|
Pause();
|
||||||
//起飞任务需要跳过
|
int i = 0;
|
||||||
if (CurrentRunningTaskIndex == 0)
|
//等待暂停或2s超时(80*25ms)
|
||||||
|
while ((TaskState != TasksStatus.Paused)||(i>80))
|
||||||
|
{
|
||||||
|
await Task.Delay(25).ConfigureAwait(false);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TaskState == TasksStatus.Paused)
|
||||||
|
{
|
||||||
|
CurrentRunningTask.Status = FlightTaskStatus.Stop;
|
||||||
|
CurrentRunningTask = null;
|
||||||
|
|
||||||
|
//起飞任务需要跳过
|
||||||
|
if (CurrentRunningTaskIndex == 0)
|
||||||
|
CurrentRunningTaskIndex++;
|
||||||
CurrentRunningTaskIndex++;
|
CurrentRunningTaskIndex++;
|
||||||
CurrentRunningTaskIndex++;
|
await RunTaskAsync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ResetTasks()
|
public void ResetTasks()
|
||||||
{
|
{
|
||||||
@ -303,7 +330,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
CurrentRunningTaskIndex = 0;
|
CurrentRunningTaskIndex = 0;
|
||||||
if (CurrentRunningTask != null)
|
if (CurrentRunningTask != null)
|
||||||
{
|
{
|
||||||
CurrentRunningTask.Status = FlightTaskStatus.Saved;
|
CurrentRunningTask.Status = FlightTaskStatus.Stop;
|
||||||
CurrentRunningTask = null;
|
CurrentRunningTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -914,25 +941,41 @@ namespace Plane.FormationCreator.Formation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task RunTaskAsync()
|
||||||
|
|
||||||
|
{
|
||||||
|
Message.Show("任务开始");
|
||||||
|
await RunAsync();
|
||||||
|
if ((IsPaused ?? false) == false)
|
||||||
|
Message.Show("任务完成");
|
||||||
|
}
|
||||||
|
|
||||||
public async Task RunAsync()
|
public async Task RunAsync()
|
||||||
{
|
{
|
||||||
IsPaused = false;
|
IsPaused = false;
|
||||||
AppEx.Current.AppMode = AppMode.RunningTasks;
|
AppEx.Current.AppMode = AppMode.RunningTasks;
|
||||||
StartAvoidingCrash(); //开始碰撞检测
|
StartAvoidingCrash(); //开始碰撞检测
|
||||||
|
TaskState = TasksStatus.Running;
|
||||||
for (int i = CurrentRunningTaskIndex; i < Tasks.Count; i++)
|
for (int i = CurrentRunningTaskIndex; i < Tasks.Count; i++)
|
||||||
{
|
{
|
||||||
var task = Tasks[i];
|
var task = Tasks[i];
|
||||||
|
//task.Status目前只用于任务条下面状态显示不同颜色
|
||||||
task.Status = FlightTaskStatus.Running;
|
task.Status = FlightTaskStatus.Running;
|
||||||
CurrentRunningTask = task;
|
CurrentRunningTask = task;
|
||||||
CurrentRunningTaskIndex = i;
|
CurrentRunningTaskIndex = i;
|
||||||
await task.RunAsync().ConfigureAwait(false);
|
await task.RunAsync().ConfigureAwait(false);
|
||||||
// 1. 被暂停时,中断 RunAsync。继续运行时将把此时运行了一半的 CurrentRunningTask 重新运行一遍。
|
// 1. 被暂停时,中断 RunAsync。继续运行时将把此时运行了一半的 CurrentRunningTask 重新运行一遍。
|
||||||
if (IsPaused == true) return;
|
if (IsPaused == true)
|
||||||
|
{
|
||||||
task.Status = FlightTaskStatus.Saved;
|
task.Status = FlightTaskStatus.Paused;
|
||||||
|
TaskState = TasksStatus.Paused;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
task.Status = FlightTaskStatus.Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 正常结束时,重置 CurrentRunningTask、CurrentRunningTaskIndex 和 IsPaused。
|
// 2. 正常结束时,重置 CurrentRunningTask、CurrentRunningTaskIndex 和 IsPaused。
|
||||||
|
TaskState = TasksStatus.Stop;
|
||||||
CurrentRunningTask = null;
|
CurrentRunningTask = null;
|
||||||
CurrentRunningTaskIndex = 0;
|
CurrentRunningTaskIndex = 0;
|
||||||
IsPaused = null;
|
IsPaused = null;
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
public enum FlightTaskStatus
|
public enum FlightTaskStatus
|
||||||
{
|
{
|
||||||
Created,
|
Stop,
|
||||||
Saved,
|
Running,
|
||||||
Running
|
Paused
|
||||||
|
}
|
||||||
|
public enum TasksStatus
|
||||||
|
{
|
||||||
|
Stop,
|
||||||
|
Running,
|
||||||
|
Paused
|
||||||
}
|
}
|
@ -163,10 +163,10 @@ namespace Plane.FormationCreator.Formation
|
|||||||
//{
|
//{
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
//5秒内每1000毫秒尝试解锁一次
|
//8秒内每1000毫秒尝试解锁一次
|
||||||
//解锁间隔一定要超过1s否则导致飞控以后无法解锁
|
//解锁间隔一定要超过1s否则导致飞控以后无法解锁
|
||||||
|
|
||||||
if (i > 200)
|
if (i > 320)
|
||||||
return; //无法解锁后面不用执行了
|
return; //无法解锁后面不用执行了
|
||||||
if (i % (1000 / 25) == 1000 / 25 - 1)
|
if (i % (1000 / 25) == 1000 / 25 - 1)
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,8 @@
|
|||||||
<v:MapView x:Name="map"
|
<v:MapView x:Name="map"
|
||||||
/>
|
/>
|
||||||
<v:TaskBarView
|
<v:TaskBarView
|
||||||
VerticalAlignment="Bottom"
|
x:Name="TaskbarControl"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
Visibility="{Binding Source={x:Static local:AppEx.Current}, Path=AppMode, Converter={StaticResource AppModeToVisibilityConverter}, ConverterParameter=TaskBarView}" />
|
Visibility="{Binding Source={x:Static local:AppEx.Current}, Path=AppMode, Converter={StaticResource AppModeToVisibilityConverter}, ConverterParameter=TaskBarView}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
@ -255,12 +255,13 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
{
|
{
|
||||||
await SingleCopter.UnlockAsync();
|
await SingleCopter.UnlockAsync();
|
||||||
await Task.Delay(25).ConfigureAwait(false);
|
await Task.Delay(25).ConfigureAwait(false);
|
||||||
|
|
||||||
for (int i = 0; !SingleCopter.IsUnlocked; i++)
|
for (int i = 0; !SingleCopter.IsUnlocked; i++)
|
||||||
{
|
{
|
||||||
//5秒内每1000毫秒尝试解锁一次
|
//8秒内每1000毫秒尝试解锁一次
|
||||||
//解锁间隔一定要超过1s否则导致飞控以后无法解锁
|
//解锁间隔一定要超过1s否则导致飞控以后无法解锁
|
||||||
|
|
||||||
if (i > 200)
|
if (i >320)
|
||||||
return; //无法解锁后面不用执行了
|
return; //无法解锁后面不用执行了
|
||||||
if (i % (1000 / 25) == 1000 / 25 - 1)
|
if (i % (1000 / 25) == 1000 / 25 - 1)
|
||||||
{
|
{
|
||||||
@ -268,6 +269,7 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
}
|
}
|
||||||
await Task.Delay(25).ConfigureAwait(false);
|
await Task.Delay(25).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
if (SingleCopter.IsUnlocked)
|
if (SingleCopter.IsUnlocked)
|
||||||
@ -284,10 +286,10 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
await Task.Delay(25).ConfigureAwait(false);
|
await Task.Delay(25).ConfigureAwait(false);
|
||||||
for (int i = 0; SingleCopter.IsUnlocked; i++)
|
for (int i = 0; SingleCopter.IsUnlocked; i++)
|
||||||
{
|
{
|
||||||
//5秒内每1000毫秒尝试解锁一次
|
//8秒内每1000毫秒尝试解锁一次
|
||||||
//解锁间隔一定要超过1s否则导致飞控以后无法解锁
|
//解锁间隔一定要超过1s否则导致飞控以后无法解锁
|
||||||
|
|
||||||
if (i > 200)
|
if (i > 320)
|
||||||
return; //无法解锁后面不用执行了
|
return; //无法解锁后面不用执行了
|
||||||
if (i % (1000 / 25) == 1000 / 25 - 1)
|
if (i % (1000 / 25) == 1000 / 25 - 1)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Plane.Geography;
|
using Plane.Geography;
|
||||||
|
using Plane.Windows.Messages;
|
||||||
|
|
||||||
namespace Plane.FormationCreator.ViewModels
|
namespace Plane.FormationCreator.ViewModels
|
||||||
{
|
{
|
||||||
@ -150,6 +151,15 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
set { Set(nameof(Distancevalue), ref _Distancevalue, value); }
|
set { Set(nameof(Distancevalue), ref _Distancevalue, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private float _Modialtvalue;
|
||||||
|
public float Modialtvalue
|
||||||
|
{
|
||||||
|
get { return _Modialtvalue; }
|
||||||
|
set { Set(nameof(Modialtvalue), ref _Modialtvalue, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private int _txtStarindex=0;
|
private int _txtStarindex=0;
|
||||||
public int txtStarindex
|
public int txtStarindex
|
||||||
{
|
{
|
||||||
@ -863,6 +873,59 @@ public ICommand VerticlAlignmentCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//调整所有任务高度
|
||||||
|
private ICommand _ModiAltCommand;
|
||||||
|
public ICommand ModiAltCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _ModiAltCommand ?? (_ModiAltCommand = new RelayCommand<double>(async =>
|
||||||
|
{
|
||||||
|
if (_flightTaskManager.Tasks.Count < 2) return;
|
||||||
|
|
||||||
|
float lowalt = 200;
|
||||||
|
|
||||||
|
|
||||||
|
int _startindex = 0;
|
||||||
|
int _endindex = _flightTaskManager.Tasks.Count-1;
|
||||||
|
int lowtask = 0;
|
||||||
|
int lowCopter = 0;
|
||||||
|
|
||||||
|
if ((txtStarindex != 0) && (txtendindex != 0))
|
||||||
|
{
|
||||||
|
_startindex = txtStarindex;
|
||||||
|
_endindex = txtendindex;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = _startindex; i <= _endindex; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff) ||
|
||||||
|
(_flightTaskManager.Tasks[i].TaskType == FlightTaskType.ReturnToLand))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++)
|
||||||
|
{
|
||||||
|
_flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetAlt += Modialtvalue;
|
||||||
|
if (lowalt > _flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetAlt)
|
||||||
|
{
|
||||||
|
lowalt = _flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetAlt;
|
||||||
|
lowtask = i;
|
||||||
|
lowCopter = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Alert.Show("指定步骤任务高度已改变"+ Modialtvalue + "米,步骤["+ lowtask + "],ID["+
|
||||||
|
_flightTaskManager.Tasks[lowtask].SingleCopterInfos[lowCopter].Copter.Id
|
||||||
|
+ "]最低飞行高度"+ lowalt + "米,注意是否太低!");
|
||||||
|
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -880,6 +943,8 @@ public ICommand VerticlAlignmentCommand
|
|||||||
double distance = 0;
|
double distance = 0;
|
||||||
|
|
||||||
var selectedCopter = _copterManager.SelectedCopters.FirstOrDefault();
|
var selectedCopter = _copterManager.SelectedCopters.FirstOrDefault();
|
||||||
|
if (_flightTaskManager.SelectedTask == null) return;
|
||||||
|
|
||||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -54,9 +54,10 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _NextTasksCommand ?? (_NextTasksCommand = new RelayCommand( () =>
|
return _NextTasksCommand ?? (_NextTasksCommand = new RelayCommand(async () =>
|
||||||
{
|
{
|
||||||
_flightTaskManager.ForceNextTasks();
|
// await _flightTaskManager.RunAsync();
|
||||||
|
await _flightTaskManager.ForceNextTasks();
|
||||||
// Message.Show("任务开始");
|
// Message.Show("任务开始");
|
||||||
// await _flightTaskManager.RunAsync();
|
// await _flightTaskManager.RunAsync();
|
||||||
// Message.Show(_flightTaskManager.IsPaused == true ? "任务暂停" : "任务完成");
|
// Message.Show(_flightTaskManager.IsPaused == true ? "任务暂停" : "任务完成");
|
||||||
@ -101,10 +102,7 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
// });
|
// });
|
||||||
// Alert.Show(s);
|
// Alert.Show(s);
|
||||||
// return;
|
// return;
|
||||||
Message.Show("任务开始");
|
await _flightTaskManager.RunTaskAsync();
|
||||||
await _flightTaskManager.RunAsync();
|
|
||||||
if ((_flightTaskManager.IsPaused ?? false) == false)
|
|
||||||
Message.Show("任务完成");
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
>
|
>
|
||||||
|
<CheckBox Grid.Row="0" Content="所有航点" Margin="5,5,0,0"
|
||||||
|
Click="showallpoint_Checked"
|
||||||
|
Foreground="White"
|
||||||
|
/>
|
||||||
<CheckBox Grid.Row="0" Content="计划航线" Margin="5,5,0,0"
|
<CheckBox Grid.Row="0" Content="计划航线" Margin="5,5,0,0"
|
||||||
Click="showpanline_Checked"
|
Click="showpanline_Checked"
|
||||||
Foreground="White"
|
Foreground="White"
|
||||||
|
@ -293,6 +293,28 @@ namespace Plane.FormationCreator.Views
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showallpoint_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CheckBox chk = (CheckBox)sender;
|
||||||
|
bool ischecked= chk.IsChecked ?? false;
|
||||||
|
|
||||||
|
foreach (var taskitme in _flightTaskManager.Tasks)
|
||||||
|
{
|
||||||
|
// if taskitme.IsRightSelected = chk.IsChecked ?? true;
|
||||||
|
|
||||||
|
if ((taskitme.IsRightSelected == ischecked) && (!taskitme.IsSelected))
|
||||||
|
{
|
||||||
|
_flightTaskManager.RightSelect(taskitme);
|
||||||
|
// TaskbarControl.setRightSelect(taskitme, ischecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void showpanline_Checked(object sender, RoutedEventArgs e)
|
private void showpanline_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignWidth="300" Height="420">
|
d:DesignWidth="300" Height="420">
|
||||||
|
|
||||||
<StackPanel Orientation="Vertical" Margin="0,0,0,-28.5">
|
<StackPanel Orientation="Vertical" Margin="0,0,0,-30">
|
||||||
<StackPanel.Resources>
|
<StackPanel.Resources>
|
||||||
<Style TargetType="StackPanel">
|
<Style TargetType="StackPanel">
|
||||||
<Setter Property="Orientation"
|
<Setter Property="Orientation"
|
||||||
@ -28,7 +28,7 @@
|
|||||||
Margin="5,5,0,0"
|
Margin="5,5,0,0"
|
||||||
Command="{Binding ImportTasksCommand}"
|
Command="{Binding ImportTasksCommand}"
|
||||||
/>
|
/>
|
||||||
<TextBlock Text="导入起始" Margin="5, 10, 5, 0"/>
|
<TextBlock Text="起始步骤" Margin="5, 10, 5, 0"/>
|
||||||
<TextBox x:Name="txtStarindex"
|
<TextBox x:Name="txtStarindex"
|
||||||
Width="45"
|
Width="45"
|
||||||
Margin="0,5,5,0"
|
Margin="0,5,5,0"
|
||||||
@ -122,6 +122,23 @@
|
|||||||
Margin="0,5,5,0"
|
Margin="0,5,5,0"
|
||||||
Command="{Binding PrealtCommand}" />
|
Command="{Binding PrealtCommand}" />
|
||||||
|
|
||||||
|
<Button Content="修改任务高度"
|
||||||
|
Margin="0,5,5,0"
|
||||||
|
Command="{Binding ModiAltCommand}"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="40"
|
||||||
|
Margin="0, 5, 5, 0"
|
||||||
|
HorizontalContentAlignment="Right"
|
||||||
|
Text="{Binding Modialtvalue, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
/>
|
||||||
|
<TextBlock Text="米" Margin="0, 10, 5, 0"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Separator />
|
<Separator />
|
||||||
|
@ -72,7 +72,8 @@
|
|||||||
|
|
||||||
<ItemsControl Grid.Column="1"
|
<ItemsControl Grid.Column="1"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
ItemsSource="{Binding Tasks}">
|
ItemsSource="{Binding Tasks}"
|
||||||
|
Name="TasksControl">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<WrapPanel Orientation="Horizontal" />
|
<WrapPanel Orientation="Horizontal" />
|
||||||
@ -80,7 +81,7 @@
|
|||||||
</ItemsControl.ItemsPanel>
|
</ItemsControl.ItemsPanel>
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid>
|
<Grid x:Name="itemgrid">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
@ -41,7 +41,53 @@ namespace Plane.FormationCreator.Views
|
|||||||
_flightTaskManager.Select(task);
|
_flightTaskManager.Select(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRightSelect(FlightTask task, bool vRightSelect)
|
||||||
|
{
|
||||||
|
|
||||||
|
// var borderBrush = new SolidColorBrush(vRightSelect ? Colors.Gray : Colors.OrangeRed);
|
||||||
|
var borderBrush = new SolidColorBrush( Colors.OrangeRed);
|
||||||
|
|
||||||
|
if (task.TaskType == FlightTaskType.TakeOff) return;
|
||||||
|
|
||||||
|
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(TasksControl); i++)
|
||||||
|
{
|
||||||
|
DependencyObject child = VisualTreeHelper.GetChild(TasksControl, i);
|
||||||
|
if (child != null && child is FrameworkElement)
|
||||||
|
{
|
||||||
|
var taskdata = (child as FrameworkElement).DataContext as FlightTask;
|
||||||
|
if (taskdata == task)
|
||||||
|
{
|
||||||
|
if (child is Rectangle)
|
||||||
|
{
|
||||||
|
(child as Rectangle).Stroke = borderBrush;
|
||||||
|
}
|
||||||
|
else if (child is Border)
|
||||||
|
{
|
||||||
|
(child as Border).BorderBrush = borderBrush;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
if (elem is Rectangle)
|
||||||
|
{
|
||||||
|
(elem as Rectangle).Stroke = borderBrush;
|
||||||
|
}
|
||||||
|
else if (elem is Border)
|
||||||
|
{
|
||||||
|
(elem as Border).BorderBrush = borderBrush;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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