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); } }
public void AddIndicator(Indicator indicator) { IndicatorTemplateItem indicatorTemplate = this.CreateIndicatorTemplate(indicator); this.indicatorTemplateList.Add(indicatorTemplate); this.table[indicator] = indicatorTemplate; }
public void AddIndicator(Indicator indicator, Indicator inputIndicator) { IndicatorTemplateItem indicatorTemplate = this.CreateIndicatorTemplate(indicator); this.table[inputIndicator].AddChild(indicatorTemplate); this.table[indicator] = indicatorTemplate; }
private void RemoveIndicatorTemplate(IndicatorTemplateItem indicatorTemplate) { this.table.Remove(indicatorTemplate.Indicator); this.indicatorTemplateList.Remove(indicatorTemplate); foreach (IndicatorTemplateItem indicatorTemplate1 in indicatorTemplate.Children) this.RemoveIndicatorTemplate(indicatorTemplate1); }
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); } }
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; }
private void RemoveIndicatorTemplate(IndicatorTemplateItem indicatorTemplate) { this.table.Remove(indicatorTemplate.Indicator); this.indicatorTemplateList.Remove(indicatorTemplate); foreach (IndicatorTemplateItem indicatorTemplate1 in indicatorTemplate.Children) { this.RemoveIndicatorTemplate(indicatorTemplate1); } }
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; }
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; }
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); }
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); }
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); } }
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); }
public void AddChild(IndicatorTemplateItem child) { this.children.Add(child); }
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); }