Init default Material

This commit is contained in:
wangxiner55 2024-09-14 16:18:12 +08:00
parent b52303fd21
commit 13d82faca1
10 changed files with 203 additions and 90 deletions

View File

@ -2,8 +2,14 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:StudentManager" xmlns:local="clr-namespace:StudentManager"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:prism="http://prismlibrary.com/"> xmlns:prism="http://prismlibrary.com/">
<Application.Resources> <Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<md:BundledTheme BaseTheme="Dark" PrimaryColor="Grey" SecondaryColor="LightBlue" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources> </Application.Resources>
</prism:PrismApplication> </prism:PrismApplication>

View File

@ -19,14 +19,17 @@ namespace StudentManager.Common
public class DetailHomeWorkInfo public class DetailHomeWorkInfo
{ {
public DetailQuestionBase QuestionData { get; set; } = new DetailQuestionBase(); //public DetailQuestionBase QuestionData { get; set; } = new DetailQuestionBase();
public DateTime DateTime { get; set; } = DateTime.Now; public QuestionData QuestionData { get; set; } = new QuestionData();
public int Lesson { get; set; } = 0; //public DateTime DateTime { get; set; } = DateTime.Now;
//public int Lesson { get; set; } = 0;
public bool Status { get; set; } = false; public bool Status { get; set; } = false;
public int TotalCount { get; set; } = 0; //public int TotalCount { get; set; } = 0;
public int ErrorCount { get; set; } = 0; //public int ErrorCount { get; set; } = 0;
public int CorrectCount { get; set; } = 0; //public int CorrectCount { get; set; } = 0;
public int PID { get; set; } = 0;
} }
public class HomeWork public class HomeWork
@ -48,15 +51,17 @@ namespace StudentManager.Common
{ {
list.Add(new DetailHomeWorkInfo list.Add(new DetailHomeWorkInfo
{ {
QuestionData = { //QuestionData = {
QuestionData = QuestionLib.Get(item.ID), // QuestionData = QuestionLib.Get(item.ID),
Status = item.Status }, // Status = item.Status },
QuestionData = QuestionLib.Get(item.ID),
Status = Status, Status = Status,
Lesson = Lesson, //Lesson = Lesson,
DateTime = DateTime, //DateTime = DateTime,
TotalCount = TotalCount, //TotalCount = TotalCount,
ErrorCount = ErrorCount, //ErrorCount = ErrorCount,
CorrectCount = CorrectCount //CorrectCount = CorrectCount,
PID = item.ID
}); });
} }
@ -140,15 +145,17 @@ namespace StudentManager.Common
{ {
list.Add(new DetailHomeWorkInfo list.Add(new DetailHomeWorkInfo
{ {
QuestionData = { //QuestionData = {
QuestionData = QuestionLib.Get(item.ID), // QuestionData = QuestionLib.Get(item.ID),
Status = item.Status }, // Status = item.Status },
Status = HomeWorks[lesson].Status, QuestionData = QuestionLib.Get(item.ID),
Lesson = HomeWorks[lesson].Lesson, Status = item.Status,
DateTime = HomeWorks[lesson].DateTime, //Lesson = HomeWorks[lesson].Lesson,
TotalCount = HomeWorks[lesson].TotalCount, //DateTime = HomeWorks[lesson].DateTime,
ErrorCount = HomeWorks[lesson].ErrorCount, //TotalCount = HomeWorks[lesson].TotalCount,
CorrectCount = HomeWorks[lesson].CorrectCount //ErrorCount = HomeWorks[lesson].ErrorCount,
//CorrectCount = HomeWorks[lesson].CorrectCount,
PID = item.ID
}); });
} }

View File

@ -7,17 +7,23 @@
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<Style x:Key="TextStyle" TargetType="TextBlock">
<Setter Property="Width" Value="200"/>
</Style>
</UserControl.Resources>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/> <ColumnDefinition Width="100"/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ListBox ItemsSource="{Binding StudentDatas}" <ListBox ItemsSource="{Binding StudentDatas}" ScrollViewer.VerticalScrollBarVisibility="Disabled"
SelectedItem="{Binding SelectedStudent}"> SelectedItem="{Binding SelectedStudent}">
<i:Interaction.Triggers> <i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged"> <i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction <i:InvokeCommandAction
CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
Command="{Binding DataContext.SelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/> Command="{Binding DataContext.SelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</i:EventTrigger> </i:EventTrigger>
</i:Interaction.Triggers> </i:Interaction.Triggers>
@ -29,31 +35,42 @@
</ListBox> </ListBox>
<Grid Grid.Column="1"> <Grid Grid.Column="1">
<StackPanel> <ListView ItemsSource="{Binding HomeWorkSet}">
<TextBlock Text="{Binding SelectedStudent.Name}"/>
<ListBox ItemsSource="{Binding CQDatas}" <i:Interaction.Triggers>
SelectionChanged="ListBox_SelectionChanged"> <i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction
CommandParameter="DetailCheckView" CommandParameter="DetailCheckView"
Command="{Binding DataContext.RegionTo ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/> Command="{Binding DataContext.RegionTo ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</i:EventTrigger> </i:EventTrigger>
</i:Interaction.Triggers> <i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction
<ListBox.ItemTemplate> CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
<DataTemplate> Command="{Binding DataContext.HomeWorkSetSelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
<StackPanel Orientation="Horizontal"> </i:EventTrigger>
<TextBlock Text="{Binding TotalCount}"/> </i:Interaction.Triggers>
<TextBlock Text="{Binding CorrectCount}"/>
<TextBlock Text="{Binding Lesson}"/> <ListView.View>
</StackPanel> <GridView>
</DataTemplate> <GridViewColumn
</ListBox.ItemTemplate> DisplayMemberBinding="{Binding DateTime}"
</ListBox> Header="创建时间" />
<GridViewColumn
</StackPanel> DisplayMemberBinding="{Binding Lesson}"
Header="第几课" />
<GridViewColumn
DisplayMemberBinding="{Binding TotalCount}"
Header="总题数" />
<GridViewColumn
DisplayMemberBinding="{Binding ErrorCount}"
Header="总错误题数" />
<GridViewColumn
DisplayMemberBinding="{Binding CorrectCount}"
Header="总正确题数" />
</GridView>
</ListView.View>
</ListView>
</Grid> </Grid>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -7,15 +7,21 @@
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="10,5"/>
</Style>
</UserControl.Resources>
<Grid> <Grid>
<StackPanel Orientation="Horizontal"> <DockPanel HorizontalAlignment="Stretch">
<ListBox ItemsSource="{Binding HomeWorkSet}">
<ListBox ItemsSource="{Binding SelectedHomeWorkSet}">
<i:Interaction.Triggers> <i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged"> <i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction <i:InvokeCommandAction
Command="{Binding DataContext.HomeWorkSelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/> CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
Command="{Binding DataContext.HomeWorkSetSelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</i:EventTrigger> </i:EventTrigger>
</i:Interaction.Triggers> </i:Interaction.Triggers>
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
@ -24,21 +30,48 @@
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>
<ListBox DockPanel.Dock="Top" ItemsSource="{Binding HomeWork}"> <DockPanel LastChildFill="False" HorizontalAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate> <!--<StackPanel dock Orientation="Horizontal">
<DockPanel Width="800" HorizontalAlignment="Stretch" LastChildFill="False"> <TextBlock Text=" 创建时间"/>
<TextBlock Text="{Binding DateTime}"/> <TextBlock Text=" 第几课"/>
<TextBlock Text="{Binding QuestionData.QuestionData.Stem}"/> <TextBlock Text=" 总题数"/>
<TextBlock Text="{Binding QuestionData.Stem}" TextWrapping="Wrap"/> <TextBlock Text=" 总错误题数"/>
<CheckBox DockPanel.Dock="Right" Content="正确?"/> <TextBlock Text=" 总正确题数"/>
</DockPanel> <TextBlock Text=" 错误率"/>
</DataTemplate> </StackPanel>
</ListBox.ItemTemplate> <StackPanel Orientation="Horizontal">
</ListBox> <TextBlock Text="{Binding SelectedHomeWorkSet.DateTime}"/>
<Button DockPanel.Dock="Bottom" Content="提交"/> <TextBlock Text="{Binding SelectedHomeWorkSet.Lesson}"/>
</StackPanel> <TextBlock Text="{Binding SelectedHomeWorkSet.TotalCount}"/>
<TextBlock Text="{Binding SelectedHomeWorkSet.ErrorCount}"/>
<TextBlock Text="{Binding SelectedHomeWorkSet.CorrectCount}"/>
</StackPanel>-->
<ListView DockPanel.Dock="Top" ItemsSource="{Binding HomeWork}">
<ListView.View>
<GridView>
<GridViewColumn
DisplayMemberBinding="{Binding QuestionData.Id}"
Header="ID" />
<GridViewColumn
DisplayMemberBinding="{Binding QuestionData.Stem}"
Header="题干" />
<GridViewColumn Header="正确?">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Status}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<Button DockPanel.Dock="Bottom" Content="提交" Command="{Binding SubmitHomeWorkCommand}"/>
</DockPanel>
</DockPanel>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -12,6 +12,7 @@
<Style x:Key="TextStyle" TargetType="{x:Type TextBlock}"> <Style x:Key="TextStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="10,5"/> <Setter Property="Margin" Value="10,5"/>
<Setter Property="Width" Value="50"/> <Setter Property="Width" Value="50"/>
<Setter Property="Foreground" Value="White"/>
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
@ -22,7 +23,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ListBox ItemsSource="{Binding StudentDatas}" <ListBox ItemsSource="{Binding StudentDatas}" ScrollViewer.VerticalScrollBarVisibility="Disabled"
SelectedItem="{Binding SelectedStudent}"> SelectedItem="{Binding SelectedStudent}">
<i:Interaction.Triggers> <i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged"> <i:EventTrigger EventName="SelectionChanged">

View File

@ -7,6 +7,7 @@
xmlns:prism="http://prismlibrary.com/" xmlns:prism="http://prismlibrary.com/"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:extent="clr-namespace:StudentManager.Extensions" xmlns:extent="clr-namespace:StudentManager.Extensions"
Background="#FF333333"
mc:Ignorable="d" mc:Ignorable="d"
Title="MainEditor" Height="450" Width="800"> Title="MainEditor" Height="450" Width="800">
@ -15,13 +16,14 @@
<ColumnDefinition Width="100"/> <ColumnDefinition Width="100"/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ItemsControl ItemsSource="{Binding MenuBars}">
<ItemsControl ItemsSource="{Binding MenuBars}">
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<Button Content="{Binding Title}" Command="{Binding DataContext.RegionTo, RelativeSource={RelativeSource AncestorType=ItemsControl}}" <Button Content="{Binding Title}" Command="{Binding DataContext.RegionTo, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
CommandParameter="{Binding NameSpace}"/> CommandParameter="{Binding NameSpace}" Margin="5.0"/>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>

View File

@ -12,12 +12,12 @@
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<ListBox ItemsSource="{Binding QuestionDatas}"> <!--<ListBox ItemsSource="{Binding QuestionDatas}">
<!--<i:Interaction.Triggers> --><!--<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged"> <i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction x:Name="menuTrigger" Command="{Binding navigateCommand}" CommandParameter="{Binding ElementName=menu, Path=SelectedItem}"/> <i:InvokeCommandAction x:Name="menuTrigger" Command="{Binding navigateCommand}" CommandParameter="{Binding ElementName=menu, Path=SelectedItem}"/>
</i:EventTrigger> </i:EventTrigger>
</i:Interaction.Triggers>--> </i:Interaction.Triggers>--><!--
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
@ -33,6 +33,38 @@
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>-->
<ListView ItemsSource="{Binding QuestionDatas}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListView.View>
<GridView>
<GridViewColumn
DisplayMemberBinding="{Binding Id}"
Header="ID" />
<GridViewColumn
DisplayMemberBinding="{Binding Type}"
Header="类型" />
<GridViewColumn
DisplayMemberBinding="{Binding Stem}"
Header="题干" />
<GridViewColumn
DisplayMemberBinding="{Binding Answer}"
Header="答案" />
<GridViewColumn
DisplayMemberBinding="{Binding DifficultyLevel}"
Header="难度" />
<GridViewColumn
DisplayMemberBinding="{Binding Category}"
Header="标签" />
<GridViewColumn
DisplayMemberBinding="{Binding Source}"
Header="来源" />
<GridViewColumn
DisplayMemberBinding="{Binding Status}"
Header="状态" />
</GridView>
</ListView.View>
</ListView>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -8,15 +8,15 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources> <UserControl.Resources>
<Style x:Key="TextStyle" TargetType="{x:Type TextBlock}"> <Style TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="10,5"/> <Setter Property="Margin" Value="10,5"/>
<Setter Property="Width" Value="50"/> <Setter Property="Width" Value="50"/>
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<ListBox ItemsSource="{Binding StudentDatas}"
SelectedItem="{Binding SelectedStudent}">
<ListView ScrollViewer.VerticalScrollBarVisibility="Disabled"
ItemsSource="{Binding StudentDatas}" SelectedItem="{Binding SelectedStudent}">
<i:Interaction.Triggers> <i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick"> <i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction <i:InvokeCommandAction
@ -24,18 +24,21 @@
Command="{Binding DataContext.RegionTo ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/> Command="{Binding DataContext.RegionTo ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</i:EventTrigger> </i:EventTrigger>
</i:Interaction.Triggers> </i:Interaction.Triggers>
<ListBox.ItemTemplate>
<DataTemplate> <ListView.View>
<StackPanel Orientation="Horizontal"> <GridView>
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Name}"/> <GridViewColumn
<!--<TextBlock Style="{StaticResource TextStyle}" Text="{Binding TotalsQuestions}"/> DisplayMemberBinding="{Binding Name}"
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding CorrectionCount}"/> Header="姓名" />
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding UnCorrectCount}"/> <GridViewColumn
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding ErrorRate}"/> DisplayMemberBinding="{Binding ErrorSet.TotalCount}"
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding CorrectRate}"/>--> Header="错误总数" />
</StackPanel> <GridViewColumn
</DataTemplate> DisplayMemberBinding="{Binding ErrorSet.CorrectCount}"
</ListBox.ItemTemplate> Header="修正数量" />
</ListBox> </GridView>
</ListView.View>
</ListView>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -127,6 +127,7 @@ namespace StudentManager.Model
public DelegateCommand<DetailHomeWorkInfo> HomeWorkSelectedCommand { get; set; } public DelegateCommand<DetailHomeWorkInfo> HomeWorkSelectedCommand { get; set; }
public DelegateCommand<DetailHomeWorkSetInfo> HomeWorkSetSelectedCommand { get; set; } public DelegateCommand<DetailHomeWorkSetInfo> HomeWorkSetSelectedCommand { get; set; }
public DelegateCommand RegionToDetailCommand { get; set; } public DelegateCommand RegionToDetailCommand { get; set; }
public DelegateCommand SubmitHomeWorkCommand { get; set; }
Students(IRegionManager regionManager) Students(IRegionManager regionManager)
{ {
@ -145,6 +146,8 @@ namespace StudentManager.Model
RegionToStudents(); RegionToStudents();
}); });
SubmitHomeWorkCommand = new DelegateCommand(() => SubmitHomeWork());
SelectedCommand = new DelegateCommand<StudentInfo>((x) => SelectedCommand = new DelegateCommand<StudentInfo>((x) =>
{ {
if (x == null) return; if (x == null) return;
@ -184,6 +187,14 @@ namespace StudentManager.Model
SaveAll(); SaveAll();
} }
private void SubmitHomeWork()
{
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).Questions.ForEach(x =>
{
x.Status = HomeWork.FirstOrDefault(hw => hw.PID == x.ID).Status;
});
}
private void RegionToDetailView() private void RegionToDetailView()
{ {
if(selectedStudent == null) return; if(selectedStudent == null) return;

View File

@ -9,6 +9,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="5.1.0" />
<PackageReference Include="MySql.Data" Version="9.0.0" /> <PackageReference Include="MySql.Data" Version="9.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Prism.DryIoc" Version="9.0.537" /> <PackageReference Include="Prism.DryIoc" Version="9.0.537" />