/// <summary> /// Load Source Files /// </summary> public static void LoadCustomIndicators() { _indicatorManager = new IndicatorCompilationManager(); if (!Directory.Exists(Data.SourceFolder)) { MessageBox.Show("Custom indicators folder does not exist!", Language.T("Custom Indicators")); IndicatorStore.ResetCustomIndicators(null); IndicatorStore.CombineAllIndicators(); return; } string[] pathInputFiles = Directory.GetFiles(Data.SourceFolder, "*.cs"); if (pathInputFiles.Length == 0) { IndicatorStore.ResetCustomIndicators(null); IndicatorStore.CombineAllIndicators(); return; } var errorReport = new StringBuilder(); errorReport.AppendLine("<h1>" + Language.T("Custom Indicators") + "</h1>"); bool isError = false; foreach (string filePath in pathInputFiles) { string errorMessages; _indicatorManager.LoadCompileSourceFile(filePath, out errorMessages); if (!string.IsNullOrEmpty(errorMessages)) { isError = true; errorReport.AppendLine("<h2>File name: " + Path.GetFileName(filePath) + "</h2>"); string error = errorMessages.Replace(Environment.NewLine, "</br>"); error = error.Replace("\t", " "); errorReport.AppendLine("<p>" + error + "</p>"); } } // Adds the custom indicators IndicatorStore.ResetCustomIndicators(_indicatorManager.CustomIndicatorsList); IndicatorStore.CombineAllIndicators(); if (isError) { var msgBox = new FancyMessageBox(errorReport.ToString(), Language.T("Custom Indicators")) { BoxWidth = 550, BoxHeight = 340, TopMost = true }; msgBox.Show(); } if (Configs.ShowCustomIndicators) { ShowLoadedCustomIndicators(); } }
/// <summary> /// Load Source Files /// </summary> public static void LoadCustomIndicators() { _indicatorManager = new IndicatorCompilationManager(); if (!Directory.Exists(Data.SourceFolder)) { MessageBox.Show("Custom indicators folder does not exist!", Language.T("Custom Indicators")); IndicatorStore.ResetCustomIndicators(null); IndicatorStore.CombineAllIndicators(); return; } string[] pathInputFiles = Directory.GetFiles(Data.SourceFolder, "*.cs"); if (pathInputFiles.Length == 0) { IndicatorStore.ResetCustomIndicators(null); IndicatorStore.CombineAllIndicators(); return; } var errorReport = new StringBuilder(); errorReport.AppendLine("<h1>" + Language.T("Custom Indicators") + "</h1>"); bool isError = false; foreach (string filePath in pathInputFiles) { string errorMessages; _indicatorManager.LoadCompileSourceFile(filePath, out errorMessages); if (!string.IsNullOrEmpty(errorMessages)) { isError = true; errorReport.AppendLine("<h2>File name: " + Path.GetFileName(filePath) + "</h2>"); string error = errorMessages.Replace(Environment.NewLine, "</br>"); error = error.Replace("\t", " "); errorReport.AppendLine("<p>" + error + "</p>"); } } // Adds the custom indicators IndicatorStore.ResetCustomIndicators(_indicatorManager.CustomIndicatorsList); IndicatorStore.CombineAllIndicators(); if (isError) { var msgBox = new FancyMessageBox(errorReport.ToString(), Language.T("Custom Indicators")) {BoxWidth = 550, BoxHeight = 340, TopMost = true}; msgBox.Show(); } if (Configs.ShowCustomIndicators) ShowLoadedCustomIndicators(); }
/// <summary> /// Test is finished /// </summary> private static void WorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { var result = (CustomIndicatorsTestResult)e.Result; if (result.IsErrors) { var msgBoxError = new FancyMessageBox(result.ErrorReport, Language.T("Custom Indicators")) { BoxWidth = 550, BoxHeight = 340, TopMost = true }; msgBoxError.Show(); } var msgBoxOK = new FancyMessageBox(result.OKReport, Language.T("Custom Indicators")) { BoxWidth = 350, BoxHeight = 280, TopMost = true }; msgBoxOK.Show(); }
/// <summary> /// Shows the loaded custom indicators. /// </summary> private static void ShowLoadedCustomIndicators() { if (_indicatorManager.CustomIndicatorsList.Count == 0) { return; } var loadedIndicators = new StringBuilder(); loadedIndicators.AppendLine("<h1>" + Language.T("Custom Indicators") + "</h1>"); loadedIndicators.AppendLine("<p>"); foreach (Indicator indicator in _indicatorManager.CustomIndicatorsList) { loadedIndicators.AppendLine(indicator + "</br>"); } loadedIndicators.AppendLine("</p>"); var msgBox = new FancyMessageBox(loadedIndicators.ToString(), Language.T("Custom Indicators")) { BoxWidth = 480, BoxHeight = 260, TopMost = true }; msgBox.Show(); }
/// <summary> /// Test is finished /// </summary> private static void WorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { var result = (CustomIndicatorsTestResult) e.Result; if (result.IsErrors) { var msgBoxError = new FancyMessageBox(result.ErrorReport, Language.T("Custom Indicators")) {BoxWidth = 550, BoxHeight = 340, TopMost = true}; msgBoxError.Show(); } var msgBoxOK = new FancyMessageBox(result.OKReport, Language.T("Custom Indicators")) {BoxWidth = 350, BoxHeight = 280, TopMost = true}; msgBoxOK.Show(); }
/// <summary> /// Shows the loaded custom indicators. /// </summary> private static void ShowLoadedCustomIndicators() { if (_indicatorManager.CustomIndicatorsList.Count == 0) return; var loadedIndicators = new StringBuilder(); loadedIndicators.AppendLine("<h1>" + Language.T("Custom Indicators") + "</h1>"); loadedIndicators.AppendLine("<p>"); foreach (Indicator indicator in _indicatorManager.CustomIndicatorsList) loadedIndicators.AppendLine(indicator + "</br>"); loadedIndicators.AppendLine("</p>"); var msgBox = new FancyMessageBox(loadedIndicators.ToString(), Language.T("Custom Indicators")) {BoxWidth = 480, BoxHeight = 260, TopMost = true}; msgBox.Show(); }