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


C# Instrument.Initialize方法代码示例

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


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

示例1: ToSettingSet

        private static SettingSet ToSettingSet(XmlNode content)
        {
            SettingSet settingSet = new SettingSet();

            List<Instrument> instruments = null;
            List<Customer> customers = null;
            List<TradePolicyDetail> tradePolicyDetails = null;
            List<QuotePolicyDetail> quotePolicyDetails = null;

            foreach (XmlNode xmlNode in content.ChildNodes)
            {
                string name = xmlNode.Name;

                if (name == "PrivateDailyQuotation")
                {
                    settingSet.PrivateDailyQuotation = new PrivateDailyQuotation();
                    settingSet.PrivateDailyQuotation.Initialize(xmlNode);
                }
                else if (name == "SystemParameter")
                {
                    settingSet.SystemParameter = new SystemParameter();
                    settingSet.SystemParameter.Initialize(xmlNode);
                }
                else if (name == "Instruments")
                {
                    foreach (XmlNode instrumentNode in xmlNode.ChildNodes)
                    {
                        Instrument instrument = new Instrument();
                        instrument.Initialize(instrumentNode);
                        if (instruments == null) instruments = new List<Instrument>();
                        instruments.Add(instrument);
                    }
                }
                else if (name == "Instrument")
                {
                    Instrument instrument = new Instrument();
                    instrument.Initialize(xmlNode);
                    if (instruments == null) instruments = new List<Instrument>();
                    instruments.Add(instrument);
                }
                else if (name == "Account")
                {
                    Account account = new Account();
                    account.Initialize(xmlNode);
                    settingSet.Accounts = new Account[] { account };
                }
                else if (name == "Customers")
                {
                    foreach (XmlNode customerNode in xmlNode.ChildNodes)
                    {
                        Customer customer = new Customer();
                        customer.Initialize(customerNode);
                        if (customers == null) customers = new List<Customer>();
                        customers.Add(customer);
                    }
                }
                else if (name == "TradePolicyDetail")
                {
                    TradePolicyDetail tradePolicyDetail = new TradePolicyDetail();
                    tradePolicyDetail.Initialize(xmlNode);

                    if (tradePolicyDetails == null) tradePolicyDetails = new List<TradePolicyDetail>();
                    tradePolicyDetails.Add(tradePolicyDetail);
                }
                else if (name == "QuotePolicyDetail")
                {
                    QuotePolicyDetail quotePolicyDetail = new QuotePolicyDetail();
                    quotePolicyDetail.Initialize(xmlNode);

                    if (quotePolicyDetails == null) quotePolicyDetails = new List<QuotePolicyDetail>();
                    quotePolicyDetails.Add(quotePolicyDetail);
                }
                else if (name == "QuotePolicyDetails")
                {
                    foreach (XmlNode childNode in xmlNode.ChildNodes)
                    {
                        QuotePolicyDetail quotePolicyDetail = new QuotePolicyDetail();
                        quotePolicyDetail.Initialize(childNode);

                        if (quotePolicyDetails == null) quotePolicyDetails = new List<QuotePolicyDetail>();
                        quotePolicyDetails.Add(quotePolicyDetail);
                    }
                }
            }

            settingSet.Instruments = (instruments.IsNullOrEmpty() ? null : instruments.ToArray());
            settingSet.Customers = (customers.IsNullOrEmpty() ? null : customers.ToArray());
            settingSet.TradePolicyDetails = (tradePolicyDetails.IsNullOrEmpty() ? null : tradePolicyDetails.ToArray());
            settingSet.QuotePolicyDetails = (quotePolicyDetails.IsNullOrEmpty() ? null : quotePolicyDetails.ToArray());
            return settingSet;
        }
开发者ID:BlueSky007,项目名称:ExchangeManager,代码行数:91,代码来源:CommandConvertor.cs


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