From 3de0d44f88b713e7b018f470c7bd318a775345b7 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 22 Mar 2018 16:21:16 +0200 Subject: Implemented video recording on Data Capture Module! --- .../Controls/ScriptEditorControl.xaml.cs | 39 ++++++++++++---------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs') diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs index 6327196bc..a74e649c0 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs @@ -244,29 +244,34 @@ namespace Tango.SharedUI.Controls private void ScriptEditorControl_Loaded(object sender, RoutedEventArgs e) { - Stream xshd_stream = typeof(ScriptEditorControl).Assembly.GetManifestResourceStream("Tango.SharedUI.CSharp-Mode.xshd"); + if (HighlightTypes != null) + { + Stream xshd_stream = typeof(ScriptEditorControl).Assembly.GetManifestResourceStream("Tango.SharedUI.CSharp-Mode.xshd"); - String text = String.Empty; + String text = String.Empty; - using (StreamReader reader = new StreamReader(xshd_stream)) - { - text = reader.ReadToEnd(); - } + using (StreamReader reader = new StreamReader(xshd_stream)) + { + text = reader.ReadToEnd(); + } - String code = String.Empty; + String code = String.Empty; - foreach (var name in HighlightTypes.Select(x => x.Value).Select(x => x.Name)) - { - code += String.Format("{0}", name) + Environment.NewLine; - } - text = text.Replace("@CUSTOM_TYPES@", code); - using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(text))) - { - XmlTextReader xshd_reader = new XmlTextReader(ms); - textEditor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load(xshd_reader, ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance); - xshd_reader.Close(); + foreach (var name in HighlightTypes.Select(x => x.Value).Select(x => x.Name)) + { + code += String.Format("{0}", name) + Environment.NewLine; + } + + text = text.Replace("@CUSTOM_TYPES@", code); + + using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(text))) + { + XmlTextReader xshd_reader = new XmlTextReader(ms); + textEditor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load(xshd_reader, ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance); + xshd_reader.Close(); + } } } -- cgit v1.3.1