private void chartToolStrip1_TemplateAction(object sender, TemplateActionEventArgs args) { switch (args.ActionType) { case TemplateActionType.Load: this.template = Global.ChartManager.Templates[args.TemplateName]; this.ApplyTemplate(); ((Control) this.chart).Refresh(); break; case TemplateActionType.Save: case TemplateActionType.SaveAs: SaveTemplateDialog saveTemplateDialog = new SaveTemplateDialog(); if (saveTemplateDialog.ShowDialog() != DialogResult.OK) break; Global.ChartManager.Templates.Add(saveTemplateDialog.TemplateName, this.template); break; case TemplateActionType.ChooseEmpty: this.template = Global.ChartManager.Templates.EmptyTemplate; this.ApplyTemplate(); ((Control) this.chart).Refresh(); break; case TemplateActionType.ChooseDefault: this.template = Global.ChartManager.Templates["Default Template"]; this.ApplyTemplate(); ((Control) this.chart).Refresh(); break; case TemplateActionType.SetDefault: Global.ChartManager.Templates.Replace("Default Template", this.template); break; } }
internal ChartTemplate(ChartTemplate template) { foreach (KeyValuePair <int, PadTemplate> keyValuePair in template.padTemplates) { this.padTemplates.Add(keyValuePair.Key, new PadTemplate(keyValuePair.Value)); } }
protected override void OnInit() { this.instrument = this.Key as Instrument; DataSeriesList dataSeries = this.instrument.GetDataSeries(); this.template = Global.ChartManager.Templates["Default Template"]; this.Text = "Chart [" + ((FIXInstrument)this.instrument).Symbol + "]"; this.instrumentListSource.AddInstrument(this.instrument); this.instrumentListSource.SelectedInstrument = this.instrument; IEnumerator enumerator = dataSeries.GetEnumerator(); try { while (enumerator.MoveNext()) { IDataSeries idataSeries = (IDataSeries)enumerator.Current; string key = DataSeriesHelper.SeriesNameToString(idataSeries.Name); if (key.StartsWith("Bar") || key == "Daily") { this.seriesNames.Add(key, idataSeries.Name); this.instrumentListSource.AddSeries(this.instrument, new BarSeries(key)); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } this.instrumentListSource.Refresh(); }
public void Replace(string name, ChartTemplate template) { this.templates[name.ToLower()] = template; if (!this.templateNames.Contains(name)) { this.templateNames.Add(name); } this.SaveTemplate(name, template); }
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")); }
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); }
private void chartToolStrip1_TemplateAction(object sender, TemplateActionEventArgs args) { switch (args.ActionType) { case TemplateActionType.Load: this.template = Global.ChartManager.Templates[args.TemplateName]; this.ApplyTemplate(); ((Control)this.chart).Refresh(); break; case TemplateActionType.Save: case TemplateActionType.SaveAs: SaveTemplateDialog saveTemplateDialog = new SaveTemplateDialog(); if (saveTemplateDialog.ShowDialog() != DialogResult.OK) { break; } Global.ChartManager.Templates.Add(saveTemplateDialog.TemplateName, this.template); break; case TemplateActionType.ChooseEmpty: this.template = Global.ChartManager.Templates.EmptyTemplate; this.ApplyTemplate(); ((Control)this.chart).Refresh(); break; case TemplateActionType.ChooseDefault: this.template = Global.ChartManager.Templates["Default Template"]; this.ApplyTemplate(); ((Control)this.chart).Refresh(); break; case TemplateActionType.SetDefault: Global.ChartManager.Templates.Replace("Default Template", this.template); break; } }
protected override void OnInit() { this.instrument = this.Key as Instrument; DataSeriesList dataSeries = this.instrument.GetDataSeries(); this.template = Global.ChartManager.Templates["Default Template"]; this.Text = "Chart [" + ((FIXInstrument) this.instrument).Symbol + "]"; this.instrumentListSource.AddInstrument(this.instrument); this.instrumentListSource.SelectedInstrument = this.instrument; IEnumerator enumerator = dataSeries.GetEnumerator(); try { while (enumerator.MoveNext()) { IDataSeries idataSeries = (IDataSeries) enumerator.Current; string key = DataSeriesHelper.SeriesNameToString(idataSeries.Name); if (key.StartsWith("Bar") || key == "Daily") { this.seriesNames.Add(key, idataSeries.Name); this.instrumentListSource.AddSeries(this.instrument, new BarSeries(key)); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) disposable.Dispose(); } this.instrumentListSource.Refresh(); }
public void Replace(string name, ChartTemplate template) { this.templates[name.ToLower()] = template; if (!this.templateNames.Contains(name)) this.templateNames.Add(name); this.SaveTemplate(name, template); }
public void Add(string name, ChartTemplate template) { this.templates.Add(name.ToLower(), template); this.templateNames.Add(name); this.SaveTemplate(name, template); }
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")); }
internal ChartTemplate(ChartTemplate template) { foreach (KeyValuePair<int, PadTemplate> keyValuePair in template.padTemplates) this.padTemplates.Add(keyValuePair.Key, new PadTemplate(keyValuePair.Value)); }