コード例 #1
0
        private TreeNode CreateFloatNode <T, K> (string typeName)
            where K : TagNode
            where T : FloatTagRule <K>, new()
        {
            T rule = new T();

            using (ValueRuleForm form = new ValueRuleForm(SearchRule.NumericOpStrings)
            {
                Text = "Edit " + typeName + " Tag Rule",
            }) {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    rule.Name     = form.TagName;
                    rule.Value    = form.TagValueAsDouble;
                    rule.Operator = form.Operator;
                }
                else
                {
                    return(null);
                }
            }

            TreeNode node = CreateNode(rule);

            node.Text = rule.NodeDisplay;

            return(node);
        }
コード例 #2
0
        private TreeNode CreateIntegralNode <T, K>(string typeName)
            where K : TagNode
            where T : IntegralTagRule <K>, new()
        {
            var rule = new T();

            using (var form = new ValueRuleForm(SearchRule.NumericOpStrings)
            {
                Text = "Edit " + typeName + " Tag Rule"
            })
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    rule.Name     = form.TagName;
                    rule.Value    = form.TagValueAsLong;
                    rule.Operator = form.Operator;
                }
                else
                {
                    return(null);
                }
            }

            var node = CreateNode(rule);

            node.Text = rule.NodeDisplay;

            return(node);
        }
コード例 #3
0
        private void EditFloatNode <T, K> (TreeNode node, T rule, string typeName)
            where K : TagNode
            where T : FloatTagRule <K>
        {
            using (ValueRuleForm form = new ValueRuleForm(SearchRule.NumericOpStrings)
            {
                Text = "Edit " + typeName + " Tag Rule",
                TagName = rule.Name,
                TagValue = rule.Value.ToString(),
                Operator = rule.Operator,
            }) {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    rule.Name     = form.TagName;
                    rule.Value    = form.TagValueAsDouble;
                    rule.Operator = form.Operator;
                }
            }

            node.Text = rule.NodeDisplay;
        }