Ejemplo n.º 1
0
        internal bool HandleBreakPoint(DebugHookType type, string funcName, int line)
        {
            LineMarker breakPoint;
            if (type == DebugHookType.Line && m_BreakPointMarkers.TryGetValue(line, out breakPoint))
            {
                Dispatcher.BeginInvoke((System.Threading.ThreadStart)delegate
                {
                    if (m_ExecutingLineMarker == null)
                    {
                        var arrow = new Polygon()
                        {
                            Fill = Brushes.Yellow,
                            Stroke = Brushes.DimGray,
                            StrokeThickness = 0.9,
                        };
                        var points = new PointCollection();

                        points.Add(new Point(3, 5.5));
                        points.Add(new Point(9, 5.5));
                        points.Add(new Point(9, 2));
                        points.Add(new Point(14, 8));
                        points.Add(new Point(9, 14));
                        points.Add(new Point(9, 10.5));
                        points.Add(new Point(3, 10.5));
                        arrow.Points = points;
                        m_ExecutingLineMarker = new LineMarker() { UIElement = arrow };
                        m_BreakPointViewer.Children.Add(m_ExecutingLineMarker.UIElement);
                        Canvas.SetZIndex(m_ExecutingLineMarker.UIElement, 10000);
                    }

                    double lineY = m_TextEdit.TextArea.TextView.GetVisualPosition(new TextViewPosition(line, 1), VisualYPosition.LineTop).Y;
                    m_ExecutingLineMarker.UIElement.Visibility = System.Windows.Visibility.Visible;
                    m_ExecutingLineMarker.UIElement.RenderTransform = new TranslateTransform(0, lineY);
                },
                System.Windows.Threading.DispatcherPriority.Send);

                return true;
            }
            return false;
        }
Ejemplo n.º 2
0
		void m_VM_OnDebugCallback(DebugHookType type, string sourceName, string funcName, int line)
		{
			//FIXME: Only checking ActiveDocument since we only compile/run that single file for nows.
			SqDocument activeDocument = null;
			Dispatcher.BeginInvoke(
				(ThreadStart)delegate
				{
					activeDocument = ActiveDocument;
				},
				System.Windows.Threading.DispatcherPriority.Send).Wait();

			if (activeDocument != null && activeDocument.DocumentFileName == sourceName)
			{
				if (activeDocument.HandleBreakPoint(type, funcName, line))
				{
					Dispatcher.BeginInvoke(
						(ThreadStart)delegate
						{
							OnScriptThreadPause();
						},
						System.Windows.Threading.DispatcherPriority.Send).Wait();
					m_BreakPointLock.WaitOne();
				}
			}
		}