Exemple #1
0
 private void tTransIn_TextChanged(object sender, EventArgs e)
 {
     if (!isChanging)
     {
         isChanging = true;
         string output          = tTransIn.Text;
         string originalLang    = tLangListFrom.Text;
         string translationLang = tLangListTo.Text;
         if (LabTask.CheckInput(new string[] { originalLang, translationLang }))
         {
             if (LabTask.CheckDictionary(originalLang + " - " + translationLang))
             {
                 foreach (string word in dictionaries[originalLang + " - " + translationLang].Keys)
                 {
                     output = Regex.Replace(output.ToLower(), word.ToLower(), dictionaries[originalLang + " - " + translationLang][word]);
                 }
                 tTransOut.Text = output;
             }
             else
             {
                 MessageBox.Show("Dictionary doesn't exist");
             }
         }
         else
         {
             MessageBox.Show("Select languages");
         }
         isChanging = false;
     }
 }
Exemple #2
0
        private void wTransIn_TextChanged(object sender, EventArgs e)
        {
            string originalLang    = wLangListFrom.Text;
            string translationLang = wLangListTo.Text;

            if (LabTask.CheckInput(new string[] { originalLang, translationLang }))
            {
                if (LabTask.CheckDictionary(originalLang + " - " + translationLang))
                {
                    string word = wTransIn.Text;
                    if (dictionaries[originalLang + " - " + translationLang].Keys.Contains(word))
                    {
                        wTransOut.Text = dictionaries[originalLang + " - " + translationLang][word];
                    }
                }
                else
                {
                    MessageBox.Show("Dictionary doesn't exist");
                }
            }
            else
            {
                MessageBox.Show("Select languages");
            }
        }
Exemple #3
0
        private void addWord_Click(object sender, EventArgs e)
        {
            string originalLang    = aLangListFrom.Text;
            string translationLang = aLangListTo.Text;

            if (LabTask.CheckInput(new string[] { originalLang, translationLang }))
            {
                if (LabTask.CheckDictionary(originalLang + " - " + translationLang))
                {
                    string word        = aWord.Text;
                    string translation = aTranslation.Text;
                    if (LabTask.CheckInput(new string[] { word, translation }))
                    {
                        if (!dictionaries[originalLang + " - " + translationLang].Keys.Contains(word))
                        {
                            dictionaries[originalLang + " - " + translationLang].Add(word, translation);
                        }
                        else
                        {
                            MessageBox.Show("Translation already exists");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Input value");
                    }
                }
                else
                {
                    MessageBox.Show("Dictionary doesn't exist");
                }
            }
            else
            {
                MessageBox.Show("Select languages");
            }
        }