private void LoadConfigStudies() { ConfigurePropertyGridStudies(); btnApplyStudies.Text = Program.LanguageDefault.DictionarySettings["btnApply"]; ConfigStudies configStudies = ListConfigStudies.Instance().LoadListConfigStudies(); StudieInfo studieInfo = new StudieInfo { LineThickness = configStudies.LineThickness, Color = Color.FromArgb(configStudies.Color.ToArgb()), Retraction0 = bool.Parse(configStudies.Retracements[0, 1]), Retraction38 = bool.Parse(configStudies.Retracements[1, 1]), Retraction50 = bool.Parse(configStudies.Retracements[2, 1]), Retraction61 = bool.Parse(configStudies.Retracements[3, 1]), Retraction100 = bool.Parse(configStudies.Retracements[4, 1]), Projection0 = bool.Parse(configStudies.Projections[0, 1]), Projection38 = bool.Parse(configStudies.Projections[1, 1]), Projection50 = bool.Parse(configStudies.Projections[2, 1]), Projection61 = bool.Parse(configStudies.Projections[3, 1]), Projection100 = bool.Parse(configStudies.Projections[4, 1]), Projection161 = bool.Parse(configStudies.Projections[5, 1]), Projection261 = bool.Parse(configStudies.Projections[6, 1]), }; pgrdStudies.SelectedObject = studieInfo; }
private void SaveStudies() { StudieInfo studieInfo = (StudieInfo)pgrdStudies.SelectedObject; const double nullValue = -987654321.0; ConfigStudies configStudies = new ConfigStudies { Color = studieInfo.Color, LineThickness = studieInfo.LineThickness, Retracements = new[, ] { { studieInfo.Retraction0.ToString(), studieInfo.Retraction0.ToString() }, { studieInfo.Retraction38.ToString(), studieInfo.Retraction38.ToString() }, { studieInfo.Retraction50.ToString(), studieInfo.Retraction50.ToString() }, { studieInfo.Retraction61.ToString(), studieInfo.Retraction61.ToString() }, { studieInfo.Retraction100.ToString(), studieInfo.Retraction100.ToString() } }, Projections = new[, ] { { studieInfo.Projection0.ToString(), studieInfo.Projection0.ToString() }, { studieInfo.Projection38.ToString(), studieInfo.Projection38.ToString() }, { studieInfo.Projection50.ToString(), studieInfo.Projection50.ToString() }, { studieInfo.Projection61.ToString(), studieInfo.Projection61.ToString() }, { studieInfo.Projection100.ToString(), studieInfo.Projection100.ToString() }, { studieInfo.Projection161.ToString(), studieInfo.Projection161.ToString() }, { studieInfo.Projection261.ToString(), studieInfo.Projection261.ToString() } }, }; ListConfigStudies.Instance().Update(configStudies); //PERCORRER TODOS OS DOCUMENTOS DO MAIN PARA ATUALIZAR GRÁFICOS ABERTOS: foreach (DockWindow document in _mFrMain2.documentManager.Where(document => (!document.Text.Equals(Program.LanguageDefault.DictionaryPlena["webBrowser"])) && (!document.Text.Equals(Program.LanguageDefault.DictionaryPlena["tradeDiary"])) && (!document.Text.Equals(Program.LanguageDefault.DictionarySelectTools["selectTools"]))).Where(document => document.AccessibleName.Equals("CtlPainelChart"))) { ((CtlPainelChart)document.Controls[0]).StockChartX1.LineColor = configStudies.Color; ((CtlPainelChart)document.Controls[0]).StockChartX1.LineThickness = (int)configStudies.LineThickness; ((CtlPainelChart)document.Controls[0]).StockChartX1.SetFibonacciRetParams( bool.Parse(configStudies.Retracements[4, 1]) ? 0.0 : nullValue, bool.Parse(configStudies.Retracements[3, 1]) ? 0.382 : nullValue, bool.Parse(configStudies.Retracements[2, 1]) ? 0.5 : nullValue, bool.Parse(configStudies.Retracements[1, 1]) ? 0.618 : nullValue, bool.Parse(configStudies.Retracements[0, 1]) ? 1.0 : nullValue, nullValue, nullValue, nullValue, nullValue, nullValue); ((CtlPainelChart)document.Controls[0]).StockChartX1.SetFibonacciProParams( bool.Parse(configStudies.Projections[4, 1]) ? 0.0 : nullValue, bool.Parse(configStudies.Projections[3, 1]) ? 0.382 : nullValue, bool.Parse(configStudies.Projections[2, 1]) ? 0.5 : nullValue, bool.Parse(configStudies.Projections[1, 1]) ? 0.618 : nullValue, bool.Parse(configStudies.Projections[0, 1]) ? 1.0 : nullValue, bool.Parse(configStudies.Projections[5, 1]) ? 1.0 : nullValue, bool.Parse(configStudies.Projections[6, 1]) ? 1.0 : nullValue, nullValue, nullValue, nullValue); } }