飞机列表右键增加显示虚拟编号和飞机编号的切换,同时自动排序
This commit is contained in:
parent
ffe6b466fe
commit
e8d17e29d1
@ -170,6 +170,15 @@ namespace Plane.FormationCreator.ViewModels
|
||||
{
|
||||
_copterManager.sortbyvid();
|
||||
|
||||
|
||||
foreach (var copter in _copterManager.Copters)
|
||||
{
|
||||
copter.DisplayVirtualId = true;
|
||||
copter.DisplayID = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
||||
@ -180,9 +189,14 @@ namespace Plane.FormationCreator.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SortbyVIdCommand ?? (_SortbyVIdCommand = new RelayCommand(() =>
|
||||
return _SortbyIdCommand ?? (_SortbyVIdCommand = new RelayCommand(() =>
|
||||
{
|
||||
_copterManager.sortbyid();
|
||||
foreach (var copter in _copterManager.Copters)
|
||||
{
|
||||
copter.DisplayVirtualId = false;
|
||||
copter.DisplayID = true;
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
@ -223,6 +237,31 @@ namespace Plane.FormationCreator.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private ICommand _ShowAllIDCommand;
|
||||
public ICommand ShowAllIDCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ShowAllIDCommand ?? (_ShowAllIDCommand = new RelayCommand(() =>
|
||||
{
|
||||
foreach (var copter in _copterManager.Copters)
|
||||
{
|
||||
copter.DisplayVirtualId = true;
|
||||
copter.DisplayID = true;
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private ICommand _AddVirtualCopterCommand;
|
||||
public ICommand AddVirtualCopterCommand
|
||||
{
|
||||
|
@ -10,23 +10,26 @@
|
||||
d:DesignHeight="600"
|
||||
d:DesignWidth="300">
|
||||
<UserControl.Resources>
|
||||
|
||||
|
||||
<ContextMenu x:Key="CoptersMenu" >
|
||||
<MenuItem Header="只显示当前选中"
|
||||
<MenuItem Header="显示当前选中"
|
||||
Foreground="White"
|
||||
Command="{Binding OnlyShowSelectedCoptersCommand}"/>
|
||||
<MenuItem Header="显示所有飞机"
|
||||
Foreground="White"
|
||||
Command="{Binding ShowAllCoptersCommand}"/>
|
||||
<MenuItem Header="显示自动编号"
|
||||
<MenuItem Header="显示所有编号"
|
||||
Foreground="White"
|
||||
Command="{Binding SwitchIdVirtualIdCommand}"/>
|
||||
<MenuItem Header="按自动编号排序"
|
||||
Command="{Binding ShowAllIDCommand}"/>
|
||||
<MenuItem Header="显示虚拟编号"
|
||||
Foreground="White"
|
||||
Command="{Binding SortbyVIdCommand}"/>
|
||||
<MenuItem Header="按飞机编号排序"
|
||||
<MenuItem Header="显示飞机编号"
|
||||
Foreground="White"
|
||||
Command="{Binding SortbyIdCommand}"/>
|
||||
</ContextMenu>
|
||||
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@ -66,12 +69,16 @@
|
||||
</MultiBinding>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<TextBlock MaxWidth="100"
|
||||
<TextBlock MaxWidth="50" Visibility="{Binding DisplayID, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
Text="{Binding Name}" />
|
||||
<TextBlock MaxWidth="100"
|
||||
Margin="2,0,0,0"
|
||||
Foreground="Red"
|
||||
<TextBlock Margin="2,0,0,0" MaxWidth="5" Visibility="{Binding DisplayVirtualId, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
Text="[" />
|
||||
<TextBlock MaxWidth="50" Visibility="{Binding DisplayVirtualId, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
Margin="0,0,0,0"
|
||||
Foreground="Yellow"
|
||||
Text="{Binding VirtualId}" />
|
||||
<TextBlock Margin="0,0,0,0" MaxWidth="5" Visibility="{Binding DisplayVirtualId, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
Text="]" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
Loading…
Reference in New Issue
Block a user