private void DisplayPattern(object o, EventArgs e) { // Retrieve all the info for the pattern name from memory (from the list of patterns) var loadPattern = FormBase.VedwConfigurationSettings.patternList.FirstOrDefault(x => x.LoadPatternName == localComboBoxGenerationPattern.Text); // Set the label with the path so it's visible to the user where the file is located string localFullPath = Path.Combine(FormBase.VedwConfigurationSettings.LoadPatternPath, loadPattern.LoadPatternFilePath); localLabelFullFilePath.Text = localFullPath; //Path.Combine(Environment.CurrentDirectory, "Some\\Path.txt")); // Read the file from the path string loadPatternTemplate = ""; try { loadPatternTemplate = File.ReadAllText(localFullPath); } catch { loadPatternTemplate = $"There was an error loading the pattern specified in the load pattern collection file.\r\n\r\nDoes '{loadPattern.LoadPatternFilePath}' exist and is the path correct?\r\n\r\nIf this is not the case please update the load pattern collection information in the 'settings' tab."; } // Display the pattern in the text box on the screen localRichTextBoxGenerationPattern.Text = loadPatternTemplate; // Syntax highlight for Handlebars if (startUpIndicator == false) { TextHandling.SyntaxHighlightHandlebars(localRichTextBoxGenerationPattern, localRichTextBoxGenerationPattern.Text); } }
public void SyntaxHighlightsHandlebars(object sender, EventArgs e) { TextHandling.SyntaxHighlightHandlebars(localRichTextBoxGenerationPattern, localRichTextBoxGenerationPattern.Text.TrimEnd()); }
/// <summary> /// Function can be called from the main form as well this wya. /// </summary> public void ApplySyntaxHighlightingForHandlebars() { TextHandling.SyntaxHighlightHandlebars(localRichTextBoxGenerationPattern, localRichTextBoxGenerationPattern.Text.TrimEnd()); }