This commit is contained in:
wangxiner55 2024-09-24 19:00:10 +08:00
parent da9c3b7041
commit a5d33f9f99
12 changed files with 304 additions and 248 deletions

View File

@ -7,7 +7,7 @@
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<md:BundledTheme BaseTheme="Dark" PrimaryColor="Grey" SecondaryColor="LightBlue" /> <md:BundledTheme BaseTheme="Light" PrimaryColor="Grey" SecondaryColor="Cyan" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" /> <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>

View File

@ -352,5 +352,39 @@ namespace StudentManager.Common
} }
} }
} }
internal static void AddHomework(CursonQuestionsData homeWork)
{
using (MySqlConnection connection = new MySqlConnection(config))
{
try
{
connection.Open();
string updateQuery = "insert into curson_questions (user_id, problem_ids, correct_ids, lesson, status, update_time)" +
"values (@user_id, @problem_ids, @correct_ids, @lesson, @status, @update_time)";
using (MySqlCommand updateCmd = new MySqlCommand(updateQuery, connection))
{
updateCmd.Parameters.AddWithValue("@user_id", homeWork.UID);
updateCmd.Parameters.AddWithValue("@problem_ids", JsonConvert.SerializeObject(homeWork.ProblemIDS));
updateCmd.Parameters.AddWithValue("@correct_ids", JsonConvert.SerializeObject(homeWork.CorrectIDS));
updateCmd.Parameters.AddWithValue("@lesson", homeWork.Lesson);
updateCmd.Parameters.AddWithValue("@status", homeWork.Status);
updateCmd.Parameters.AddWithValue("@update_time", homeWork.DateTime);
updateCmd.ExecuteNonQuery();
}
}
catch (Exception ex)
{
}
finally
{
connection.Close();
}
}
}
} }
} }

View File

@ -8,7 +8,7 @@ namespace StudentManager.Data
{ {
public class CursonQuestionsData : IDataCommon public class CursonQuestionsData : IDataCommon
{ {
public int UID { get; set; } = 0; public long UID { get; set; } = 0;
public int[] ProblemIDS { get; set; } = { }; public int[] ProblemIDS { get; set; } = { };
public int[] CorrectIDS { get; set; } = { }; public int[] CorrectIDS { get; set; } = { };
public DateTime DateTime { get; set; } = DateTime.Now; public DateTime DateTime { get; set; } = DateTime.Now;

View File

@ -147,6 +147,23 @@ namespace StudentManager.Data
HomeWorkSet.AddHomeWork(homeWork); HomeWorkSet.AddHomeWork(homeWork);
CursonQuestionsData cqd = new CursonQuestionsData();
cqd.ProblemIDS = new int[homeWork.Questions.Count];
int index = 0;
homeWork.Questions.ForEach(question =>
{
cqd.ProblemIDS[index] = question.ID;
index++;
});
cqd.UID = UID;
cqd.Lesson = homeWork.Lesson;
cqd.DateTime = homeWork.DateTime;
cqd.Status = 0;
SQLHelper.AddHomework(cqd);
} }
} }
} }

View File

@ -20,23 +20,44 @@
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Stretch" > <StackPanel VerticalAlignment="Stretch">
<CheckBox Margin="5" Content="是否加入公共题库" IsChecked="{Binding IsAddPublicQuestionsLib}"/> <Border Background="#FFFFFF" BorderBrush="Gray" BorderThickness="0" CornerRadius="5" Padding="10" Margin="5" Height="150">
<CheckBox Margin="5" Content="是否需要纠错" IsChecked="{Binding IsNeedErrorset}"/> <Border.Effect>
<CheckBox Margin="5" Content="是否控制题目数量" IsChecked="{Binding IsControlQuestionNum}"/> <DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
<StackPanel Margin="5" Orientation="Horizontal"> </Border.Effect>
<TextBlock Text=" 课程章节序号 "/> <StackPanel>
<TextBox Text="{Binding PublicLesson}" MinWidth="50"/> <CheckBox Margin="2,10" Content="是否加入公共题库" IsChecked="{Binding IsAddPublicQuestionsLib}"/>
</StackPanel> <CheckBox Margin="2,10" Content="是否需要纠错" IsChecked="{Binding IsNeedErrorset}"/>
<StackPanel Margin="5" Orientation="Horizontal"> <CheckBox Margin="2,10" Content="是否控制题目数量" IsChecked="{Binding IsControlQuestionNum}"/>
<TextBlock Text=" 问题数量 "/> </StackPanel>
<TextBox Text="{Binding QuestionCount}" MinWidth="50"/> </Border>
</StackPanel>
<Border Background="#FFFFFF" BorderBrush="Gray" BorderThickness="0" CornerRadius="5" Padding="10" Margin="5">
<Border.Effect>
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
</Border.Effect>
<StackPanel Margin="5">
<TextBlock Margin="0,10" Text=" 课程章节序号 "/>
<TextBox Text="{Binding PublicLesson}" MinWidth="50"/>
</StackPanel>
</Border>
<Border Background="#FFFFFF" BorderBrush="Gray" BorderThickness="0" CornerRadius="5" Padding="10" Margin="5">
<Border.Effect>
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
</Border.Effect>
<StackPanel Margin="5">
<TextBlock Margin="0,10" Text=" 问题数量 "/>
<TextBox Text="{Binding QuestionCount}" MinWidth="50"/>
</StackPanel>
</Border>
</StackPanel> </StackPanel>
<ScrollViewer Grid.Column="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> <Border BorderBrush="#FFE1E1E1" BorderThickness="1,0,0,0" Margin="0,0,0,0" Grid.Column="1"/>
<ItemsControl Grid.Row="1" ItemsSource="{Binding HomeworkTestData}" HorizontalAlignment="Center">
<ScrollViewer Grid.Column="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden" Margin="10">
<ItemsControl Grid.Row="1" ItemsSource="{Binding HomeworkTestData}" HorizontalAlignment="Left">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<WrapPanel/> <WrapPanel/>
@ -44,8 +65,35 @@
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<Border Background="#55aaaaaa" BorderBrush="Gray" BorderThickness="1" Padding="5" Height="50" Width="100" Margin="5"> <Border Background="#FFFEFEFE" BorderBrush="Gray" BorderThickness="0" CornerRadius="10"
<TextBlock Margin="1" TextWrapping="Wrap" FontSize="12" Foreground="White" Text="{Binding Stem}" TextAlignment="Center"/> Padding="5" Height="150" Width="120" Margin="5" IsHitTestVisible="True">
<Border.Effect>
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
</Border.Effect>
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Black"/>
<Setter Property="BorderBrush" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<StackPanel>
<TextBlock TextWrapping="Wrap" FontSize="12" FontWeight="Bold" Text="{Binding Type}"
VerticalAlignment="Center" HorizontalAlignment="Left" Padding="10,10"/>
<Border BorderBrush="Gray" BorderThickness="0,0.5,0,0" Margin="5,0,60,10"/>
<StackPanel Orientation="Vertical">
<TextBlock TextWrapping="Wrap" FontSize="12" Text="题干" Margin="5" Foreground="Gray"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap" FontSize="12" Margin="5"
Text="{Binding Stem}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
</StackPanel>
</Border> </Border>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
@ -54,7 +102,7 @@
</Grid> </Grid>
<Button Grid.Row="1" DockPanel.Dock="Bottom" Content="发布作业" <Button Grid.Row="1" DockPanel.Dock="Bottom" Content="发布作业" Style="{DynamicResource MaterialDesignFlatDarkButton}"
Command="{Binding PublicHomeWorkCommand}"/> Command="{Binding PublicHomeWorkCommand}"/>
</Grid> </Grid>

View File

@ -37,119 +37,6 @@
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<DockPanel LastChildFill="False"> <DockPanel LastChildFill="False">
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
<TextBlock Text="Lesson" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBox Text="{Binding Lesson}"/>
</StackPanel>
<!--<ListView DockPanel.Dock="Top"
ItemsSource="{Binding ADDQuestionDatas}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
--><!--<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>--><!--
<ListView.View >
<GridView>
<GridViewColumn Header="类型">
<GridViewColumn.CellTemplate>
<DataTemplate>
<ComboBox SelectedItem="{Binding Type, Mode=TwoWay}" ItemsSource="{Binding Source={StaticResource TypeEnumValues}}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="题干">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Stem}" TextWrapping="Wrap" AcceptsReturn="True"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="答案">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Answer}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="难度">
<GridViewColumn.CellTemplate>
<DataTemplate>
<ComboBox SelectedItem="{Binding DifficultyLevel, Mode=TwoWay}" ItemsSource="{Binding Source={StaticResource DifficultyEnumValues}}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="标签">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Category}" TextWrapping="Wrap" AcceptsReturn="True"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="来源">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Source}" TextWrapping="Wrap" AcceptsReturn="True"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="状态">
<GridViewColumn.CellTemplate>
<DataTemplate>
<ComboBox SelectedItem="{Binding Status, Mode=TwoWay}" ItemsSource="{Binding Source={StaticResource PublishEnumValues}}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn>
<GridViewColumn.HeaderTemplate>
<DataTemplate>
<StackPanel>
<Button Content="添加" Style="{StaticResource MaterialDesignFlatButton}" Padding="5" Foreground="White"
Command="{Binding DataContext.AddNewColumnCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</StackPanel>
</DataTemplate>
</GridViewColumn.HeaderTemplate>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Content="添加" Style="{StaticResource MaterialDesignFlatButton}" Padding="5"
Command="{Binding DataContext.AddNewColumnCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn>
<GridViewColumn.HeaderTemplate>
<DataTemplate>
<StackPanel>
<Button Content="删除" Style="{StaticResource MaterialDesignFlatButton}" Padding="5" Foreground="White"
/>
</StackPanel>
</DataTemplate>
</GridViewColumn.HeaderTemplate>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Content="删除" Style="{StaticResource MaterialDesignFlatButton}" Padding="5"
Command="{Binding DataContext.RemoveNewColumnCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>-->
<DataGrid DockPanel.Dock="Top" ItemsSource="{Binding ADDQuestionDatas}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" CanUserDeleteRows="True" <DataGrid DockPanel.Dock="Top" ItemsSource="{Binding ADDQuestionDatas}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" CanUserDeleteRows="True"
ScrollViewer.VerticalScrollBarVisibility="Disabled"/> ScrollViewer.VerticalScrollBarVisibility="Disabled"/>
<Grid HorizontalAlignment="Stretch" DockPanel.Dock="Bottom"> <Grid HorizontalAlignment="Stretch" DockPanel.Dock="Bottom">
@ -159,9 +46,9 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Button Content="提交" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="0" <Button Content="提交" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="0"
Command="{Binding SubmitAddQuestionsCommand}"/> Command="{Binding SubmitAddQuestionsCommand}" Style="{DynamicResource MaterialDesignFlatDarkButton}"/>
<Button Content="清除" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="1" <Button Content="清除" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="1"
Command="{Binding ClearnAddQuestionsCommand}"/> Command="{Binding ClearnAddQuestionsCommand}" Style="{DynamicResource MaterialDesignFlatDarkButton}"/>
</Grid> </Grid>
</DockPanel> </DockPanel>
</Grid> </Grid>

View File

@ -12,14 +12,18 @@
<Setter Property="Width" Value="200"/> <Setter Property="Width" Value="200"/>
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid Background="Transparent">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/> <ColumnDefinition Width="100"/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border CornerRadius="20"/>
<ListBox ItemsSource="{Binding StudentDatas}" ScrollViewer.VerticalScrollBarVisibility="Disabled" <ListBox ItemsSource="{Binding StudentDatas}" Margin="10"
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
@ -27,15 +31,55 @@
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>
<ListBox.Style>
<Style TargetType="ListBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border BorderBrush="Transparent" BorderThickness="1" CornerRadius="10" Background="#FFEEEEEE">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<ItemsPresenter/>
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Style>
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding Name}"/> <TextBlock Text="{Binding Name}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5"/>
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>
<Grid Grid.Column="1"> <Grid Grid.Column="1">
<ListView ItemsSource="{Binding HomeWorkSet}"> <ListView ItemsSource="{Binding HomeWorkSet}" Foreground="Black"
Margin="10"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.Style>
<Style TargetType="ListView">
<Setter Property="Background" Value="LightGray"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListView">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<ItemsPresenter/>
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.Style>
<i:Interaction.Triggers> <i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick"> <i:EventTrigger EventName="MouseDoubleClick">
@ -54,7 +98,7 @@
<GridView> <GridView>
<GridViewColumn <GridViewColumn
DisplayMemberBinding="{Binding DateTime}" DisplayMemberBinding="{Binding DateTime}"
Header="创建时间" /> Header="创建时间"/>
<GridViewColumn <GridViewColumn
DisplayMemberBinding="{Binding Lesson}" DisplayMemberBinding="{Binding Lesson}"
Header="第几课" /> Header="第几课" />
@ -67,6 +111,14 @@
<GridViewColumn <GridViewColumn
DisplayMemberBinding="{Binding CorrectCount}" DisplayMemberBinding="{Binding CorrectCount}"
Header="总正确题数" /> Header="总正确题数" />
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Content="删除" Command="{Binding DeleteSelectedHomeworkCommand}"
CommandParameter="{Binding}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView> </GridView>
</ListView.View> </ListView.View>
</ListView> </ListView>

View File

@ -33,22 +33,6 @@
<DockPanel LastChildFill="False" HorizontalAlignment="Stretch"> <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 DockPanel.Dock="Top" ItemsSource="{Binding HomeWork}">
<ListView.View> <ListView.View>
<GridView> <GridView>

View File

@ -9,34 +9,66 @@
xmlns:extent="clr-namespace:StudentManager.Extensions" xmlns:extent="clr-namespace:StudentManager.Extensions"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:dt="clr-namespace:StudentManager.Data" xmlns:dt="clr-namespace:StudentManager.Data"
Background="#FF333333" Background="#00000000" WindowStyle="None"
mc:Ignorable="d" mc:Ignorable="d"
Title="MainEditor" Height="450" Width="800"> Title="MainEditor" Height="800" Width="1400">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/> <ColumnDefinition Width="150"/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border Background="#FFFAFAFA" Grid.ColumnSpan="2" CornerRadius="20"/>
<DockPanel LastChildFill="False"> <DockPanel LastChildFill="False">
<ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding MenuBars}"> <StackPanel DockPanel.Dock="Top">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Title}" Command="{Binding DataContext.RegionTo, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
CommandParameter="{Binding NameSpace}" Margin="5.0"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Margin="5" HorizontalAlignment="Stretch" DockPanel.Dock="Bottom" Content="保存" <TextBlock Text="STUDENTMANAGER" VerticalAlignment="Center" HorizontalAlignment="Left"
FontSize="12" FontWeight="Bold"
TextAlignment="Center" Padding="25,10" Height="40"/>
<ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding MenuBars}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Title}" Command="{Binding DataContext.RegionTo, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
Style="{DynamicResource MaterialDesignFlatDarkButton}" HorizontalAlignment="Stretch" Padding="40,0,0,0" HorizontalContentAlignment="Left"
CommandParameter="{Binding NameSpace}" Margin="5.0"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
<Button Margin="5" HorizontalAlignment="Stretch" DockPanel.Dock="Bottom" Content="保存" Style="{DynamicResource MaterialDesignFlatDarkButton}"
Command="{Binding SaveAllCommand}"/> Command="{Binding SaveAllCommand}"/>
<Button Margin="5" HorizontalAlignment="Stretch" DockPanel.Dock="Bottom" Content="刷新数据" <Button Margin="5" HorizontalAlignment="Stretch" DockPanel.Dock="Bottom" Content="刷新数据" Style="{DynamicResource MaterialDesignFlatDarkButton}"
Command="{Binding FreshAllCommand}"/> Command="{Binding FreshAllCommand}"/>
</DockPanel> </DockPanel>
<ContentControl Grid.Column="1" prism:RegionManager.RegionName="{x:Static extent:PrismManager.MainRegionName}"/> <Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Margin="10">
<Border Background="#FFFFFFFF" CornerRadius="10"/>
<DockPanel VerticalAlignment="Center" LastChildFill="False">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Border Margin="50,0" CornerRadius="50" Height="20" Width="20" Background="Gray"/>
<StackPanel VerticalAlignment="Center" Margin="20,0">
<TextBlock DockPanel.Dock="Left" Text="USERNAME" HorizontalAlignment="Left" Margin="2" FontWeight="Bold" VerticalAlignment="Center"/>
<TextBlock DockPanel.Dock="Left" Text="desc" HorizontalAlignment="Left" FontSize="8" Foreground="Gray" Margin="2" VerticalAlignment="Center"/>
</StackPanel>
</StackPanel>
<TextBlock DockPanel.Dock="Right" Text="NAME" HorizontalAlignment="Left" Margin="20" VerticalAlignment="Center"/>
</DockPanel>
</Grid>
<ContentControl Grid.Row="1" Margin="10" prism:RegionManager.RegionName="{x:Static extent:PrismManager.MainRegionName}" BorderBrush="White"/>
</Grid>
</Grid> </Grid>
</Window> </Window>

View File

@ -13,60 +13,36 @@
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<ListView ItemsSource="{Binding QuestionDatas}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
<Grid.RowDefinitions>
<RowDefinition Height="0.4*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Border Background="Gray" CornerRadius="10" Margin="10" Height="20" />
<Border Background="Gray" CornerRadius="10" Margin="10"/>
</StackPanel>
<DataGrid ItemsSource="{Binding QuestionDatas}" Background="#22aaaaaa" Grid.Row="1"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" CanUserDeleteRows="False" CanUserAddRows="False"
IsReadOnly="True" Foreground="#FF222222"
ScrollViewer.VerticalScrollBarVisibility="Disabled"> ScrollViewer.VerticalScrollBarVisibility="Disabled">
<DataGrid.RowStyle>
<!--<i:Interaction.Triggers> <Style TargetType="DataGridRow">
<i:EventTrigger EventName="SelectionChanged"> <Setter Property="Template">
<i:InvokeCommandAction <Setter.Value>
CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" <ControlTemplate TargetType="DataGridRow">
Command="{Binding DataContext.SelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/> <Border CornerRadius="10" Margin="5" Background="White">
</i:EventTrigger> <DataGridCellsPresenter/>
</i:Interaction.Triggers>--> </Border>
</ControlTemplate>
<!--<ListView.View> </Setter.Value>
<GridView> </Setter>
<GridViewColumn </Style>
DisplayMemberBinding="{Binding Id}" </DataGrid.RowStyle>
Header="ID" /> </DataGrid>
<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="状态" />
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Content="删除" Style="{StaticResource MaterialDesignFlatButton}" Padding="5"
Command="{Binding DataContext.DeleteQuestionCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding }"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>-->
</ListView>
<DataGrid ItemsSource="{Binding QuestionDatas}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" CanUserDeleteRows="False" CanUserAddRows="False" IsReadOnly="True"
ScrollViewer.VerticalScrollBarVisibility="Disabled"/>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -13,32 +13,59 @@
<Setter Property="Width" Value="50"/> <Setter Property="Width" Value="50"/>
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid Background="Transparent">
<Border Background="#FFFAFAFA" CornerRadius="10"/>
<ListView ScrollViewer.VerticalScrollBarVisibility="Disabled" <ScrollViewer Grid.Column="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" Margin="10">
ItemsSource="{Binding StudentDatas}" SelectedItem="{Binding SelectedStudent}"> <ItemsControl Grid.Row="1" ItemsSource="{Binding StudentDatas}" HorizontalAlignment="Left">
<i:Interaction.Triggers> <ItemsControl.ItemsPanel>
<i:EventTrigger EventName="MouseDoubleClick"> <ItemsPanelTemplate>
<i:InvokeCommandAction <WrapPanel/>
CommandParameter="DetailView" </ItemsPanelTemplate>
Command="{Binding DataContext.RegionTo ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/> </ItemsControl.ItemsPanel>
</i:EventTrigger> <ItemsControl.ItemTemplate>
</i:Interaction.Triggers> <DataTemplate>
<Border Background="#FFFEFEFE" BorderBrush="Gray" BorderThickness="0" CornerRadius="10"
Padding="5" Height="200" Width="120" Margin="5" IsHitTestVisible="True">
<Border.Effect>
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
</Border.Effect>
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Black"/>
<Setter Property="BorderBrush" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<StackPanel>
<TextBlock TextWrapping="Wrap" FontSize="20" FontWeight="Bold" Text="{Binding Name}"
VerticalAlignment="Center" HorizontalAlignment="Left" Padding="10,10"/>
<ListView.View> <StackPanel Orientation="Vertical">
<GridView> <TextBlock TextWrapping="Wrap" FontSize="12" Text="总数" Margin="5" Foreground="Gray"
<GridViewColumn VerticalAlignment="Center" HorizontalAlignment="Left"/>
DisplayMemberBinding="{Binding Name}" <TextBlock TextWrapping="Wrap" FontSize="18" Margin="5"
Header="姓名" /> Text="{Binding ErrorSet.TotalCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<GridViewColumn </StackPanel>
DisplayMemberBinding="{Binding ErrorSet.TotalCount}"
Header="错误总数" /> <Border BorderBrush="Gray" BorderThickness="0,0.5,0,0" Margin="5"/>
<GridViewColumn
DisplayMemberBinding="{Binding ErrorSet.CorrectCount}" <StackPanel Orientation="Vertical">
Header="修正数量" />
</GridView> <TextBlock TextWrapping="Wrap" FontSize="12" Text="正确数" Margin="5" Foreground="Gray"
</ListView.View> VerticalAlignment="Center" HorizontalAlignment="Left"/>
</ListView> <TextBlock TextWrapping="Wrap" FontSize="18" Text="{Binding ErrorSet.CorrectCount}" Margin="5"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -308,7 +308,6 @@ namespace StudentManager.Model
QuestionDatas = new ObservableCollection<QuestionData>(questionDatas); QuestionDatas = new ObservableCollection<QuestionData>(questionDatas);
ErrorSetDatas = new ReadOnlyObservableCollection<DetailErrorInfo>(errorSetDatas); ErrorSetDatas = new ReadOnlyObservableCollection<DetailErrorInfo>(errorSetDatas);
MenuBars = new ReadOnlyObservableCollection<MenuBar>(menuBars); MenuBars = new ReadOnlyObservableCollection<MenuBar>(menuBars);
//CQDatas = new ReadOnlyObservableCollection<CursonQuestionsData>(cQDatas);
HomeWorkSet = new ObservableCollection<DetailHomeWorkSetInfo>(homeWorkSet); HomeWorkSet = new ObservableCollection<DetailHomeWorkSetInfo>(homeWorkSet);