示例#1
0
 /// <summary>
 /// /// if vocab index changed reinit affected data (vocab,pic,sound,btns)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void VocabSelectBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (VocabSelectBox.Text == "Add...")
     {
         QuestionTextBox.Clear();
         AnswerTextBox.Clear();
         PicBox.Image = null;
         AddChangePictureBtn.Enabled = true;
         AddChangeSoundBtn.Enabled   = true;
         DeleteVocabBtn.Enabled      = false;
         NextSaveButton.Text         = "Save";
     }
     else
     {
         Vocab = (db.GetVocabs((GroupSelectBox.SelectedIndex + 1),
                               db.getuserid("admin")))[VocabSelectBox.SelectedIndex]; //load vocab
         QuestionTextBox.Text = Vocab.german;
         AnswerTextBox.Text   = Vocab.english;
         if (Vocab.picturepath != "")                                      //load picture
         {
             PicBox.Image             = Image.FromFile(Vocab.picturepath); //picbox load image
             PicBox.SizeMode          = PictureBoxSizeMode.Zoom;           //autosize
             AddChangePictureBtn.Text = "Change";
             DeletePictureBtn.Enabled = true;
         }
         else
         {
             PicBox.Image             = null;
             AddChangePictureBtn.Text = "Add";
             DeletePictureBtn.Enabled = false;
         }
         if (Vocab.soundpath != "")   //load sound
         {
             WMPLib.IWMPMedia media = WMPbox.newMedia(Vocab.soundpath);
             WMPbox.currentPlaylist.appendItem(media);
             AddChangeSoundBtn.Text = "Change";
             DeleteSoundBtn.Enabled = true;
         }
         else
         {
             WMPbox.close();                 //clear soundbox
             AddChangeSoundBtn.Text = "Add";
             DeleteSoundBtn.Enabled = false; //set btns
         }
         NextSaveButton.Text         = "Next";
         AddChangePictureBtn.Enabled = true;
         AddChangeSoundBtn.Enabled   = true;
         DeleteVocabBtn.Enabled      = true;
     }
     if (VocabSelectBox.SelectedIndex == 0)  //set to previous btn
     {
         PrevBtn.Enabled = false;
     }
     else
     {
         PrevBtn.Enabled = true;
     }
     toolStripStatusLabel1.Text = "";    //refresh tooltip
 }
示例#2
0
 void Resetting()
 {
     mode     = null;
     function = null;
     ModeSelection.SelectedItem     = null;
     FunctionSelection.SelectedItem = null;
     TextBox.Clear();
     SelectionOfAnswers.Items.Clear();
     AnswerTextBox.Clear();
     CorrectAnswerChecker.Checked = false;
 }
示例#3
0
 void SelectedFunctionChanged(object sender, EventArgs e)
 {
     function = (byte)FunctionSelection.SelectedIndex;
     if (mode == 0)
     {
         if (function == 0)
         {
             TextBox.Clear();
         }
         else if (function == 1)
         {
             AnswerTextBox.Clear();
         }
     }
     ShowingUp();
 }
示例#4
0
        private void NextButton_Click(object sender, RoutedEventArgs e)
        {
            //first read the user's answer
            float userAnswer = float.Parse(AnswerTextBox.Text);

            //then fire ov the event that te user answered a question
            UserEvents.OnUserAnsweredQuestion(this, new AnswerEventArgs()
            {
                Answer = userAnswer
            });

            //reset the label and textbox and total questions
            TotalQuestionsLabel.Content = TM.TheTestStats.TotalQuestions;
            EquationLabel.Content       = TM.TheTestStats.CurrentEquation.FullEquation;
            AnswerTextBox.Clear();
        }
示例#5
0
 /// <summary>
 /// Get next vocab or save new generated vocab to db (toogle "next"/"save" btn)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NextSaveButton_Click(object sender, EventArgs e)
 {
     if (NextSaveButton.Text == "Save")
     {
         //get filepaths if allrdy set
         string picturepath = Vocab.picturepath;
         string soundpath   = Vocab.soundpath;
         Vocab         = new Vocab();                                                                      //generate new Vocab
         Vocab.english = AnswerTextBox.Text;                                                               //read text box, set Vocab propertys
         Vocab.german  = QuestionTextBox.Text;
         db.SaveNewVocab(Vocab, GroupSelectBox.SelectedIndex + 1, picturepath, soundpath);                 //save to db
         toolStripStatusLabel1.Text = "Q: " + QuestionTextBox.Text + "A: " + AnswerTextBox.Text + "saved"; //settooltip
         VocabSelectBox.Items.Clear();                                                                     //clear vocablist
         foreach (Vocab German in db.GetVocabs((GroupSelectBox.SelectedIndex + 1), db.getuserid("admin"))) //reload vocablist
         {
             VocabSelectBox.Items.Add(German.german);
         }
         VocabSelectBox.Items.Add("Add...");                            //add last entry
         VocabSelectBox.SelectedIndex = VocabSelectBox.Items.Count - 2; //set index to last vocab
         NextSaveButton.Text          = "Next";
         AddChangePictureBtn.Enabled  = true;
         AddChangeSoundBtn.Enabled    = true;
     }
     else
     {
         if (VocabSelectBox.SelectedIndex + 1 < VocabSelectBox.Items.Count) //check if we have a next vocab
         {
             Vocab = (db.GetVocabs((GroupSelectBox.SelectedIndex + 1),
                                   db.getuserid("admin")))[VocabSelectBox.SelectedIndex]; //load next vocab in Textbox
             VocabSelectBox.SelectedIndex++;                                              //set VocabSelectBox
         }
         else //no next vocab
         {
             //clear text box
             QuestionTextBox.Clear();
             AnswerTextBox.Clear();
             //clear picturebox
             PicBox.Image = null;
             //set btns
             DeletePictureBtn.Enabled = false;
             AddChangePictureBtn.Text = "Add";
             NextSaveButton.Text      = "Save";
         }
     }
 }
示例#6
0
        void aaa()
        {
            AnswerTextBox.Clear();
            words.Clear();

            InputText = textBox1.Text;
            splitText = InputText.Split(' ', ',', '.', '/', ';', '[', ']', '-', '=', '_', '+', '{', '}', '|', '\\', ':', '<', '>', '?', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '\'', '\n', '\t', '\"', '\r', '\f', '\v', (char)StringSplitOptions.RemoveEmptyEntries);

            foreach (string child in splitText)
            {
                int cc = 0;
                words.TryGetValue(child, out cc);

                cc++;
                words[child] = cc;
            }
            var sortedDict = from entry in words orderby entry.Value ascending select entry;

            //foreach(string child in sortedDict) {
            foreach (KeyValuePair <string, int> child in sortedDict)
            {
                AnswerTextBox.AppendText(child.Key + " = " + child.Value + Environment.NewLine);
            }
        }
 private void SetupTextBoxes()
 {
     AnswerTextBox.Clear();
     QuestionTextBox.Focus();
     AnswerTextBox.Focus();
 }