void LoadCasesControls(Panel targetPanel, DecliantionNumber amount) { targetPanel.Controls.Clear(); Array arr = Enum.GetValues(typeof(InflectionCase)); foreach (InflectionCase aCase in arr) { if (aCase == InflectionCase._Unknown) { continue; } ControlNounCaseEdit edit = new ControlNounCaseEdit(); edit.Dock = DockStyle.Bottom; edit.Case = aCase; edit.Value = ""; edit.DecliantionNumber = amount; edit.InflectionCase = aCase; edit.PostfixButtonPressed += new EventHandler(this.edit_PostfixButtonPressed); edit.IrregularSet += new EventHandler(this.edit_IrregularSet); targetPanel.Controls.Add(edit); } }
void edit_PostfixButtonPressed(object sender, EventArgs e) { ControlNounCaseEdit edit = (ControlNounCaseEdit)sender; NounGrammar.SetPostIndex(this.edited, edit.InflectionCase, edit.DecliantionNumber, edit.PostFixIndex); this.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); } } }
void edit_IrregularSet(object sender, EventArgs e) { ControlNounCaseEdit edit = (ControlNounCaseEdit)sender; WordToken token = new WordToken(edit.Value, edit.InflectionCase, edit.DecliantionNumber); NounGrammar.UpdateIrregular(this.edited, token); this.RefreshFields(); }
void LoadCasesControls(Panel targetPanel, DecliantionNumber amount) { targetPanel.Controls.Clear(); Array arr = Enum.GetValues(typeof(InflectionCase)); foreach (InflectionCase aCase in arr) { if (aCase == InflectionCase._Unknown) continue; ControlNounCaseEdit edit = new ControlNounCaseEdit(); edit.Dock = DockStyle.Bottom; edit.Case = aCase; edit.Value = ""; edit.DecliantionNumber = amount; edit.InflectionCase = aCase; edit.PostfixButtonPressed += new EventHandler(edit_PostfixButtonPressed); edit.IrregularSet += new EventHandler(edit_IrregularSet); targetPanel.Controls.Add(edit); } }