public bool OnContextSetOccurrence(object args) { CheckDisposed(); var cmd = (XCore.Command)args; if (cmd.Parameters.Count > 0) { string minStr = XmlUtils.GetManditoryAttributeValue(cmd.Parameters[0], "min"); string maxStr = XmlUtils.GetManditoryAttributeValue(cmd.Parameters[0], "max"); int min = Int32.Parse(minStr); int max = Int32.Parse(maxStr); RegRuleFormulaControl.SetContextOccurrence(min, max); } else { int min, max; RegRuleFormulaControl.GetContextOccurrence(out min, out max); using (var dlg = new OccurrenceDlg(m_mediator.HelpTopicProvider, min, max, false)) { if (dlg.ShowDialog((XCore.XWindow)Mediator.PropertyTable.GetValue("window")) == DialogResult.OK) { RegRuleFormulaControl.SetContextOccurrence(dlg.Minimum, dlg.Maximum); } } } return(true); }
public bool OnPatternNodeSetOccurrence(object args) { CheckDisposed(); ComplexConcPatternNode[] nodes = CurrentNodes; int min, max; var cmd = (Command)args; if (cmd.Parameters.Count > 0) { string minStr = XmlUtils.GetManditoryAttributeValue(cmd.Parameters[0], "min"); string maxStr = XmlUtils.GetManditoryAttributeValue(cmd.Parameters[0], "max"); min = Int32.Parse(minStr); max = Int32.Parse(maxStr); } else { bool paren; if (nodes.Length > 1) { min = 1; max = 1; paren = true; } else { min = nodes[0].Minimum; max = nodes[0].Maximum; paren = !nodes[0].IsLeaf; } using (OccurrenceDlg dlg = new OccurrenceDlg(m_mediator.HelpTopicProvider, min, max, paren)) { dlg.SetHelpTopic("khtpCtxtOccurComplexConcordance"); if (dlg.ShowDialog((XWindow)m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK) { min = dlg.Minimum; max = dlg.Maximum; } else { return(true); } } } ComplexConcPatternNode node = nodes.Length > 1 ? GroupNodes(nodes) : nodes[0]; node.Minimum = min; node.Maximum = max; ReconstructView(node, false); return(true); }