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