// // Initialization related methods // private void GetConfig() { if (File.Exists("config.cfg")) { FileStream fs = new FileStream("config.cfg", FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); config = (valPresageConfig)bf.Deserialize(fs); fs.Close(); if (config.IsProxy) { httpManager.Server = config.Server; httpManager.Port = config.Port; httpManager.Login = config.Login; httpManager.Password = config.Password; } } else { config = new valPresageConfig(); config.IsHorizontalValues = true; config.IsVerticalValues = true; config.IsHorizontalGrid = true; config.IsVerticalGrid = true; config.IsVolume = true; config.Period = 7; config.GridColor = Color.Gray; config.TickColor = Color.Green; config.TextColor = Color.Gray; config.GridTextColor = Color.Black; config.FrameColor = Color.Black; config.BackColor = Color.White; config.LineColor = Color.Black; config.UpColor = Color.Green; config.DownColor = Color.Red; config.VolumeColor = Color.Silver; config.ToolColor = Color.Black; config.HGridLines = 3; config.VGridLines = 3; config.Type = Chart.ChartType.Line; config.IsProxy = false; config.Server = null; config.Port = null; config.Login = null; config.Password = null; config.DefaultDataSource = null; } }
public FormChart(string _symbol, string _path, List <string> _symbols, valPresageConfig _config) { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // symbol = _symbol; path = _path; symbols = _symbols; config = _config; symbolManager = new SymbolManager(); plugins = new List <string>(); // New in Alpha-2 panel.chartBox = this.chartBox; panel.config = config; //DisplayedUIDs = new List<Guid>(); // this.toolStripComboBoxPeriod.SelectedIndex = config.Period; this.GetTools(); this.GetData(); this.DrawChart(); this.chartBox.ToolColor = config.ToolColor; this.ChangeToolColor(); sizeChanged = new EventHandler(this.ChartBoxSizeChanged); chartBox.SizeChanged += sizeChanged; }
public FormConfig(MainForm _parent) { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // parent = _parent; config = parent.config; chHorValues.Checked = config.IsHorizontalValues; chHorGrid.Checked = config.IsHorizontalGrid; chVerValues.Checked = config.IsVerticalValues; chVerGrid.Checked = config.IsVerticalGrid; chVolume.Checked = config.IsVolume; if (config.HGridLines == 0) { cmbHorLines.SelectedIndex = 0; } else if (config.HGridLines == 2) { cmbHorLines.SelectedIndex = 1; } else if (config.HGridLines == 3) { cmbHorLines.SelectedIndex = 2; } else if (config.HGridLines == 5) { cmbHorLines.SelectedIndex = 3; } else if (config.HGridLines == 7) { cmbHorLines.SelectedIndex = 4; } else if (config.HGridLines == 10) { cmbHorLines.SelectedIndex = 5; } if (config.VGridLines == 0) { cmbVerLines.SelectedIndex = 0; } else if (config.VGridLines == 2) { cmbVerLines.SelectedIndex = 1; } else if (config.VGridLines == 3) { cmbVerLines.SelectedIndex = 2; } else if (config.VGridLines == 5) { cmbVerLines.SelectedIndex = 3; } else if (config.VGridLines == 7) { cmbVerLines.SelectedIndex = 4; } else if (config.VGridLines == 10) { cmbVerLines.SelectedIndex = 5; } if (config.Type == GraphicsProvider.Chart.ChartType.Line) { cmbDefStyle.SelectedIndex = 0; } else if (config.Type == GraphicsProvider.Chart.ChartType.Bar) { cmbDefStyle.SelectedIndex = 1; } else if (config.Type == GraphicsProvider.Chart.ChartType.Candle) { cmbDefStyle.SelectedIndex = 2; } cmbPeriod.SelectedIndex = config.Period; pbGridColor.BackColor = config.GridColor; pbTickColor.BackColor = config.TickColor; pbTextColor.BackColor = config.TextColor; pbGridTextColor.BackColor = config.GridTextColor; pbFrameColor.BackColor = config.FrameColor; pbBackColor.BackColor = config.BackColor; pbLineColor.BackColor = config.LineColor; pbUpColor.BackColor = config.UpColor; pbDownColor.BackColor = config.DownColor; pbVolumeColor.BackColor = config.VolumeColor; pbToolColor.BackColor = config.ToolColor; }