예제 #1
0
 public EvalExprEvent(TemplateFrame frame, Interval outputInterval, Interval sourceInterval)
     : base(frame, outputInterval)
 {
     this._sourceInterval = sourceInterval;
     if (_sourceInterval != null)
         expr = frame.Template.impl.Template.Substring(_sourceInterval.Start, _sourceInterval.Length);
 }
예제 #2
0
        public override object GetProperty(Interpreter interpreter, TemplateFrame frame, object obj, object property, string propertyName)
        {
            WriteVerbose?.Invoke(string.Format("Type:{0}, property: {1}, propertyName:{2}", obj.GetType().Name, property, propertyName));

            var pso = obj as PSObject;

            if (pso != null)
            {
                foreach (var psmi in pso.Members)
                {
                }
                foreach (var pspi in pso.Properties)
                {
                    WriteVerbose?.Invoke(string.Format("dump properties MemberType:{0}, TypeNameOfValue: {1}, Name:{2}, IsGettable:{3}", pspi.MemberType, pspi.TypeNameOfValue, pspi.Name, pspi.IsGettable));
                }
                var pi = pso.Properties[propertyName];

                WriteVerbose?.Invoke(pi != null ? string.Format("propertyName: {0}, name: {1}, MemberType: {2}, IsGettable:{3}, TypeNameOfValue: {4}", propertyName, pi?.Name, pi?.MemberType, pi?.IsGettable, pi?.TypeNameOfValue) : string.Format("propertyName: {0}", propertyName));

                var value = pso.Properties[propertyName]?.Value;
                if (value == null)
                {
                    var adap = frame.Template.Group.GetModelAdaptor(pso.BaseObject.GetType());
                    return(adap.GetProperty(interpreter, frame, pso.BaseObject, property, propertyName));
                }
                return(value);
            }
            return(null);
        }
        public virtual object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
        {
            if (o == null)
            {
                throw new ArgumentNullException("o");
            }

            Type c = o.GetType();

            if (o is DynamicXml xml)
            {
                xml.TryGetMember(new Goof(propertyName, true), out object x3);
                return(x3);
            }

            if (property == null)
            {
                throw new TemplateNoSuchPropertyException(o, string.Format("{0}.{1}", c.FullName, propertyName ?? "null"));
            }

            object value;
            var    accessor = FindMember(c, propertyName);

            if (accessor != null)
            {
                value = accessor(o);
            }
            else
            {
                throw new TemplateNoSuchPropertyException(o, string.Format("{0}.{1}", c.FullName, propertyName));
            }

            return(value);
        }
예제 #4
0
        public virtual object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
        {
            object value;
            IDictionary map = (IDictionary)o;

            if (property == null)
                value = map[TemplateGroup.DefaultKey];
            else if (property.Equals("Keys"))
                value = map.Keys;
            else if (property.Equals("Values"))
                value = map.Values;
            else if (map.Contains(property))
                value = map[property];
            else if (map.Contains(propertyName))
                value = map[propertyName]; // if can't find the key, try ToString version
            else
                value = map[TemplateGroup.DefaultKey]; // not found, use default

            if (object.ReferenceEquals(value, TemplateGroup.DictionaryKey))
            {
                value = property;
            }

            return value;
        }
예제 #5
0
        public TemplateVisualizer(ErrorManager errorManager, TemplateFrame root, string output, Interpreter interpreter, List <string> trace, ReadOnlyCollection <TemplateMessage> errors)
        {
            if (errorManager == null)
            {
                throw new ArgumentNullException("errorManager");
            }
            if (root == null)
            {
                throw new ArgumentNullException("root");
            }
            if (interpreter == null)
            {
                throw new ArgumentNullException("interpreter");
            }
            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }
            if (errors == null)
            {
                throw new ArgumentNullException("errors");
            }

            _errorManager = errorManager;
            _root         = root;
            _output       = output;
            _interpreter  = interpreter;
            _trace        = trace;
            _errors       = errors;
        }
예제 #6
0
        public override object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
        {
            Aggregate aggregate = o as Aggregate;
            if (aggregate == null)
                throw new ArgumentException();

            return base.GetProperty(interpreter, frame, aggregate.Properties, property, propertyName);
        }
예제 #7
0
            public object GetProperty(Interpreter interpreter, TemplateFrame frame, object obj, object property, string propertyName)
            {
                if (obj is PropertyCollection collection)
                {
                    return(collection[propertyName]);
                }

                return("");
            }
예제 #8
0
 public EvalExprEvent(TemplateFrame frame, Interval outputInterval, Interval sourceInterval)
     : base(frame, outputInterval)
 {
     this._sourceInterval = sourceInterval;
     if (_sourceInterval != null)
     {
         expr = frame.Template.impl.Template.Substring(_sourceInterval.Start, _sourceInterval.Length);
     }
 }
예제 #9
0
        public InterpEvent(TemplateFrame frame, Interval interval)
        {
            if (frame == null)
                throw new ArgumentNullException("frame");
            if (interval == null)
                throw new ArgumentNullException("interval");

            this._frame = frame;
            this._interval = interval;
        }
예제 #10
0
 /// <summary>
 /// Gets the value of a property if it exists.
 /// </summary>
 /// <param name="interpreter">The current interpreter passed by Antlr.</param>
 /// <param name="frame">The current frame passed by Antlr.</param>
 /// <param name="o">The target of the property binding</param>
 /// <param name="property">The property passed by Antlr.</param>
 /// <param name="propertyName">The target property name.</param>
 /// <returns>The value of the property if it exists, otherwise <see langword="null"/>.</returns>
 public override object GetProperty(
     Interpreter interpreter,
     TemplateFrame frame,
     object o,
     object property,
     string propertyName)
 {
     return(GetProperty(o as Type, propertyName) ??
            base.GetProperty(interpreter, frame, o, property, propertyName));
 }
예제 #11
0
            public object CreateProxy(TemplateFrame frame, object obj)
            {
                Template template = obj as Template;

                if (template != null && template.Group != _ignoreGroup)
                {
                    return(new TemplateProxy(template));
                }

                return(obj);
            }
예제 #12
0
        private void HandleCallHierarchyTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            TemplateCallHierarchyViewModel selected = CallHierarchyTreeView.SelectedItem as TemplateCallHierarchyViewModel;

            if (selected != null && _currentFrame != selected.Frame)
            {
                _currentEvent = selected.Event;
                _currentFrame = selected.Frame;
                UpdateCurrentTemplate();
            }
        }
예제 #13
0
        public override object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
        {
            Aggregate aggregate = o as Aggregate;

            if (aggregate == null)
            {
                throw new ArgumentException();
            }

            return(base.GetProperty(interpreter, frame, aggregate.Properties, property, propertyName));
        }
예제 #14
0
 public object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
 {
     if (propertyName.Equals("id"))
     {
         return("const id value");
     }
     if (propertyName.Equals("name"))
     {
         return("const name value");
     }
     throw new TemplateNoSuchPropertyException(null, "User." + propertyName);
 }
예제 #15
0
        public override object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
        {
            var member = GetType().GetMethods()
                         .FirstOrDefault(p => p.GetCustomAttribute <ModelAttribute>()?.Name == propertyName);

            if (member != null)
            {
                return(member.Invoke(this, new [] { o }));
            }

            return(base.GetProperty(interpreter, frame, o, property, propertyName));
        }
예제 #16
0
            public object CreateProxy(TemplateFrame frame, object obj)
            {
                if (frame.Template.Name == "dictionaryTemplate")
                {
                    return(obj);
                }

                Template template = GetAggregateRendererTemplate();

                template.Add("aggr", obj);
                return(template);
            }
예제 #17
0
 public static TemplateVisualizer Visualize(this Template template, ErrorManager errorManager, CultureInfo culture, int lineWidth)
 {
     ErrorBuffer errors = new ErrorBuffer();
     template.impl.NativeGroup.Listener = errors;
     StringWriter @out = new StringWriter();
     ITemplateWriter wr = new AutoIndentWriter(@out);
     wr.LineWidth = lineWidth;
     Interpreter interp = new Interpreter(template.Group, culture, true);
     TemplateFrame frame = new TemplateFrame(template, null);
     interp.Execute(wr, frame); // Render and track events
     TemplateVisualizer visualizer = new TemplateVisualizer(errorManager, frame, @out.ToString(), interp, interp.GetExecutionTrace(), errors.Errors);
     visualizer.Show();
     return visualizer;
 }
예제 #18
0
        public InterpEvent(TemplateFrame frame, Interval interval)
        {
            if (frame == null)
            {
                throw new ArgumentNullException("frame");
            }
            if (interval == null)
            {
                throw new ArgumentNullException("interval");
            }

            this._frame    = frame;
            this._interval = interval;
        }
예제 #19
0
        private void HandleErrorsListBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int                    minIndex       = ErrorsListBox.SelectedIndex;
            TemplateMessage        message        = ErrorsListBox.SelectedItem as TemplateMessage;
            TemplateRuntimeMessage runtimeMessage = message as TemplateRuntimeMessage;

            if (runtimeMessage != null)
            {
                Interval interval = runtimeMessage.SourceInterval;
                _currentEvent = null;
                _currentFrame = runtimeMessage.Frame;
                UpdateCurrentTemplate();
                Highlight(TemplateTextBox.Document, interval);
            }
        }
예제 #20
0
        private void HandleOutputTextBoxSelectionChanged(object sender, RoutedEventArgs e)
        {
            _currentEvent = FindEventAtOutputLocation(ViewModel.AllEvents, OutputTextBox.Document.GetCharOffsetToPosition(OutputTextBox.CaretPosition));
            if (_currentEvent == null)
            {
                _currentFrame = ViewModel.Visualizer.RootTemplate;
            }
            else
            {
                _currentFrame = _currentEvent.Frame;
            }

            SetSelectionPath(ViewModel.TemplateCallHierarchy[0], _currentFrame.GetEvalTemplateEventStack(true));
            UpdateCurrentTemplate();
        }
예제 #21
0
        public static TemplateVisualizer Visualize(this Template template, ErrorManager errorManager, CultureInfo culture, int lineWidth)
        {
            ErrorBuffer errors = new ErrorBuffer();

            template.impl.NativeGroup.Listener = errors;
            StringWriter    @out = new StringWriter();
            ITemplateWriter wr   = new AutoIndentWriter(@out);

            wr.LineWidth = lineWidth;
            Interpreter   interp = new Interpreter(template.Group, culture, true);
            TemplateFrame frame  = new TemplateFrame(template, null);

            interp.Execute(wr, frame); // Render and track events
            TemplateVisualizer visualizer = new TemplateVisualizer(errorManager, frame, @out.ToString(), interp, interp.GetExecutionTrace(), errors.Errors);

            visualizer.Show();
            return(visualizer);
        }
        /// <summary>
        /// Gets the value of a property if it exists.
        /// </summary>
        /// <param name="interpreter">The current interpreter passed by Antlr.</param>
        /// <param name="frame">The current frame passed by Antlr.</param>
        /// <param name="obj">The target of the property binding</param>
        /// <param name="property">The property passed by Antlr.</param>
        /// <param name="propertyName">The target property name.</param>
        /// <returns>The value of the property if it exists, otherwise <see langword="null"/>.</returns>
        public override object GetProperty(
            Interpreter interpreter,
            TemplateFrame frame,
            object obj,
            object property,
            string propertyName)
        {
            var psObject = obj as PSObject;

            if (psObject == null)
            {
                return(base.GetProperty(interpreter, frame, obj, property, propertyName));
            }

            // Check for static property matches if we're processing a type,
            // continue to instance properties if binding fails.
            if (psObject.BaseObject is Type type)
            {
                var typeResult = TypeAdapter.GetProperty(type, propertyName);
                if (typeResult != null)
                {
                    return(typeResult);
                }
            }

            var result = psObject.Properties.FirstOrDefault(p => p.Name == propertyName);

            if (result != null)
            {
                return(AdapterUtil.NullIfEmpty(result.Value));
            }

            var method = psObject.Methods.FirstOrDefault(
                m =>
            {
                return
                (m.Name == string.Concat("Get", propertyName) &&
                 m.OverloadDefinitions.FirstOrDefault().Contains(@"()") &&
                 !m.OverloadDefinitions.FirstOrDefault().Contains("void"));
            });

            return(AdapterUtil.NullIfEmpty(method?.Invoke()));
        }
예제 #23
0
        public TemplateVisualizer(ErrorManager errorManager, TemplateFrame root, string output, Interpreter interpreter, List<string> trace, ReadOnlyCollection<TemplateMessage> errors)
        {
            if (errorManager == null)
                throw new ArgumentNullException("errorManager");
            if (root == null)
                throw new ArgumentNullException("root");
            if (interpreter == null)
                throw new ArgumentNullException("interpreter");
            if (trace == null)
                throw new ArgumentNullException("trace");
            if (errors == null)
                throw new ArgumentNullException("errors");

            _errorManager = errorManager;
            _root = root;
            _output = output;
            _interpreter = interpreter;
            _trace = trace;
            _errors = errors;
        }
예제 #24
0
        protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
        {
            if (e.Property == DataContextProperty)
            {
                var viewModel = ViewModel;
                if (viewModel == null)
                {
                    return;
                }

                _currentEvent          = null;
                _currentFrame          = viewModel.Visualizer.RootTemplate;
                OutputTextBox.Document = new FlowDocument(new Paragraph(new Run(viewModel.Output)
                {
                    FontFamily = new FontFamily("Consolas")
                }));
                UpdateCurrentTemplate();
            }

            base.OnPropertyChanged(e);
        }
예제 #25
0
        public virtual object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
        {
            if (o == null)
                throw new ArgumentNullException("o");

            Type c = o.GetType();
            if (property == null)
                throw new TemplateNoSuchPropertyException(o, string.Format("{0}.{1}", c.FullName, propertyName ?? "null"));

            object value;
            var accessor = FindMember(c, propertyName);
            if (accessor != null)
            {
                value = accessor(o);
            }
            else
            {
                throw new TemplateNoSuchPropertyException(o, string.Format("{0}.{1}", c.FullName, propertyName));
            }

            return value;
        }
예제 #26
0
        public override object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
        {
            object      value;
            IDictionary map = (IDictionary)o;

            if (property == null)
            {
                value = map[TemplateGroup.DefaultKey];
            }
            else if (property.Equals("keys"))
            {
                value = map.Keys;
            }
            else if (property.Equals("values"))
            {
                value = map.Values;
            }
            else if (map.Contains(property))
            {
                value = map[property];
            }
            else if (map.Contains(propertyName))
            {
                value = map[propertyName]; // if can't find the key, try ToString version
            }
            else
            {
                value = map[TemplateGroup.DefaultKey]; // not found, use default
            }
            if (object.ReferenceEquals(value, TemplateGroup.DictionaryKey))
            {
                value = property;
            }

            WriteVerbose?.Invoke(string.Format("Type:{0}, property: {1}, propertyName:{2}, value:{3}", o.GetType().Name, property, propertyName, value));

            return(value);
        }
예제 #27
0
        public virtual object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
        {
            object      value;
            IDictionary map = (IDictionary)o;

            if (property == null)
            {
                value = map[TemplateGroup.DefaultKey];
            }
            else if (map.Contains(property))
            {
                value = map[property];
            }
            else if (map.Contains(propertyName))
            {
                value = map[propertyName]; // if can't find the key, try ToString version
            }
            else if (property.Equals("keys"))
            {
                value = map.Keys;
            }
            else if (property.Equals("values"))
            {
                value = map.Values;
            }
            else
            {
                value = map[TemplateGroup.DefaultKey]; // not found, use default
            }
            if (object.ReferenceEquals(value, TemplateGroup.DictionaryKey))
            {
                value = property;
            }

            return(value);
        }
예제 #28
0
        public virtual object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
        {
            Template template = (Template)o;

            return(template.GetAttribute(propertyName));
        }
예제 #29
0
        public List <Template> GetAllTemplates()
        {
            List <Template> templates = new List <Template>();

            using (var command = DatabaseProvider.DbProviderFactory.CreateCommand())
            {
                InitializeGetAllTemplates(command);
                using (var reader = DatabaseProvider.ExecuteReader(command))
                {
                    while (reader.Read())
                    {
                        Template template = new Template();

                        using (var frameCommand = DatabaseProvider.DbProviderFactory.CreateCommand())
                        {
                            template.Id           = reader.GetColumnValue <string>("Id");
                            template.Name         = reader.GetColumnValue <string>("Name");
                            template.Modality     = reader.GetColumnValue <string>("Modality");
                            template.Created      = reader.GetColumnValue <DateTime?>("Created");
                            template.Hidden       = reader.GetColumnValue <bool>("Hidden");
                            template.AutoMatching = reader.GetColumnValue <string>("AutoMatching");
                            template.BuiltIn      = reader.GetColumnValue <bool>("BuiltIn");
                            template.Comments     = reader.GetColumnValue <string>("Comments");
                            template.Availability = reader.GetColumnValue <AvailabilityLevel>("Availability");

                            InitializeGetTemplateFrames(frameCommand, template.Id);
                            using (var frameReader = DatabaseProvider.ExecuteReader(frameCommand))
                            {
                                while (frameReader.Read())
                                {
                                    TemplateFrame frame;
                                    FramePosition position = new FramePosition();

                                    position.leftTop     = new LeadPointD(frameReader.GetColumnValue <double>("Left"), frameReader.GetColumnValue <double>("Top"));
                                    position.rightBottom = new LeadPointD(frameReader.GetColumnValue <double>("Right"), frameReader.GetColumnValue <double>("Bottom"));
                                    frame                         = new TemplateFrame(position);
                                    frame.Id                      = frameReader.GetColumnValue <string>("Id");
                                    frame.FrameNumber             = frameReader.GetColumnValue <int>("FrameNumber");
                                    frame.SequenceNumber          = frameReader.GetColumnValue <int>("SequenceNumber");
                                    frame.ImageComments           = frameReader.GetColumnValue <string>("Comments");
                                    frame.Rotation                = frameReader.GetColumnValue <FrameRotation>("FrameRotation");
                                    frame.HorizontalJustification = frameReader.GetColumnValue <FrameHorizontalJustication>("HorizontalJustification");
                                    frame.VerticalJustification   = frameReader.GetColumnValue <FrameVerticalJustification>("VerticalJustification");
                                    frame.PresentationSizeMode    = frameReader.GetColumnValue <PresentationSizeMode>("PresentationSizeMode");
                                    frame.Magnification           = frameReader.GetColumnValue <double>("Magnification");
                                    //frame.AnatomicDescription = anatomicDescriptions.Where(a => a.Id == frameReader.GetColumnValue<string>("AnatomicDescriptionId")).FirstOrDefault();
                                    frame.Script  = frameReader.GetColumnValue <string>("Script");
                                    frame.Flip    = frameReader.GetColumnValue <bool>("Flip");
                                    frame.Reverse = frameReader.GetColumnValue <bool>("Reverse");
                                    frame.Invert  = frameReader.GetColumnValue <bool>("Invert");
                                    template.Frames.Add(frame);
                                }
                            }
                        }

                        templates.Add(template);
                    }
                }
            }

            return(templates);
        }
 protected override Template GetEmbeddedInstanceOf(TemplateFrame frame, string name)
 {
     return(base.GetEmbeddedInstanceOf(frame, name));
 }
예제 #31
0
 public virtual void RuntimeError(TemplateFrame frame, ErrorType error, object arg, object arg2, object arg3)
 {
     Listener.RuntimeError(new TemplateRuntimeMessage(error, frame != null ? frame.InstructionPointer : 0, frame, null, arg, arg2, arg3));
 }
예제 #32
0
 public EvalTemplateEvent(TemplateFrame frame, Interval interval)
     : base(frame, interval)
 {
 }
예제 #33
0
 public IndentEvent(TemplateFrame frame, Interval outputInterval, Interval sourceInterval)
     : base(frame, outputInterval, sourceInterval)
 {
 }
예제 #34
0
 public virtual object GetProperty(Interpreter interpreter, TemplateFrame frame, object o, object property, string propertyName)
 {
     Template template = (Template)o;
     return template.GetAttribute(propertyName);
 }
예제 #35
0
 public TemplateRuntimeMessage(ErrorType error, int ip, TemplateFrame frame, Exception e, object arg)
     : this(error, ip, frame, e, arg, null)
 {
 }
 private void HandleCallHierarchyTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
 {
     TemplateCallHierarchyViewModel selected = CallHierarchyTreeView.SelectedItem as TemplateCallHierarchyViewModel;
     if (selected != null && _currentFrame != selected.Frame)
     {
         _currentEvent = selected.Event;
         _currentFrame = selected.Frame;
         UpdateCurrentTemplate();
     }
 }
예제 #37
0
 public TemplateRuntimeMessage(ErrorType error, int ip, TemplateFrame frame, Exception e, object arg, object arg2, object arg3)
     : base(error, frame.Template, e, arg, arg2, arg3)
 {
     this.ip = ip;
     this._frame = frame;
 }
예제 #38
0
 public TemplateRuntimeMessage(ErrorType error, int ip, TemplateFrame frame, Exception e, object arg)
     : this(error, ip, frame, e, arg, null)
 {
 }
 public AttributeNotFoundException(TemplateFrame frame, string attributeName)
 {
     _frame         = frame;
     _attributeName = attributeName;
 }
예제 #40
0
 public TemplateRuntimeMessage(ErrorType error, int ip, TemplateFrame frame, Exception e, object arg, object arg2, object arg3)
     : base(error, frame?.Template, e, arg, arg2, arg3)
 {
     this.ip     = ip;
     this._frame = frame;
 }
예제 #41
0
 public EvalTemplateEvent(TemplateFrame frame, Interval interval)
     : base(frame, interval)
 {
 }
예제 #42
0
 public virtual void RuntimeError(TemplateFrame frame, ErrorType error, object arg, object arg2, object arg3)
 {
     Listener.RuntimeError(new TemplateRuntimeMessage(error, frame != null ? frame.InstructionPointer : 0, frame, null, arg, arg2, arg3));
 }
예제 #43
0
 public IndentEvent(TemplateFrame frame, Interval outputInterval, Interval sourceInterval)
     : base(frame, outputInterval, sourceInterval)
 {
 }
        protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
        {
            if (e.Property == DataContextProperty)
            {
                var viewModel = ViewModel;
                if (viewModel == null)
                    return;

                _currentEvent = null;
                _currentFrame = viewModel.Visualizer.RootTemplate;
                OutputTextBox.Document = new FlowDocument(new Paragraph(new Run(viewModel.Output)
                {
                    FontFamily = new FontFamily("Consolas")
                }));
                UpdateCurrentTemplate();
            }

            base.OnPropertyChanged(e);
        }
예제 #45
0
 public TemplateRuntimeMessage(ErrorType error, int ip, TemplateFrame frame)
     : this(error, ip, frame, null)
 {
 }
 private void HandleErrorsListBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     int minIndex = ErrorsListBox.SelectedIndex;
     TemplateMessage message = ErrorsListBox.SelectedItem as TemplateMessage;
     TemplateRuntimeMessage runtimeMessage = message as TemplateRuntimeMessage;
     if (runtimeMessage != null)
     {
         Interval interval = runtimeMessage.SourceInterval;
         _currentEvent = null;
         _currentFrame = runtimeMessage.Frame;
         UpdateCurrentTemplate();
         Highlight(TemplateTextBox.Document, interval);
     }
 }
예제 #47
0
 protected abstract void InitializeAddFrame(DbCommand command, string templateId, TemplateFrame frame);
        private void HandleOutputTextBoxSelectionChanged(object sender, RoutedEventArgs e)
        {
            _currentEvent = FindEventAtOutputLocation(ViewModel.AllEvents, OutputTextBox.Document.GetCharOffsetToPosition(OutputTextBox.CaretPosition));
            if (_currentEvent == null)
                _currentFrame = ViewModel.Visualizer.RootTemplate;
            else
                _currentFrame = _currentEvent.Frame;

            SetSelectionPath(ViewModel.TemplateCallHierarchy[0], _currentFrame.GetEvalTemplateEventStack(true));
            UpdateCurrentTemplate();
        }
 public AttributeNotFoundException(TemplateFrame frame, string attributeName)
 {
     _frame = frame;
     _attributeName = attributeName;
 }