Create question local
This commit is contained in:
parent
13d82faca1
commit
8672bd5fc8
@ -24,6 +24,7 @@ namespace StudentManager
|
|||||||
containerRegistry.RegisterForNavigation<CheckView>();
|
containerRegistry.RegisterForNavigation<CheckView>();
|
||||||
containerRegistry.RegisterForNavigation<DetailView>();
|
containerRegistry.RegisterForNavigation<DetailView>();
|
||||||
containerRegistry.RegisterForNavigation<DetailCheckView>();
|
containerRegistry.RegisterForNavigation<DetailCheckView>();
|
||||||
|
containerRegistry.RegisterForNavigation<AddQuestionView>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ namespace StudentManager.Common
|
|||||||
TotalErrorCount = Errores.Count(),
|
TotalErrorCount = Errores.Count(),
|
||||||
CorrectCount = CorrectArray.Count(),
|
CorrectCount = CorrectArray.Count(),
|
||||||
ErrorCount = ErrorArray.Count(),
|
ErrorCount = ErrorArray.Count(),
|
||||||
ErrorRate = ErrorArray.Count() / QuestionLib.GetQuestionCount(),
|
ErrorRate = QuestionLib.GetQuestionCount() == 0 ? 100 : ErrorArray.Count() / QuestionLib.GetQuestionCount(),
|
||||||
CorrectRate = CorrectArray.Count() / Errores.Count()
|
CorrectRate = Errores.Count() == 0 ? 100 : CorrectArray.Count() / Errores.Count()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,14 @@ namespace StudentManager.Data
|
|||||||
deprecated,
|
deprecated,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum QType
|
||||||
|
{
|
||||||
|
选择题,
|
||||||
|
填空题,
|
||||||
|
写作,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public class QuestionData : IDataCommon
|
public class QuestionData : IDataCommon
|
||||||
{
|
{
|
||||||
public int Id { get; set; } = 0;
|
public int Id { get; set; } = 0;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.VisualBasic;
|
using Google.Protobuf.WellKnownTypes;
|
||||||
|
using Microsoft.VisualBasic;
|
||||||
using StudentManager.Common;
|
using StudentManager.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -65,6 +66,7 @@ namespace StudentManager.Data
|
|||||||
|
|
||||||
public static void Remove(QuestionData question)
|
public static void Remove(QuestionData question)
|
||||||
{
|
{
|
||||||
|
if (question == null) throw new NullReferenceException();
|
||||||
QuestionDic.Remove(question.Id);
|
QuestionDic.Remove(question.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
155
StudentManager/Editor/AddQuestionView.xaml
Normal file
155
StudentManager/Editor/AddQuestionView.xaml
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
<UserControl x:Class="StudentManager.Editor.AddQuestionView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:StudentManager.Editor"
|
||||||
|
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
|
xmlns:dt="clr-namespace:StudentManager.Data"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<Style TargetType="TextBox" BasedOn="{StaticResource MaterialDesignTextBox}" >
|
||||||
|
<Setter Property="MinWidth" Value="100"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="DifficultyEnumValues">
|
||||||
|
<ObjectDataProvider.MethodParameters>
|
||||||
|
<x:Type TypeName="dt:DifficultyLevel"/>
|
||||||
|
</ObjectDataProvider.MethodParameters>
|
||||||
|
</ObjectDataProvider>
|
||||||
|
|
||||||
|
<ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="TypeEnumValues">
|
||||||
|
<ObjectDataProvider.MethodParameters>
|
||||||
|
<x:Type TypeName="dt:QType"/>
|
||||||
|
</ObjectDataProvider.MethodParameters>
|
||||||
|
</ObjectDataProvider>
|
||||||
|
|
||||||
|
|
||||||
|
<ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="PublishEnumValues">
|
||||||
|
<ObjectDataProvider.MethodParameters>
|
||||||
|
<x:Type TypeName="dt:QStatus"/>
|
||||||
|
</ObjectDataProvider.MethodParameters>
|
||||||
|
</ObjectDataProvider>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid>
|
||||||
|
<DockPanel LastChildFill="False">
|
||||||
|
<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 SelectedIndex="0" 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 SelectedIndex="0" 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 SelectedIndex="0" 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"
|
||||||
|
Command="{Binding DataContext.RemoveNewColumnCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.HeaderTemplate>
|
||||||
|
<GridViewColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Button Content="删除" Style="{StaticResource MaterialDesignFlatButton}" Padding="5"
|
||||||
|
Command="{Binding DataContext.RemoveNewColumnCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.CellTemplate>
|
||||||
|
</GridViewColumn>
|
||||||
|
</GridView>
|
||||||
|
</ListView.View>
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
<Grid HorizontalAlignment="Stretch" DockPanel.Dock="Bottom">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button Content="提交" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="0"
|
||||||
|
Command="{Binding SubmitAddQuestionsCommand}"/>
|
||||||
|
<Button Content="清除" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="1"
|
||||||
|
Command="{Binding ClearnAddQuestionsCommand}"/>
|
||||||
|
</Grid>
|
||||||
|
</DockPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
28
StudentManager/Editor/AddQuestionView.xaml.cs
Normal file
28
StudentManager/Editor/AddQuestionView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace StudentManager.Editor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// AddQuestionView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class AddQuestionView : UserControl
|
||||||
|
{
|
||||||
|
public AddQuestionView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,10 +7,13 @@
|
|||||||
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"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
|
xmlns:dt="clr-namespace:StudentManager.Data"
|
||||||
Background="#FF333333"
|
Background="#FF333333"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="MainEditor" Height="450" Width="800">
|
Title="MainEditor" Height="450" Width="800">
|
||||||
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="100"/>
|
<ColumnDefinition Width="100"/>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:StudentManager.Editor"
|
xmlns:local="clr-namespace:StudentManager.Editor"
|
||||||
|
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>
|
<UserControl.Resources>
|
||||||
@ -12,31 +13,17 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<!--<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>--><!--
|
|
||||||
<ListBox.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Width="50" Style="{StaticResource TextStyle}" Text="{Binding Id}"/>
|
|
||||||
<TextBlock Width="50" Style="{StaticResource TextStyle}" Text="{Binding Type}"/>
|
|
||||||
<TextBlock Width="50" Style="{StaticResource TextStyle}" Text="{Binding Stem}"/>
|
|
||||||
<TextBlock Width="50" Style="{StaticResource TextStyle}" Text="{Binding Answer}"/>
|
|
||||||
<TextBlock Width="50" Style="{StaticResource TextStyle}" Text="{Binding DifficultyLevel}"/>
|
|
||||||
<TextBlock Width="50" Style="{StaticResource TextStyle}" Text="{Binding Category}"/>
|
|
||||||
<TextBlock Width="50" Style="{StaticResource TextStyle}" Text="{Binding Tags}"/>
|
|
||||||
<TextBlock Width="50" Style="{StaticResource TextStyle}" Text="{Binding Source}"/>
|
|
||||||
<TextBlock Width="50" Style="{StaticResource TextStyle}" Text="{Binding Status}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListBox.ItemTemplate>
|
|
||||||
</ListBox>-->
|
|
||||||
|
|
||||||
<ListView ItemsSource="{Binding QuestionDatas}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
<ListView ItemsSource="{Binding QuestionDatas}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="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>
|
<ListView.View>
|
||||||
<GridView>
|
<GridView>
|
||||||
<GridViewColumn
|
<GridViewColumn
|
||||||
@ -63,6 +50,15 @@
|
|||||||
<GridViewColumn
|
<GridViewColumn
|
||||||
DisplayMemberBinding="{Binding Status}"
|
DisplayMemberBinding="{Binding Status}"
|
||||||
Header="状态" />
|
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>
|
</GridView>
|
||||||
</ListView.View>
|
</ListView.View>
|
||||||
</ListView>
|
</ListView>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Mysqlx.Crud;
|
using Mysqlx.Crud;
|
||||||
|
using Org.BouncyCastle.Utilities;
|
||||||
using StudentManager.Common;
|
using StudentManager.Common;
|
||||||
using StudentManager.Data;
|
using StudentManager.Data;
|
||||||
using StudentManager.Extensions;
|
using StudentManager.Extensions;
|
||||||
@ -7,8 +8,10 @@ using System.Collections.Generic;
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace StudentManager.Model
|
namespace StudentManager.Model
|
||||||
{
|
{
|
||||||
@ -51,7 +54,11 @@ namespace StudentManager.Model
|
|||||||
public ReadOnlyObservableCollection<StudentInfo> StudentDatas { get; private set; }
|
public ReadOnlyObservableCollection<StudentInfo> StudentDatas { get; private set; }
|
||||||
|
|
||||||
private ObservableCollection<QuestionData> questionDatas = new ObservableCollection<QuestionData>();
|
private ObservableCollection<QuestionData> questionDatas = new ObservableCollection<QuestionData>();
|
||||||
public ReadOnlyObservableCollection<QuestionData> QuestionDatas { get; private set; }
|
public ObservableCollection<QuestionData> QuestionDatas { get { return questionDatas; } private set { questionDatas = value; RaisePropertyChanged(); } }
|
||||||
|
|
||||||
|
private ObservableCollection<QuestionData> preToRemove = new ObservableCollection<QuestionData>();
|
||||||
|
private ObservableCollection<QuestionData> addQuestionDatas = new ObservableCollection<QuestionData>();
|
||||||
|
public ObservableCollection<QuestionData> ADDQuestionDatas { get { return addQuestionDatas; } private set { addQuestionDatas = value; RaisePropertyChanged(); } }
|
||||||
|
|
||||||
private ObservableCollection<DetailErrorInfo> errorSetDatas = new ObservableCollection<DetailErrorInfo>();
|
private ObservableCollection<DetailErrorInfo> errorSetDatas = new ObservableCollection<DetailErrorInfo>();
|
||||||
public ReadOnlyObservableCollection<DetailErrorInfo> ErrorSetDatas { get; private set; }
|
public ReadOnlyObservableCollection<DetailErrorInfo> ErrorSetDatas { get; private set; }
|
||||||
@ -126,8 +133,13 @@ namespace StudentManager.Model
|
|||||||
public DelegateCommand<StudentInfo> SelectedCommand { get; set; }
|
public DelegateCommand<StudentInfo> SelectedCommand { get; set; }
|
||||||
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<QuestionData> DeleteQuestionCommand { get; set; }
|
||||||
|
public DelegateCommand<QuestionData> RemoveNewColumnCommand { get; set; }
|
||||||
public DelegateCommand RegionToDetailCommand { get; set; }
|
public DelegateCommand RegionToDetailCommand { get; set; }
|
||||||
public DelegateCommand SubmitHomeWorkCommand { get; set; }
|
public DelegateCommand SubmitHomeWorkCommand { get; set; }
|
||||||
|
public DelegateCommand AddNewColumnCommand { get; set; }
|
||||||
|
public DelegateCommand SubmitAddQuestionsCommand { get; set; }
|
||||||
|
public DelegateCommand ClearnAddQuestionsCommand { get; set; }
|
||||||
|
|
||||||
Students(IRegionManager regionManager)
|
Students(IRegionManager regionManager)
|
||||||
{
|
{
|
||||||
@ -168,11 +180,61 @@ namespace StudentManager.Model
|
|||||||
//HomeWork =
|
//HomeWork =
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DeleteQuestionCommand = new DelegateCommand<QuestionData>((x) =>
|
||||||
|
{
|
||||||
|
if(x == null) return;
|
||||||
|
var c = MessageBox.Show("确定删除吗?","确认",MessageBoxButton.OKCancel);
|
||||||
|
if (c != MessageBoxResult.OK) return;
|
||||||
|
QuestionLib.Remove(x);
|
||||||
|
QuestionDatas = QuestionLib.GetAllQuestion();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
RemoveNewColumnCommand = new DelegateCommand<QuestionData>((x) =>
|
||||||
|
{
|
||||||
|
if (x == null) return;
|
||||||
|
var c = MessageBox.Show("确定删除吗?", "确认", MessageBoxButton.OKCancel);
|
||||||
|
if (c != MessageBoxResult.OK) return;
|
||||||
|
ADDQuestionDatas.Remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddNewColumnCommand = new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
ADDQuestionDatas.Add(new QuestionData { });
|
||||||
|
});
|
||||||
|
|
||||||
|
ClearnAddQuestionsCommand = new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
var c = MessageBox.Show("确定清除吗?", "清除所有题目", MessageBoxButton.OKCancel);
|
||||||
|
if (c != MessageBoxResult.OK) return;
|
||||||
|
ADDQuestionDatas.Clear();
|
||||||
|
});
|
||||||
|
|
||||||
|
SubmitAddQuestionsCommand = new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var item in ADDQuestionDatas)
|
||||||
|
{
|
||||||
|
item.Id = ConvertToHashInt(item.Stem);
|
||||||
|
|
||||||
|
if (!(QuestionLib.Get(item.Id) == null)) continue;
|
||||||
|
if (string.IsNullOrEmpty(item.Stem) || string.IsNullOrEmpty(item.Source) || string.IsNullOrEmpty(item.Answer)) continue;
|
||||||
|
QuestionLib.Add(item);
|
||||||
|
preToRemove.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in preToRemove)
|
||||||
|
{
|
||||||
|
ADDQuestionDatas.Remove(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
Load();
|
Load();
|
||||||
|
|
||||||
StudentDatas = new ReadOnlyObservableCollection<StudentInfo>(studentDatas);
|
StudentDatas = new ReadOnlyObservableCollection<StudentInfo>(studentDatas);
|
||||||
QuestionDatas = new ReadOnlyObservableCollection<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);
|
//CQDatas = new ReadOnlyObservableCollection<CursonQuestionsData>(cQDatas);
|
||||||
@ -187,6 +249,13 @@ namespace StudentManager.Model
|
|||||||
SaveAll();
|
SaveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int ConvertToHashInt(string item)
|
||||||
|
{
|
||||||
|
var hash = SHA256.Create();
|
||||||
|
var result = hash.ComputeHash(Encoding.UTF8.GetBytes(item));
|
||||||
|
return BitConverter.ToInt32(result, 0);
|
||||||
|
}
|
||||||
|
|
||||||
private void SubmitHomeWork()
|
private void SubmitHomeWork()
|
||||||
{
|
{
|
||||||
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).Questions.ForEach(x =>
|
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).Questions.ForEach(x =>
|
||||||
@ -220,7 +289,7 @@ namespace StudentManager.Model
|
|||||||
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "题库", NameSpace = "QuestionsView" });
|
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "题库", NameSpace = "QuestionsView" });
|
||||||
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "审批", NameSpace = "CheckView" });
|
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "审批", NameSpace = "CheckView" });
|
||||||
//menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "出题", NameSpace = "QuestionsView" });
|
//menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "出题", NameSpace = "QuestionsView" });
|
||||||
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "出题", NameSpace = "DetailCheckView" });
|
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "出题", NameSpace = "AddQuestionView" });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Load()
|
private void Load()
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Update="Editor\AddQuestionView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Editor\CheckView.xaml.cs">
|
<Compile Update="Editor\CheckView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -27,6 +30,9 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Page Update="Editor\AddQuestionView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Editor\CheckView.xaml">
|
<Page Update="Editor\CheckView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
Loading…
Reference in New Issue
Block a user