Esempio n. 1
0
        public void setWord(Datastructure.Word wrd)
        {
            lblTitle.Text = wrd.title;
            lblType.Text  = wrd.getType();


            txtOriginText.Text = wrd.origin;
            Tuple <int, int> location = basicUtilities.resizeTextBox(txtOriginText);

            lblNota.Location = new Point(location.Item1, location.Item2);

            txtNoteText.Text  = wrd.note;
            location          = basicUtilities.resizeTextBox(txtNoteText);
            lblForms.Location = new Point(location.Item1, location.Item2);

            // 20 px la distanza in verticale.


            txtFormsText.Text = "";
            foreach (Datastructure.Form frm in wrd.getForms())
            {
                txtFormsText.Text += frm.form + " (" + frm.type + ")" + " ";
            }

            location = basicUtilities.resizeTextBox(txtFormsText);
            lblDefinition.Location = new Point(location.Item1, location.Item2);

            txtDefinitionsText.Text = "";

            int i = 0;

            foreach (Datastructure.Definition def in wrd.GetDefinitions())
            {
                txtDefinitionsText.Text += (i + 1) + ")" + def.definition + "\r\n";
                txtDefinitionsText.Text += "\r\n" + "----------------------------------------------------" + "\r\n" + "\r\n";

                i++;
            }


            location = basicUtilities.resizeTextBox(txtDefinitionsText);
            lblTranslation.Location = new Point(location.Item1, location.Item2 + 5);

            txtTranslation.Text = "";
            foreach (Translation trans in wrd.getTranslations())
            {
                txtTranslation.Text += trans.getTranslated().title + ",";
            }

            if (txtTranslation.Text != "")
            {
                txtTranslation.Text = txtTranslation.Text.Remove(txtTranslation.Text.Length - 1);
            }

            location    = basicUtilities.resizeTextBox(txtTranslation);
            this.Height = location.Item2 + 5;
            this.Refresh();
        }
Esempio n. 2
0
        public void setDefinition(int index)
        {
            if (index > wrd.getDefinitionCount() || index < 0)
            {
                return;
            }

            Definition def = wrd.getDefinition(index);

            txtDefinizione.Text = def.definition;


            //synonyms
            foreach (Text syn in def.getSynonyms())
            {
                txtSino.Text = syn.title + ";";
            }

            if (txtSino.Text.Length > 0)
            {
                txtSino.Text.Remove(txtSino.Text.Length - 1);
            }



            // contraries
            foreach (Text contr in def.getContraries())
            {
                txtContra.Text = contr.title + ";";
            }

            if (txtContra.Text.Length > 0)
            {
                txtContra.Text.Remove(txtContra.Text.Length - 1);
            }

            // translations
            foreach (Translation tran in wrd.getTranslations(def))
            {
                txtTradu.Text += tran.getTranslated().title + ";";
            }

            if (txtContra.Text.Length > 0)
            {
                txtContra.Text.Remove(txtContra.Text.Length - 1);
            }
        }