本文整理汇总了C#中ICondition.GetConditionDef方法的典型用法代码示例。如果您正苦于以下问题:C# ICondition.GetConditionDef方法的具体用法?C# ICondition.GetConditionDef怎么用?C# ICondition.GetConditionDef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICondition
的用法示例。
在下文中一共展示了ICondition.GetConditionDef方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteConditionToXmlNode
private XmlNode WriteConditionToXmlNode(ICondition condition)
{
string conditionName = condition.GetConditionDef().GetConditionName();
XmlElement conditionElement = m_doc.CreateElement(conditionName);
if (condition is AbstractCompositeCondition)
{
if (condition is AbstractMultipleCondition)
{
var multipleCondition = condition as AbstractMultipleCondition;
foreach (ICondition subCondition in multipleCondition.ConditionList)
{
conditionElement.AppendChild(WriteConditionToXmlNode(subCondition));
}
}
else
{
var singleCondition = condition as AbstractSingleCondition;
conditionElement.AppendChild(
WriteConditionToXmlNode(singleCondition.ConditionList[0]));
}
}
else
{
var atomicCondition = condition as AbstractAtomicCondition;
conditionElement.SetAttribute(RuleFileConstants.Operator,
atomicCondition.Operator.GetOperatorName());
conditionElement.SetAttribute(RuleFileConstants.Value, atomicCondition.Value);
}
return conditionElement;
}
示例2: InitBeforeShow
public void InitBeforeShow(TreeNode modifiedTreeNode,
ICategory fixedCategory, ICondition fixedCondition)
{
m_modifiedTreeNode = modifiedTreeNode;
m_fixedCategory = fixedCategory;
m_fixedCondition = fixedCondition;
// Init conditionComboBox
List<IConditionDef> conditionDefList =
RuleEngine.GetConditionManager().GetPossibleConditionDefList(m_fixedCategory);
conditionComboBox.Items.Clear();
foreach (IConditionDef conditionDef in conditionDefList)
{
conditionComboBox.Items.Add(conditionDef.GetConditionName());
}
if (m_fixedCondition != null)
{
// Select the inital one.
// And this line, will call conditionComboBox_SelectedIndexChanged synchronously.
conditionComboBox.SelectedItem =
m_fixedCondition.GetConditionDef().GetConditionName();
//ResizeControl();
//UpdateOperatorComboBox();
//UpdateValueComboBox();
if (m_fixedCondition is AbstractAtomicCondition)
{
var atomicCondition = (AbstractAtomicCondition) m_fixedCondition;
operatorComboBox.SelectedItem = atomicCondition.Operator.GetOperatorName();
if (m_fixedCondition is NativeParameterIndexCondition)
{
parameterIndexNumericUpDown.Value = Int32.Parse(
atomicCondition.Value, CultureInfo.InvariantCulture);
}
else
{
valueComboBox.Text = atomicCondition.Value;
}
}
}
else
{
SetControlVisibility();
}
}
示例3: CheckCondition
private bool CheckCondition(ICondition condition)
{
if (condition is AbstractCompositeCondition)
{
var compositeCondition = (AbstractCompositeCondition) condition;
List<ICondition> list = compositeCondition.ConditionList;
if (list.Count == 0)
{
MessageBox.Show(Resource.FormatString("Wrn_EmptyCompositeCondition",
condition.GetConditionDef().GetConditionName()));
return false;
}
return list.All(t => CheckCondition(t));
}
else
{
return true;
}
}
示例4: CanConditionApplyToCategory
private bool CanConditionApplyToCategory(ICondition condition, ICategory category)
{
if (condition is AbstractAtomicCondition)
return condition.GetConditionDef().CanApplyToCategory(category);
else
{
// AbstractCompositeCondition
var compositeCondition = condition as AbstractCompositeCondition;
foreach (ICondition subCondition in compositeCondition.ConditionList)
{
if (!subCondition.GetConditionDef().CanApplyToCategory(category))
return false;
}
return condition.GetConditionDef().CanApplyToCategory(category);
}
}
示例5: GetConditionTreeNode
public static TreeNode GetConditionTreeNode(ICondition condition)
{
TreeNode conditionNode = new TreeNode();
if (condition is AbstractCompositeCondition)
{
var compositeCondition = (AbstractCompositeCondition) condition;
foreach (ICondition subCondition in compositeCondition.ConditionList)
{
conditionNode.Nodes.Add(GetConditionTreeNode(subCondition));
}
// Append the "<Empty>" node.
AbstractCompositeConditionDef compositeConditionDef =
(AbstractCompositeConditionDef) condition.GetConditionDef();
if (conditionNode.Nodes.Count < compositeConditionDef.GetMaxSubconditionNumber())
{
conditionNode.Nodes.Add(GetEmptyConditionTreeNode());
}
}
conditionNode.Text = GetConditionNodeText(condition);
conditionNode.Tag = condition;
SetRuleTreeNodeImage(conditionNode);
return conditionNode;
}