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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:StudentManager"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:prism="http://prismlibrary.com/">
<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>
</prism:PrismApplication>

View File

@ -19,14 +19,17 @@ namespace StudentManager.Common
public class DetailHomeWorkInfo
{
public DetailQuestionBase QuestionData { get; set; } = new DetailQuestionBase();
public DateTime DateTime { get; set; } = DateTime.Now;
public int Lesson { get; set; } = 0;
//public DetailQuestionBase QuestionData { get; set; } = new DetailQuestionBase();
public QuestionData QuestionData { get; set; } = new QuestionData();
//public DateTime DateTime { get; set; } = DateTime.Now;
//public int Lesson { get; set; } = 0;
public bool Status { get; set; } = false;
public int TotalCount { get; set; } = 0;
public int ErrorCount { get; set; } = 0;
public int CorrectCount { get; set; } = 0;
//public int TotalCount { get; set; } = 0;
//public int ErrorCount { get; set; } = 0;
//public int CorrectCount { get; set; } = 0;
public int PID { get; set; } = 0;
}
public class HomeWork
@ -48,15 +51,17 @@ namespace StudentManager.Common
{
list.Add(new DetailHomeWorkInfo
{
QuestionData = {
QuestionData = QuestionLib.Get(item.ID),
Status = item.Status },
//QuestionData = {
// QuestionData = QuestionLib.Get(item.ID),
// Status = item.Status },
QuestionData = QuestionLib.Get(item.ID),
Status = Status,
Lesson = Lesson,
DateTime = DateTime,
TotalCount = TotalCount,
ErrorCount = ErrorCount,
CorrectCount = CorrectCount
//Lesson = Lesson,
//DateTime = DateTime,
//TotalCount = TotalCount,
//ErrorCount = ErrorCount,
//CorrectCount = CorrectCount,
PID = item.ID
});
}
@ -140,15 +145,17 @@ namespace StudentManager.Common
{
list.Add(new DetailHomeWorkInfo
{
QuestionData = {
QuestionData = QuestionLib.Get(item.ID),
Status = item.Status },
Status = HomeWorks[lesson].Status,
Lesson = HomeWorks[lesson].Lesson,
DateTime = HomeWorks[lesson].DateTime,
TotalCount = HomeWorks[lesson].TotalCount,
ErrorCount = HomeWorks[lesson].ErrorCount,
CorrectCount = HomeWorks[lesson].CorrectCount
//QuestionData = {
// QuestionData = QuestionLib.Get(item.ID),
// Status = item.Status },
QuestionData = QuestionLib.Get(item.ID),
Status = item.Status,
//Lesson = HomeWorks[lesson].Lesson,
//DateTime = HomeWorks[lesson].DateTime,
//TotalCount = HomeWorks[lesson].TotalCount,
//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"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<Style x:Key="TextStyle" TargetType="TextBlock">
<Setter Property="Width" Value="200"/>
</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ListBox ItemsSource="{Binding StudentDatas}"
<ListBox ItemsSource="{Binding StudentDatas}" ScrollViewer.VerticalScrollBarVisibility="Disabled"
SelectedItem="{Binding SelectedStudent}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction
CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
Command="{Binding DataContext.SelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
@ -29,31 +35,42 @@
</ListBox>
<Grid Grid.Column="1">
<StackPanel>
<TextBlock Text="{Binding SelectedStudent.Name}"/>
<ListBox ItemsSource="{Binding CQDatas}"
SelectionChanged="ListBox_SelectionChanged">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction
<ListView ItemsSource="{Binding HomeWorkSet}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction
CommandParameter="DetailCheckView"
Command="{Binding DataContext.RegionTo ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding TotalCount}"/>
<TextBlock Text="{Binding CorrectCount}"/>
<TextBlock Text="{Binding Lesson}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</i:EventTrigger>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction
CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
Command="{Binding DataContext.HomeWorkSetSelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<ListView.View>
<GridView>
<GridViewColumn
DisplayMemberBinding="{Binding DateTime}"
Header="创建时间" />
<GridViewColumn
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>
</UserControl>

View File

@ -7,15 +7,21 @@
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="10,5"/>
</Style>
</UserControl.Resources>
<Grid>
<StackPanel Orientation="Horizontal">
<ListBox ItemsSource="{Binding SelectedHomeWorkSet}">
<DockPanel HorizontalAlignment="Stretch">
<ListBox ItemsSource="{Binding HomeWorkSet}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<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:Interaction.Triggers>
<ListBox.ItemTemplate>
@ -24,21 +30,48 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<ListBox DockPanel.Dock="Top" ItemsSource="{Binding HomeWork}">
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel Width="800" HorizontalAlignment="Stretch" LastChildFill="False">
<TextBlock Text="{Binding DateTime}"/>
<TextBlock Text="{Binding QuestionData.QuestionData.Stem}"/>
<TextBlock Text="{Binding QuestionData.Stem}" TextWrapping="Wrap"/>
<CheckBox DockPanel.Dock="Right" Content="正确?"/>
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button DockPanel.Dock="Bottom" Content="提交"/>
</StackPanel>
<DockPanel LastChildFill="False" HorizontalAlignment="Stretch">
<!--<StackPanel dock Orientation="Horizontal">
<TextBlock Text=" 创建时间"/>
<TextBlock Text=" 第几课"/>
<TextBlock Text=" 总题数"/>
<TextBlock Text=" 总错误题数"/>
<TextBlock Text=" 总正确题数"/>
<TextBlock Text=" 错误率"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding SelectedHomeWorkSet.DateTime}"/>
<TextBlock Text="{Binding SelectedHomeWorkSet.Lesson}"/>
<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>
</UserControl>

View File

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

View File

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

View File

@ -12,12 +12,12 @@
</Style>
</UserControl.Resources>
<Grid>
<ListBox ItemsSource="{Binding QuestionDatas}">
<!--<i:Interaction.Triggers>
<!--<ListBox ItemsSource="{Binding QuestionDatas}">
--><!--<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction x:Name="menuTrigger" Command="{Binding navigateCommand}" CommandParameter="{Binding ElementName=menu, Path=SelectedItem}"/>
</i:EventTrigger>
</i:Interaction.Triggers>-->
</i:Interaction.Triggers>--><!--
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
@ -33,6 +33,38 @@
</StackPanel>
</DataTemplate>
</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>
</UserControl>

View File

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

View File

@ -127,6 +127,7 @@ namespace StudentManager.Model
public DelegateCommand<DetailHomeWorkInfo> HomeWorkSelectedCommand { get; set; }
public DelegateCommand<DetailHomeWorkSetInfo> HomeWorkSetSelectedCommand { get; set; }
public DelegateCommand RegionToDetailCommand { get; set; }
public DelegateCommand SubmitHomeWorkCommand { get; set; }
Students(IRegionManager regionManager)
{
@ -145,6 +146,8 @@ namespace StudentManager.Model
RegionToStudents();
});
SubmitHomeWorkCommand = new DelegateCommand(() => SubmitHomeWork());
SelectedCommand = new DelegateCommand<StudentInfo>((x) =>
{
if (x == null) return;
@ -184,6 +187,14 @@ namespace StudentManager.Model
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()
{
if(selectedStudent == null) return;

View File

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