Esempio n. 1
0
 private void QuizForm_Load(object sender, EventArgs e)
 {
     XmlMethods.LoadXDocumnet(file);                                //Load the document (file creating remove when catch exception).
     setValuesToControl(0);                                         //set the first question fro file
     lblDescription.Text = XmlMethods.getQuention(file, Des, "1");
     lblQRemaining.Text  = "Question NO. : " + 1 + "/" + ID.Length; //set the first question number
 }
Esempio n. 2
0
 private void btnInsert_Click(object sender, EventArgs e)
 {
     if (textID.Text == "" | textQes.Text == "" |
         textOp1.Text == "" | textOp2.Text == "" |
         textOp3.Text == "" | textOp4.Text == "" |
         textCorrect.Text == "")
     {
         markRedIFEmpty();
         MessageBox.Show("Fill All Box");
     }
     else
     {
         if (!Ids.Contains(textID.Text))
         {
             XmlMethods.InsertNewField(filename, textID.Text,
                                       textQes.Text, textOp1.Text, textOp2.Text, textOp3.Text,
                                       textOp4.Text, textCorrect.Text, textDescrip.Text);
             currentID++;
             MessageBox.Show("Saved!");
             cleanAll();   //clear all the option and question text box  for next entry
             resetColor(); //reset the color to blue.
             if (autoID == false)
             {
                 textID.Text = (getMaxID() + 1).ToString();
             }
             updateList();
         }
         else
         {
             MessageBox.Show("ID Already There!");
         }
     }
 }
Esempio n. 3
0
        private int howManyNumber2()
        {
            Ids = XmlMethods.getIDs(filename);
            int    cur            = Ids.Count();
            string getLastElement = Ids[cur - 1];

            return(int.Parse(getLastElement));
        }
Esempio n. 4
0
        } //check the ans by comparing it with the ans

        private void setValuesToControl(int IDs)
        {
            lblQuestion.Text    = ID[IDs] + ".\n" + XmlMethods.getQuention(file, question, ID[IDs]);
            radioOption1.Text   = XmlMethods.getQuention(file, Op_1, ID[IDs]);
            radioOption2.Text   = XmlMethods.getQuention(file, Op_2, ID[IDs]);
            radioOption3.Text   = XmlMethods.getQuention(file, Op_3, ID[IDs]);
            radioOption4.Text   = XmlMethods.getQuention(file, Op_4, ID[IDs]);
            lblAns.Text         = XmlMethods.getQuention(file, Ans, ID[IDs]);
            lblDescription.Text = XmlMethods.getQuention(file, Des, ID[IDs]);
        } //set all ans and question to their control
Esempio n. 5
0
        /*----------------------End Buttons Action-----------------------*/



        /*-------------------------Methods-------------------------*/

        private void setValuesToControl(int IDs)
        {
            isAnsShown        = false;
            lblQuestion.Text  = ID[IDs] + ".\n" + XmlMethods.getQuention(file, question, ID[IDs]);
            radioOption1.Text = XmlMethods.getQuention(file, Op_1, ID[IDs]);
            radioOption2.Text = XmlMethods.getQuention(file, Op_2, ID[IDs]);
            radioOption3.Text = XmlMethods.getQuention(file, Op_3, ID[IDs]);
            radioOption4.Text = XmlMethods.getQuention(file, Op_4, ID[IDs]);
            val1 = Convert.ToInt32(XmlMethods.getQuention(file, OpVal_1, ID[IDs]));
            val2 = Convert.ToInt32(XmlMethods.getQuention(file, OpVal_2, ID[IDs]));
            val3 = Convert.ToInt32(XmlMethods.getQuention(file, OpVal_3, ID[IDs]));
            val4 = Convert.ToInt32(XmlMethods.getQuention(file, OpVal_4, ID[IDs]));
        } //set all ans and question to their control
Esempio n. 6
0
        public int getMaxID()
        {
            List <int> id = new List <int>(100);

            Ids = XmlMethods.getIDs(filename);
            foreach (string item in Ids)
            {
                id.Add(int.Parse(item));
            }
            int getLastElement = id.Max();

            // Console.Write("max is" + getLastElement);
            return(getLastElement);
        }
Esempio n. 7
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string IDs = (string)listBox1.SelectedItem;

            toolTip1.Show(string.Format("Question No {0}\n{1}\n{2}\n{3}\n{4}\n{5}\nAns: {6}", IDs,
                                        XmlMethods.getQuention(filename, "Qs", IDs),
                                        XmlMethods.getQuention(filename, "Op1", IDs),
                                        XmlMethods.getQuention(filename, "Op2", IDs),
                                        XmlMethods.getQuention(filename, "Op3", IDs),
                                        XmlMethods.getQuention(filename, "Op4", IDs),
                                        XmlMethods.getQuention(filename, "Ans", IDs)

                                        ), listBox1, 1000);
        }
Esempio n. 8
0
        private void EntryForm_Load(object sender, EventArgs e)
        {
            doc = XmlMethods.LoadXDocumnet(filename);


            currentID   = getMaxID();
            textID.Text = (currentID + 1).ToString();

            Console.WriteLine("Max is {0}", getMaxID());

            Console.WriteLine("Next Id is {0}", getMaxID() + 1);

            updateList();

            textID.Enabled = false;
        }
Esempio n. 9
0
        private void button2_Click(object sender, EventArgs e)
        {
            string       Id      = listBox1.SelectedItem.ToString();
            DialogResult deleteD = MessageBox.Show("Вы хотите удалить вопрос под номером " + Id, "Удалить",
                                                   MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (deleteD == DialogResult.Yes)
            {
                XmlMethods.DeleteField(filename, Id);
                updateList();
                currentID = getMaxID() + 1;



                textID.Text = currentID.ToString();
            }
        }
Esempio n. 10
0
        private void btnQuiz_Click(object sender, EventArgs e)
        {
            try
            {
                Number    = XmlMethods.getNumberOfElement(filename);
                NumberOFQ = Number;
            }
            catch (FormatException)
            {
                Number    = 18;
                NumberOFQ = Number;
            }


            Console.WriteLine(Number);

            QuizForm quizForm = new QuizForm();

            quizForm.Show();
        }
Esempio n. 11
0
 private void updateList()
 {
     Ids = XmlMethods.getIDs(filename);
     listBox1.DataSource = Ids;
     listBox1.Sorted     = true;
 }