Пример #1
0
 /// <summary>
 /// 新建题目
 /// </summary>
 private void NewExercise()
 {
     NewExerciseForm form = new NewExerciseForm();
     form.ShowDialog(this);
     if (form.DialogResult == DialogResult.OK)
     {
         this._CurrExercise = form.Exercise;
         this._DoPanel.SetPanelValue(_CurrExercise.SingleExercise);
     }
     form.Dispose();
     form = null;
 }
Пример #2
0
 private void _AcceptButton_Click(object sender, EventArgs e)
 {
     if (this.DoString.Length != 81 && this.DoString.Length != 161)
     {
         MessageBox.Show("Text cannot DoData!\r\nPlease reinput!");
         this._ExerciseTextBox.Focus();
     }
     else
     {
         this.DialogResult = DialogResult.OK;
         this.Exercise = new SudoExercise("", "", this._ExerciseTextBox.Text);
         this.Close();
     }
 }
Пример #3
0
 internal static SudoExercise Parse(XmlElement element)
 {
     SudoExercise exercise = new SudoExercise();
     exercise.ID             = XmlHelper.GetElementByName(element, "ID").InnerText;
     exercise.CreaterEmail   = XmlHelper.GetElementByName(element, "CreaterEmail").InnerText;
     exercise.PlayerEmail    = XmlHelper.GetElementByName(element, "PlayerEmail").InnerText;
     exercise.SingleExercise = XmlHelper.GetElementByName(element, "Exercise").InnerText;
     exercise.Solution       = XmlHelper.GetElementByName(element, "Solution").InnerText;
     string durationString   = XmlHelper.GetElementByName(element, "SolveDuration").InnerText;
     if (string.IsNullOrEmpty(durationString) || durationString == "0")
     {
         exercise.SolveDuration = DateTime.Parse(durationString);
     }
     exercise.SolveTime      = int.Parse(XmlHelper.GetElementByName(element, "SolveTime").InnerText);
     return exercise;
 }
Пример #4
0
        public SudoExercise[] SelectExercises(SudoDifficulty difficulty)
        {
            List <SudoExercise> exerciseList = new List <SudoExercise>();
            XmlElement          dataelement  = this.GetDifficultyElement(difficulty);

            foreach (XmlNode node in dataelement.ChildNodes)
            {
                if (node.NodeType != XmlNodeType.Element)
                {
                    break;
                }
                XmlElement ele = (XmlElement)node;
                exerciseList.Add(SudoExercise.Parse(ele));
            }
            return(exerciseList.ToArray());
        }
Пример #5
0
        public void CreatDoExerciseElement(SudoDifficulty difficulty, SudoExercise exercise)
        {
            XmlDocument rootDoc     = (XmlDocument)(this.BaseXmlNode);
            XmlElement  dataElement = rootDoc.CreateElement("data");

            XmlElement dataChildElement;

            dataChildElement           = rootDoc.CreateElement("ID");
            dataChildElement.InnerText = exercise.ID;
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("Exercise");
            dataChildElement.InnerText = exercise.SingleExercise;
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("Solution");
            dataChildElement.InnerText = exercise.Solution;
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("CreaterEmail");
            dataChildElement.InnerText = exercise.CreaterEmail;
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("PlayerEmail");
            dataChildElement.InnerText = exercise.PlayerEmail;
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("SolveDuration");
            dataChildElement.InnerText = exercise.SolveDuration.ToShortTimeString();
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("SolveTime");
            dataChildElement.InnerText = exercise.SolveTime.ToString();
            dataElement.AppendChild(dataChildElement);

            this.GetDifficultyElement(difficulty).AppendChild(dataElement);
        }
Пример #6
0
        public void CreatDoExerciseElement(SudoDifficulty difficulty, SudoExercise exercise)
        {
            XmlDocument rootDoc = (XmlDocument)(this.BaseXmlNode);
            XmlElement dataElement = rootDoc.CreateElement("data");

            XmlElement dataChildElement;

            dataChildElement = rootDoc.CreateElement("ID");
            dataChildElement.InnerText = exercise.ID;
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("Exercise");
            dataChildElement.InnerText = exercise.SingleExercise;
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("Solution");
            dataChildElement.InnerText = exercise.Solution;
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("CreaterEmail");
            dataChildElement.InnerText = exercise.CreaterEmail;
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("PlayerEmail");
            dataChildElement.InnerText = exercise.PlayerEmail;
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("SolveDuration");
            dataChildElement.InnerText = exercise.SolveDuration.ToShortTimeString();
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("SolveTime");
            dataChildElement.InnerText = exercise.SolveTime.ToString();
            dataElement.AppendChild(dataChildElement);

            this.GetDifficultyElement(difficulty).AppendChild(dataElement);
        }
Пример #7
0
 internal static SudoExercise Parse(XmlElement element)
 {
     SudoExercise exercise = new SudoExercise();
     exercise.ID             = XmlHelper.GetElementByName(element, "ID").InnerText;
     exercise.CreaterEmail   = XmlHelper.GetElementByName(element, "CreaterEmail").InnerText;
     exercise.PlayerEmail    = XmlHelper.GetElementByName(element, "PlayerEmail").InnerText;
     exercise.SingleExercise = XmlHelper.GetElementByName(element, "Exercise").InnerText;
     exercise.Solution       = XmlHelper.GetElementByName(element, "Solution").InnerText;
     string durationString   = XmlHelper.GetElementByName(element, "SolveDuration").InnerText;
     if (string.IsNullOrEmpty(durationString) || durationString == "0")
     {
         exercise.SolveDuration = DateTime.Parse(durationString);
     }
     exercise.SolveTime      = int.Parse(XmlHelper.GetElementByName(element, "SolveTime").InnerText);
     return exercise;
 }