mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-11 12:15:35 +08:00
@@ -194,9 +194,11 @@ public partial class ScreenSimulationPageViewModel : ObservableObject
|
||||
private string _keyWord = string.Empty;
|
||||
private string _station = string.Empty;
|
||||
private string _type = string.Empty;
|
||||
private string _author = string.Empty;
|
||||
public List<string> StyleStations { get; private set; } = [.. new[] { "全部" }.Concat(StylesInfoDataSource.Instance.StylesInfo.Select(x => x.Station).Distinct())];
|
||||
public List<string> StyleTypes { get; private set; } = [.. new[] { "全部" }.Concat(StylesInfoDataSource.Instance.StylesInfo.Select(x => x.Type).Distinct())];
|
||||
|
||||
public List<string> StyleAuthors { get; private set; } = [.. new[] { "全部" }.Concat(StylesInfoDataSource.Instance.StylesInfo.Select(x => x.Author).Distinct())];
|
||||
|
||||
[RelayCommand]
|
||||
public void TextSearch(object s)
|
||||
{
|
||||
@@ -224,9 +226,18 @@ public partial class ScreenSimulationPageViewModel : ObservableObject
|
||||
Search();
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
public void AuthorSearch(object s)
|
||||
{
|
||||
if (s is string str)
|
||||
{
|
||||
_author = str;
|
||||
Search();
|
||||
}
|
||||
}
|
||||
private void Search()
|
||||
{
|
||||
StyleCards = [.. StylesInfoDataSource.Instance.StylesInfo.Where(x =>(x.Station==_station||_station==string.Empty||_station=="全部") && (x.Type==_type||_type==string.Empty||_type=="全部") && x.Title.Contains(_keyWord))];
|
||||
StyleCards = [.. StylesInfoDataSource.Instance.StylesInfo.Where(x =>(x.Station==_station||_station==string.Empty||_station=="全部") && (x.Type==_type||_type==string.Empty||_type=="全部") && (x.Author==_author||_author==string.Empty||_author=="全部") && x.Title.Contains(_keyWord))];
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -81,6 +81,17 @@
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text=" 个样式" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="2" Margin="0,12">
|
||||
<TextBlock Opacity="0.7" VerticalAlignment="Center" FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
Text="" FontSize="12" Margin="0,0,8,0"/>
|
||||
<TextBlock Opacity="0.7" Style="{StaticResource BodyTextBlockStyle}" Text="作者:" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||
<ComboBox MinWidth="128" ItemsSource="{Binding ViewModel.StyleAuthors}" x:Name="FilterAuthorComboBox" Margin="0,0,24,0" SelectedIndex="0">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding ViewModel.AuthorSearchCommand}"
|
||||
CommandParameter="{Binding SelectedItem,ElementName=FilterAuthorComboBox}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</ComboBox>
|
||||
<TextBlock Opacity="0.7" VerticalAlignment="Center" FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
Text="" FontSize="12" Margin="0,0,8,0"/>
|
||||
<TextBlock Opacity="0.7" Style="{StaticResource BodyTextBlockStyle}" Text="车站:" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||
|
||||
Reference in New Issue
Block a user