internal static void Save(string symbol, ChartSettings newSettings)
        {
            m_symbolToSettings[symbol] = newSettings;
            Configuration config = new Configuration(m_symbolToSettings);

            Configuration.Save(m_path, config);
        }
        internal static ChartSettings MakeDefault()
        {
            ChartSettings result = new ChartSettings();

            result.ResetToDefault();
            return(result);
        }
        internal static ChartSettings GetSettings(string symbol)
        {
            ChartSettings result = null;

            if (!m_symbolToSettings.TryGetValue(symbol, out result))
            {
                result = ChartSettings.MakeDefault();
            }
            return(result);
        }
        internal Dictionary <string, ChartSettings> ToSettings()
        {
            Dictionary <string, ChartSettings> result = new Dictionary <string, ChartSettings>();

            foreach (var element in this.Settings0.Charts)
            {
                string        key      = element.Symbol;
                ChartSettings settings = CreateChart(element);
                result[key] = settings;
            }
            return(result);
        }
        private static ChartSettings CreateChart(ChartSettings0 settings)
        {
            ChartSettings result = new ChartSettings();

            result.Mode            = (RenderingMode)settings.Mode;
            result.Type            = (LineType)settings.Type;
            result.Grid            = settings.Grid;
            result.BackgroundColor = ColorSerializer.ColorFromString(settings.BackgroundColor);
            result.ForegroundColor = ColorSerializer.ColorFromString(settings.ForegroundColor);
            result.Duration        = settings.Duration;
            result.Height          = settings.Height;
            result.UpdateInterval  = settings.UpdateInterval;
            CreateLines(settings.Lines, result.Lines);
            return(result);
        }
        private static ChartSettings0 CreateChart(string symbol, ChartSettings settings)
        {
            ChartSettings0 result = new ChartSettings0();

            result.Symbol          = symbol;
            result.Mode            = (Mode0)settings.Mode;
            result.Type            = (LineType0)settings.Type;
            result.Grid            = settings.Grid;
            result.BackgroundColor = ColorSerializer.StringFromColor(settings.BackgroundColor);
            result.ForegroundColor = ColorSerializer.StringFromColor(settings.ForegroundColor);
            result.Duration        = settings.Duration;
            result.Height          = settings.Height;
            result.UpdateInterval  = settings.UpdateInterval;

            result.Lines = CreateLines(settings.Lines);

            return(result);
        }
        internal ChartSettings(ChartSettings settings)
        {
            if (null == settings)
            {
                throw new ArgumentNullException("settings");
            }
            this.m_backgroundColor = settings.m_backgroundColor;
            this.m_foregoundColor  = settings.m_foregoundColor;
            this.Mode             = settings.Mode;
            this.Type             = settings.Type;
            this.m_duration       = settings.m_duration;
            this.m_height         = settings.m_height;
            this.m_updateInterval = settings.m_updateInterval;
            this.Grid             = settings.Grid;

            this.Lines          = new List <LineSettings>();
            this.Lines.Capacity = settings.Lines.Count;

            foreach (var element in settings.Lines)
            {
                LineSettings line = new LineSettings(element);
                this.Lines.Add(line);
            }
        }