コード例 #1
0
 private void AddRule()
 {
     if ((cbSource.SelectedIndex > 0) && (cbTarget.SelectedIndex > 0))
     {
         IsDirty = true;
         ConversionClass cc = new ConversionClass();
         cc.SourceFormat        = ((FileFormatClass)cbSource.SelectedItem).Format;
         cc.TargetFormat        = ((FileFormatClass)cbTarget.SelectedItem).Format;
         cbSource.SelectedIndex = -1;
         cbTarget.SelectedIndex = -1;
         ocConversions.Add(cc);
     }
 }
コード例 #2
0
ファイル: ConversionClass.cs プロジェクト: yuanf225/Coffee
        public static BindingList <ConversionClass> ConversionRules()
        {
            BindingList <ConversionClass> ocConversionRules = new BindingList <ConversionClass>();
            // Execute the query using the LINQ to XML
            var rules = from c in XElement.Load(XMLBuilder.ConversionRuleXml()).Elements("Conversion") select c;

            foreach (var rule in rules)
            {
                ConversionClass cRule = new ConversionClass()
                {
                    SourceFormat = rule.Element("Source").Value,
                    TargetFormat = rule.Element("Target").Value,
                    IsDefault    = true,
                    IsOverridden = false
                };
                ocConversionRules.Add(cRule);
            }
            return(ocConversionRules);
        }