Ejemplo n.º 1
0
 private void LoadIndicatorTemplate(IndicatorTemplateItem indicatorTemplate, IndicatorTemplateXmlNode indicatorNode)
 {
   foreach (SettingXmlNode settingXmlNode in indicatorNode.Settings)
   {
     object obj;
     if (settingXmlNode.Type.IsEnum)
       obj = Enum.Parse(settingXmlNode.Type, settingXmlNode.Value);
     else if (settingXmlNode.Type == typeof (Color))
     {
       string[] strArray = settingXmlNode.Value.Split(new char[1]
       {
         ','
       });
       obj = (object) Color.FromArgb(int.Parse(strArray[0]), int.Parse(strArray[1]), int.Parse(strArray[2]), int.Parse(strArray[3]));
     }
     else
       obj = Convert.ChangeType((object) settingXmlNode.Value, settingXmlNode.Type, (IFormatProvider) NumberFormatInfo.InvariantInfo);
     indicatorTemplate.SetProperty(settingXmlNode.Name, obj);
   }
   foreach (IndicatorTemplateXmlNode indicatorNode1 in indicatorNode.IndicatorTemplates)
   {
     IndicatorTemplateItem indicatorTemplate1 = new IndicatorTemplateItem(indicatorNode1.Type);
     indicatorTemplate.Children.Add(indicatorTemplate1);
     this.LoadIndicatorTemplate(indicatorTemplate1, indicatorNode1);
   }
 }
Ejemplo n.º 2
0
        public void AddIndicator(Indicator indicator)
        {
            IndicatorTemplateItem indicatorTemplate = this.CreateIndicatorTemplate(indicator);

            this.indicatorTemplateList.Add(indicatorTemplate);
            this.table[indicator] = indicatorTemplate;
        }
Ejemplo n.º 3
0
        public void AddIndicator(Indicator indicator, Indicator inputIndicator)
        {
            IndicatorTemplateItem indicatorTemplate = this.CreateIndicatorTemplate(indicator);

            this.table[inputIndicator].AddChild(indicatorTemplate);
            this.table[indicator] = indicatorTemplate;
        }
Ejemplo n.º 4
0
		private void RemoveIndicatorTemplate(IndicatorTemplateItem indicatorTemplate)
		{
			this.table.Remove(indicatorTemplate.Indicator);
			this.indicatorTemplateList.Remove(indicatorTemplate);
			foreach (IndicatorTemplateItem indicatorTemplate1 in indicatorTemplate.Children)
				this.RemoveIndicatorTemplate(indicatorTemplate1);
		}
Ejemplo n.º 5
0
 private void LoadIndicatorTemplate(IndicatorTemplateItem indicatorTemplate, IndicatorTemplateXmlNode indicatorNode)
 {
     foreach (SettingXmlNode settingXmlNode in indicatorNode.Settings)
     {
         object obj;
         if (settingXmlNode.Type.IsEnum)
         {
             obj = Enum.Parse(settingXmlNode.Type, settingXmlNode.Value);
         }
         else if (settingXmlNode.Type == typeof(Color))
         {
             string[] strArray = settingXmlNode.Value.Split(new char[1]
             {
                 ','
             });
             obj = (object)Color.FromArgb(int.Parse(strArray[0]), int.Parse(strArray[1]), int.Parse(strArray[2]), int.Parse(strArray[3]));
         }
         else
         {
             obj = Convert.ChangeType((object)settingXmlNode.Value, settingXmlNode.Type, (IFormatProvider)NumberFormatInfo.InvariantInfo);
         }
         indicatorTemplate.SetProperty(settingXmlNode.Name, obj);
     }
     foreach (IndicatorTemplateXmlNode indicatorNode1 in indicatorNode.IndicatorTemplates)
     {
         IndicatorTemplateItem indicatorTemplate1 = new IndicatorTemplateItem(indicatorNode1.Type);
         indicatorTemplate.Children.Add(indicatorTemplate1);
         this.LoadIndicatorTemplate(indicatorTemplate1, indicatorNode1);
     }
 }
Ejemplo n.º 6
0
		internal IndicatorTemplateItem(IndicatorTemplateItem template)
		{
			foreach (KeyValuePair<string, object> keyValuePair in template.properties)
				this.properties.Add(keyValuePair.Key, keyValuePair.Value);
			foreach (IndicatorTemplateItem template1 in template.children)
				this.children.Add(new IndicatorTemplateItem(template1));
			this.indicatorType = template.indicatorType;
		}
Ejemplo n.º 7
0
 private void RemoveIndicatorTemplate(IndicatorTemplateItem indicatorTemplate)
 {
     this.table.Remove(indicatorTemplate.Indicator);
     this.indicatorTemplateList.Remove(indicatorTemplate);
     foreach (IndicatorTemplateItem indicatorTemplate1 in indicatorTemplate.Children)
     {
         this.RemoveIndicatorTemplate(indicatorTemplate1);
     }
 }
Ejemplo n.º 8
0
 internal IndicatorTemplateItem(IndicatorTemplateItem template)
 {
     foreach (KeyValuePair <string, object> keyValuePair in template.properties)
     {
         this.properties.Add(keyValuePair.Key, keyValuePair.Value);
     }
     foreach (IndicatorTemplateItem template1 in template.children)
     {
         this.children.Add(new IndicatorTemplateItem(template1));
     }
     this.indicatorType = template.indicatorType;
 }
Ejemplo n.º 9
0
		private IndicatorTemplateItem CreateIndicatorTemplate(Indicator indicator)
		{
			Type type = ((object)indicator).GetType();
			IndicatorTemplateItem indicatorTemplateItem = new IndicatorTemplateItem(type);
			indicatorTemplateItem.SetProperty("Color", ((TimeSeries)indicator).Color);
			indicatorTemplateItem.SetProperty("Name", ((TimeSeries)indicator).Name);
			indicatorTemplateItem.SetProperty("Title", ((TimeSeries)indicator).Title);
			foreach (PropertyInfo propertyInfo in type.GetProperties())
			{
				foreach (Attribute attribute in propertyInfo.GetCustomAttributes(false))
				{
					if (attribute.GetType() == typeof(IndicatorParameterAttribute))
						indicatorTemplateItem.SetProperty(propertyInfo.Name, propertyInfo.GetValue((object)indicator, (object[])null));
				}
			}
			return indicatorTemplateItem;
		}
Ejemplo n.º 10
0
 private void LoadTemplate(FileInfo file)
 {
   ChartTemplateXmlDocument templateXmlDocument = new ChartTemplateXmlDocument();
   ((XmlDocument) templateXmlDocument).Load(file.FullName);
   ChartTemplate chartTemplate = new ChartTemplate();
   foreach (PadTemplateXmlNode padTemplateXmlNode in templateXmlDocument.PadTemplates)
   {
     PadTemplate padTemplate = new PadTemplate();
     chartTemplate.PadTemplates.Add(padTemplateXmlNode.Number, padTemplate);
     foreach (IndicatorTemplateXmlNode indicatorNode in padTemplateXmlNode.IndicatorTemplates)
     {
       IndicatorTemplateItem indicatorTemplate = new IndicatorTemplateItem(indicatorNode.Type);
       padTemplate.IndicatorTemplates.Add(indicatorTemplate);
       this.LoadIndicatorTemplate(indicatorTemplate, indicatorNode);
     }
   }
   string withoutExtension = Path.GetFileNameWithoutExtension(file.Name);
   this.templates.Add(withoutExtension.ToLower(), chartTemplate);
   this.templateNames.Add(withoutExtension);
 }
Ejemplo n.º 11
0
        private IndicatorTemplateItem CreateIndicatorTemplate(Indicator indicator)
        {
            Type type = ((object)indicator).GetType();
            IndicatorTemplateItem indicatorTemplateItem = new IndicatorTemplateItem(type);

            indicatorTemplateItem.SetProperty("Color", ((TimeSeries)indicator).Color);
            indicatorTemplateItem.SetProperty("Name", ((TimeSeries)indicator).Name);
            indicatorTemplateItem.SetProperty("Title", ((TimeSeries)indicator).Title);
            foreach (PropertyInfo propertyInfo in type.GetProperties())
            {
                foreach (Attribute attribute in propertyInfo.GetCustomAttributes(false))
                {
                    if (attribute.GetType() == typeof(IndicatorParameterAttribute))
                    {
                        indicatorTemplateItem.SetProperty(propertyInfo.Name, propertyInfo.GetValue((object)indicator, (object[])null));
                    }
                }
            }
            return(indicatorTemplateItem);
        }
Ejemplo n.º 12
0
 private void SaveIndicatorTemplate(IndicatorTemplateXmlNode indicator, IndicatorTemplateItem indicatorTemplate)
 {
     indicator.Type = indicatorTemplate.IndicatorType;
     foreach (KeyValuePair <string, object> keyValuePair in indicatorTemplate.Properties)
     {
         string str;
         if (keyValuePair.Value.GetType() == typeof(Color))
         {
             Color color = (Color)keyValuePair.Value;
             str = (string)(object)color.A + (object)"," + (string)(object)color.R + "," + (string)(object)color.G + "," + (string)(object)color.B;
         }
         else
         {
             str = !keyValuePair.Value.GetType().IsEnum ? (string)Convert.ChangeType(keyValuePair.Value, typeof(string), (IFormatProvider)NumberFormatInfo.InvariantInfo) : keyValuePair.Value.ToString();
         }
         indicator.Settings.Add(keyValuePair.Key, keyValuePair.Value.GetType(), str);
     }
     foreach (IndicatorTemplateItem indicatorTemplate1 in indicatorTemplate.Children)
     {
         this.SaveIndicatorTemplate(indicator.IndicatorTemplates.Add(), indicatorTemplate1);
     }
 }
Ejemplo n.º 13
0
        private void LoadTemplate(FileInfo file)
        {
            ChartTemplateXmlDocument templateXmlDocument = new ChartTemplateXmlDocument();

            ((XmlDocument)templateXmlDocument).Load(file.FullName);
            ChartTemplate chartTemplate = new ChartTemplate();

            foreach (PadTemplateXmlNode padTemplateXmlNode in templateXmlDocument.PadTemplates)
            {
                PadTemplate padTemplate = new PadTemplate();
                chartTemplate.PadTemplates.Add(padTemplateXmlNode.Number, padTemplate);
                foreach (IndicatorTemplateXmlNode indicatorNode in padTemplateXmlNode.IndicatorTemplates)
                {
                    IndicatorTemplateItem indicatorTemplate = new IndicatorTemplateItem(indicatorNode.Type);
                    padTemplate.IndicatorTemplates.Add(indicatorTemplate);
                    this.LoadIndicatorTemplate(indicatorTemplate, indicatorNode);
                }
            }
            string withoutExtension = Path.GetFileNameWithoutExtension(file.Name);

            this.templates.Add(withoutExtension.ToLower(), chartTemplate);
            this.templateNames.Add(withoutExtension);
        }
Ejemplo n.º 14
0
		public void AddChild(IndicatorTemplateItem child)
		{
			this.children.Add(child);
		}
Ejemplo n.º 15
0
 private void SaveIndicatorTemplate(IndicatorTemplateXmlNode indicator, IndicatorTemplateItem indicatorTemplate)
 {
   indicator.Type = indicatorTemplate.IndicatorType;
   foreach (KeyValuePair<string, object> keyValuePair in indicatorTemplate.Properties)
   {
     string str;
     if (keyValuePair.Value.GetType() == typeof (Color))
     {
       Color color = (Color) keyValuePair.Value;
       str = (string) (object) color.A + (object) "," + (string) (object) color.R + "," + (string) (object) color.G + "," + (string) (object) color.B;
     }
     else
       str = !keyValuePair.Value.GetType().IsEnum ? (string) Convert.ChangeType(keyValuePair.Value, typeof (string), (IFormatProvider) NumberFormatInfo.InvariantInfo) : keyValuePair.Value.ToString();
     indicator.Settings.Add(keyValuePair.Key, keyValuePair.Value.GetType(), str);
   }
   foreach (IndicatorTemplateItem indicatorTemplate1 in indicatorTemplate.Children)
     this.SaveIndicatorTemplate(indicator.IndicatorTemplates.Add(), indicatorTemplate1);
 }
Ejemplo n.º 16
0
 public void AddChild(IndicatorTemplateItem child)
 {
     this.children.Add(child);
 }