diff --git a/StudentManager/App.xaml.cs b/StudentManager/App.xaml.cs index f90829b..0b1f059 100644 --- a/StudentManager/App.xaml.cs +++ b/StudentManager/App.xaml.cs @@ -24,6 +24,7 @@ namespace StudentManager containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterForNavigation(); } } diff --git a/StudentManager/Common/ErrorSet.cs b/StudentManager/Common/ErrorSet.cs index 02e01c6..1f2d3b6 100644 --- a/StudentManager/Common/ErrorSet.cs +++ b/StudentManager/Common/ErrorSet.cs @@ -68,8 +68,8 @@ namespace StudentManager.Common TotalErrorCount = Errores.Count(), CorrectCount = CorrectArray.Count(), ErrorCount = ErrorArray.Count(), - ErrorRate = ErrorArray.Count() / QuestionLib.GetQuestionCount(), - CorrectRate = CorrectArray.Count() / Errores.Count() + ErrorRate = QuestionLib.GetQuestionCount() == 0 ? 100 : ErrorArray.Count() / QuestionLib.GetQuestionCount(), + CorrectRate = Errores.Count() == 0 ? 100 : CorrectArray.Count() / Errores.Count() }; } diff --git a/StudentManager/Data/QuestionData.cs b/StudentManager/Data/QuestionData.cs index cc7fe7e..7e6fa9f 100644 --- a/StudentManager/Data/QuestionData.cs +++ b/StudentManager/Data/QuestionData.cs @@ -20,6 +20,14 @@ namespace StudentManager.Data deprecated, } + public enum QType + { + 选择题, + 填空题, + 写作, + + } + public class QuestionData : IDataCommon { public int Id { get; set; } = 0; diff --git a/StudentManager/Data/QuestionLib.cs b/StudentManager/Data/QuestionLib.cs index af4d9eb..424d199 100644 --- a/StudentManager/Data/QuestionLib.cs +++ b/StudentManager/Data/QuestionLib.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualBasic; +using Google.Protobuf.WellKnownTypes; +using Microsoft.VisualBasic; using StudentManager.Common; using System; using System.Collections.Generic; @@ -65,6 +66,7 @@ namespace StudentManager.Data public static void Remove(QuestionData question) { + if (question == null) throw new NullReferenceException(); QuestionDic.Remove(question.Id); } diff --git a/StudentManager/Editor/AddQuestionView.xaml b/StudentManager/Editor/AddQuestionView.xaml new file mode 100644 index 0000000..ab92584 --- /dev/null +++ b/StudentManager/Editor/AddQuestionView.xaml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +