当前位置: 首页>>代码示例>>C#>>正文


C# Rule.Clone方法代码示例

本文整理汇总了C#中Rule.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Rule.Clone方法的具体用法?C# Rule.Clone怎么用?C# Rule.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rule的用法示例。


在下文中一共展示了Rule.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RuleEditDialog

        public RuleEditDialog(Rule rule)
        {
            InitializeComponent();
            this.backgroundWorker = new BackgroundWorker();
            this.backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork);
            this.backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted);
            if (rule != null)
                this.rule = (Rule)rule.Clone();
            else
            {
                this.rule = new Rule { ID = 0, Name = "<New Rule>", Description = "", Configuration = "", Precedence = 0, IsEnabled = false };
                modification = false;
            }
            //Initialize
            this.RuleID.Text = this.rule.ID.ToString();
            this.RuleName.Text = this.rule.Name;
            this.RuleDescription.Text = this.rule.Description;
            this.RulePrecedence.Text = this.rule.Precedence.ToString();
            this.RuleIsEnabled.IsChecked = this.rule.IsEnabled;
            if (this.rule.Configuration != "" && modification)
            {
                try
                {
                    XmlDocument doc = Util.Xml.Read(this.rule.Configuration);
                    if (doc["rule"]["code"].HasAttribute("path"))
                    {
                        this.RuleAssemblyPath.Text = doc["rule"]["code"].Attributes["path"].Value;
                        this.RuleAssemblyType.Text = doc["rule"]["code"].Attributes["type"].Value;
                        SourceTabItem.IsEnabled = false;
                    }
                    else
                    {
                        this.RuleSourceType.Text = doc["rule"]["code"].Attributes["type"].Value;
                        this.RuleSourceCode.Text = doc["rule"]["code"].InnerText;
                        AssemblyTabItem.IsEnabled = false;
                    }
                    if (doc["rule"].GetElementsByTagName("settings").Count > 0)
                    {
                        XmlNodeList settings_list = doc["rule"]["settings"].GetElementsByTagName("add");
                        for (int j = 0; j < settings_list.Count; j++)
                            configurations.Add(new Configuration { Key = settings_list[j].Attributes["key"].Value, Value = settings_list[j].Attributes["value"].Value });
                    }
                }
                catch
                {
                }
            }

            Binding ConfigurationListBinding = new Binding();
            ConfigurationListBinding.Source = configurations;
            ConfigurationListView.SetBinding(ListView.ItemsSourceProperty, ConfigurationListBinding);
        }
开发者ID:ziyan,项目名称:reactivity,代码行数:52,代码来源:RuleEditDialog.xaml.cs


注:本文中的Rule.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。