Esempio n. 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;
     }
 }
Esempio n. 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");
            }
        }
Esempio n. 3
0
        private void MainFrame_Load(object sender, EventArgs e)
        {
            languages = new List <string>
            {
                "Arabian",
                "Ukranian"
            };
            dictionaries = new Dictionary <string, Dictionary <string, string> >
            {
                { "Arabian - Ukranian", new Dictionary <string, string>() },
                { "Ukranian - Arabian", new Dictionary <string, string>() }
            };

            // "Ukranian - Arabian"
            dictionaries["Ukranian - Arabian"].Add("доброго дня", "مساء الخير");
            dictionaries["Ukranian - Arabian"].Add("шлях", "الطريق");
            dictionaries["Ukranian - Arabian"].Add("навчання", "تعليم");
            dictionaries["Ukranian - Arabian"].Add("йти до мети", "اذهب الى الهدف");
            dictionaries["Ukranian - Arabian"].Add("зупинка", "توقف");
            dictionaries["Ukranian - Arabian"].Add("спати", "للنوم");
            dictionaries["Ukranian - Arabian"].Add("щільно", "المكتظة");
            dictionaries["Ukranian - Arabian"].Add("дружба", "صداقة");
            dictionaries["Ukranian - Arabian"].Add("чимало", "كثير");
            dictionaries["Ukranian - Arabian"].Add("найбагатший", "أغنى");

            // "Arabian - Ukranian"
            dictionaries["Arabian - Ukranian"].Add("مساء الخير", "доброго дня");
            dictionaries["Arabian - Ukranian"].Add("الطريق", "шлях");
            dictionaries["Arabian - Ukranian"].Add("تعليم", "навчання");
            dictionaries["Arabian - Ukranian"].Add("اذهب الى الهدف", "йти до мети");
            dictionaries["Arabian - Ukranian"].Add("توقف", "зупинка");
            dictionaries["Arabian - Ukranian"].Add("للنوم", "спати");
            dictionaries["Arabian - Ukranian"].Add("المكتظة", "щільно");
            dictionaries["Arabian - Ukranian"].Add("صداقة", "дружба");
            dictionaries["Arabian - Ukranian"].Add("كثير", "чимало");
            dictionaries["Arabian - Ukranian"].Add("أغنى", "найбагатший");

            langLists = new List <ComboBox>
            {
                aLangListFrom,
                aLangListTo,
                wLangListFrom,
                wLangListTo,
                tLangListFrom,
                tLangListTo
            };
            LabTask.UpdateLangLists();
            foreach (string dictionary in dictionaries.Keys)
            {
                if (!dictList.Items.Contains(dictionary))
                {
                    dictList.Items.Add(dictionary);
                }
            }
            isChanging = false;
        }
Esempio n. 4
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");
            }
        }