예제 #1
0
파일: BBIndicator.cs 프로젝트: vlshl/pulxer
        /// <summary>
        /// Initialize from xml
        /// </summary>
        /// <param name="xDoc"></param>
        public override void Initialize(XDocument xDoc)
        {
            var xaId = xDoc.Root.Attribute("Id");

            if (xaId != null)
            {
                guid = xaId.Value;
            }

            var xaN = xDoc.Root.Attribute("N");

            if (xaN != null)
            {
                int n = 1;
                if (int.TryParse(xaN.Value, out n))
                {
                    _settings.N = n;
                }
            }

            var xaWidth = xDoc.Root.Attribute("Width");

            if (xaWidth != null)
            {
                decimal width = 1;
                if (decimal.TryParse(xaWidth.Value, out width))
                {
                    _settings.Width = width;
                }
            }

            var xaSourceId = xDoc.Root.Attribute("SourceId");

            if (xaSourceId != null && xaSourceId.Value.Length > 0)
            {
                var foundSource = _srcProv.GerSourceByID(xaSourceId.Value);
                if (foundSource != null)
                {
                    _settings.Source = foundSource;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Initialize from xml
        /// </summary>
        /// <param name="xDoc"></param>
        public override void Initialize(XDocument xDoc)
        {
            var xa_id = xDoc.Root.Attribute("Id");

            if (xa_id != null)
            {
                guid = xa_id.Value;
            }

            var xa_name = xDoc.Root.Attribute("Name");

            if (xa_name != null)
            {
                _name = xa_name.Value;
            }

            var xa_n = xDoc.Root.Attribute("N");

            if (xa_n != null)
            {
                int n = 1;
                if (Int32.TryParse(xa_n.Value, out n))
                {
                    _settings.N = n;
                }
            }

            var xa_sourceId = xDoc.Root.Attribute("SourceId");

            if (xa_sourceId != null && xa_sourceId.Value.Length > 0)
            {
                var foundSource = _srcProv.GerSourceByID(xa_sourceId.Value);
                if (foundSource != null)
                {
                    _settings.Source = foundSource;
                }
            }
        }