예제 #1
0
        private void listNouns_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (editing)
                return;

            Option<Noun> selected = (Option<Noun>)listNouns.SelectedItem;

            if (selected != null)
            {
                if (selectedNoun != null && tmp != null)
                {
                    // save changes
                    selectedNoun.AnalyzeLine(tmp.WriteNoun());

                    // refresh display correctly   
                    int indx = listNouns.SelectedIndex;
                    editing = true;
                    DoFilterNouns();                  
                    listNouns.SelectedIndex = indx;
                    editing = false;
                }

                selectedNoun = selected.Key;

                tmp = _grammarSerializers.NounSerializer.Load(_grammarSerializers.NounSerializer.Write(selectedNoun)); // clone...

                this.controlEditNoun.EditNoun(tmp);

            }
            else
                this.controlEditNoun.EditNoun(null);
        }
        public void SetNoun(Noun noun)
        {
            edited = noun;

            RandomAdjective();

            for (int i = 0; i < cboGenre.Items.Count; i++)
            {
                if (((Option<GrammaticalGender>)cboGenre.Items[i]).Key == edited.IrregularGenre)
                {
                    cboGenre.SelectedIndex = i;
                    cboGenre_SelectedIndexChanged(cboGenre, EventArgs.Empty);
                    break;
                }
            }

            //Display();
        }
        public void EditNoun(Noun noun)
        {
            edited = noun;
            

            if (noun == null)
            {
                editing = true;

                this.eRoot.Text = "";
                this.eRootIrregular.Text = "";
                this.checkConstant.Checked = false;
                this.checkNoPlural.Checked = false;
                this.checkNoSingular.Checked = false;

                editing = false;
            }
            else
            {
                RefreshFields();
            }

        }
        private void SetEdited(Panel targetPanel, Noun noun)
        {
            foreach (Control ctrl in targetPanel.Controls)
            {
                if (!(ctrl is ControlNounCaseEdit))
                    continue;

                ControlNounCaseEdit edit = ctrl as ControlNounCaseEdit;
                if (noun == null)
                    edit.Value = "";
                else
                {
                    string form = NounDecliner.Decliner.MakeWord(
                        noun, edit.InflectionCase, edit.DecliantionNumber);
                    edit.Value = form;
                    edit.PostFixes = NounDecliner.Decliner.GetPostFix(noun.Genre, noun.DeclinationType,
                        edit.InflectionCase, DecliantionNumber.Singular).Split(' ');
                    edit.PostFixIndex = NounGrammar.GetPostFixIndex(noun, DecliantionNumber.Singular, edit.InflectionCase);
                }
            }
        }
예제 #5
0
        private void bDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(this, "Na pewno?", "Usuwanie rzeczownika", MessageBoxButtons.YesNo,
                MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                NounCollection.Collection.Nouns.Remove(selectedNoun);
                this.controlEditNoun.EditNoun(null);

                selectedNoun = null;
                tmp = null;

                DoFilterNouns();
            }
        }
예제 #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (selectedNoun != null && tmp != null)
            {
                // save changes in existing noun
                selectedNoun.AnalyzeLine(tmp.WriteNoun());
                DoFilterNouns();
            }

            selectedNoun = new Noun();
            selectedNoun.Root = "<nowy>";
            tmp = selectedNoun;
            NounCollection.Collection.Nouns.Add(selectedNoun);
            this.controlEditNoun.EditNoun(tmp);

            DoFilterNouns();

            foreach (Option<Noun> opt in this.listNouns.Items)
                if (opt.Key == selectedNoun)
                {
                    this.listNouns.SelectedItem = opt;
                    break;
                }
        }