private void buttondelete_Click(object sender, EventArgs e)
        {
            Boolean Checked = true;

            for (int i = 0; i < this.show_question.Items.Count; i++)
            {
                if (this.show_question.Items[i].Checked == true)
                {
                    Checked = false;
                    ProblemList.Delete(int.Parse(this.show_question.Items[i].SubItems[1].Text));
                    ProblemList.Save();
                    ;
                }
            }
            //MessageBox.Show(this.show_question.Items[2].SubItems[1].Text);
            if (Checked)
            {
                MessageBox.Show("没有选择要删除的题目");
            }
            else
            {
                this.show_question.Items.Clear();
                showlist();
            }
        }
 private void btn_Save_Click(object sender, EventArgs e)
 {
     foreach (int key in problems.Keys)
     {
         if (this.Main_TreeView.SelectedNode.Text == ProblemList.GetProblem(key).QuestionName)
         {
             // ProblemList.GetProblem(key).QuestionDescription = this.Problem_Description_HTML.Text;
         }
     }
     ProblemList.Save();
 }
Esempio n. 3
0
 private void delete(object sender, EventArgs e)
 {
     treeView1.Nodes.Remove(treeView1.SelectedNode);
     foreach (int key in problems.Keys)
     {
         if (treeView1.SelectedNode.Text == ProblemList.GetProblem(key).QuestionName)
         {
             ProblemList.Delete(ProblemList.GetProblem(key).ProblemID);
             ProblemList.Save();
             break;
         }
     }
 }
Esempio n. 4
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (checkProblem())
                {
                    MessageBox.Show("请完善信息");
                    return;
                }

                string[] inputSamples  = this.InputSampleInput.Text.Split(';');
                string[] outputSamples = this.OutputSampleInput.Text.Split(';');
                if (inputSamples.Length != outputSamples.Length)
                {
                    MessageBox.Show("输入及输出样例不匹配");
                    return;
                }
                string             problemName       = this.ProblemNameInput.Text;
                string             timeLimit         = this.TimeLimitInput.Text;
                string             memoryLimit       = this.MemoryLimitInput.Text;
                string             inputDescription  = this.InputDescriptionInput.Text;
                string             outputDesctiption = this.OutputDescriptionInput.Text;
                string             inputSample       = this.InputSampleInput.Text;
                string             outputSample      = this.OutputSampleInput.Text;
                string             hint       = this.hintInput.Text;
                string             decription = this.DescriptionInput.Text;
                StructureOfProblem newProblem = new StructureOfProblem();
                newProblem.ProblemID           = ProblemList.GetAll().Values.Last().ProblemID + 1;
                newProblem.Hint                = hint;
                newProblem.QuestionName        = problemName;
                newProblem.TimeLimitIndex      = timeLimit;
                newProblem.MemoryLimitIndex    = memoryLimit;
                newProblem.InputDescription    = inputDescription;
                newProblem.OutputDescription   = outputDesctiption;
                newProblem.InputSample         = inputSample;
                newProblem.OutputSample        = outputSample;
                newProblem.QuestionDescription = decription;
                ProblemList.Add(newProblem);
                ProblemList.Save();
                MessageBox.Show("添加成功");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
                return;
            }
            ((Form1)(this.ParentForm)).TurnForm(new Questionbank());
        }
 private void ProDelBtn_Click(object sender, EventArgs e)
 {
     if (this.Main_TreeView.SelectedNode != null)
     {
         DialogResult dr = MessageBox.Show("确定删除“" + this.Main_TreeView.SelectedNode.Text
                                           + "”?", "", MessageBoxButtons.OKCancel);
         if (dr.Equals(DialogResult.OK))
         {
             this.Main_TreeView.Nodes.Remove(this.Main_TreeView.SelectedNode);
             foreach (int key in problems.Keys)
             {
                 if (this.Main_TreeView.SelectedNode.Text == ProblemList.GetProblem(key).QuestionName)
                 {
                     ProblemList.Delete(ProblemList.GetProblem(key).ProblemID);
                     ProblemList.Save();
                     break;
                 }
             }
         }
     }
 }