本文整理汇总了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);
}