private void SaveTemplate(string name, ChartTemplate template)
        {
            ChartTemplateXmlDocument templateXmlDocument = new ChartTemplateXmlDocument();

            foreach (KeyValuePair <int, PadTemplate> keyValuePair in template.PadTemplates)
            {
                PadTemplateXmlNode padTemplateXmlNode = templateXmlDocument.PadTemplates.Add();
                padTemplateXmlNode.Number = keyValuePair.Key;
                foreach (IndicatorTemplateItem indicatorTemplate in keyValuePair.Value.IndicatorTemplates)
                {
                    this.SaveIndicatorTemplate(padTemplateXmlNode.IndicatorTemplates.Add(), indicatorTemplate);
                }
            }
            ((XmlDocument)templateXmlDocument).Save(string.Format("{0}\\{1}{2}", (object)this.directory.FullName, (object)name, (object)".ctp"));
        }
Beispiel #2
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);
 }
        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);
        }
Beispiel #4
0
 private void SaveTemplate(string name, ChartTemplate template)
 {
   ChartTemplateXmlDocument templateXmlDocument = new ChartTemplateXmlDocument();
   foreach (KeyValuePair<int, PadTemplate> keyValuePair in template.PadTemplates)
   {
     PadTemplateXmlNode padTemplateXmlNode = templateXmlDocument.PadTemplates.Add();
     padTemplateXmlNode.Number = keyValuePair.Key;
     foreach (IndicatorTemplateItem indicatorTemplate in keyValuePair.Value.IndicatorTemplates)
       this.SaveIndicatorTemplate(padTemplateXmlNode.IndicatorTemplates.Add(), indicatorTemplate);
   }
   ((XmlDocument) templateXmlDocument).Save(string.Format("{0}\\{1}{2}", (object) this.directory.FullName, (object) name, (object) ".ctp"));
 }