예제 #1
0
        private void AddChildToPlotter(CapturingPlotter plotter)
        {
            if (plotter.Children.Count == 0 && childCreateHandler != null)
            {
                int plotterIndex = Array.IndexOf <CapturingPlotter>(plotters, plotter);


                var child = childCreateHandler();
                if (plotterIndex == 0)
                {
                    FrameworkElement element = (FrameworkElement)child;
                    element.AddHandler(Viewport2D.ContentBoundsChangedEvent, new RoutedEventHandler(OnChildContentBoundsChanged));
                    element.AddHandler(BackgroundRenderer.UpdateRequested, new RoutedEventHandler(OnChildUpdateRequested));
                }
                plotter.Children.Add(child);
            }
        }
예제 #2
0
        private void RenderTask()
        {
            var threadIndex = Array.IndexOf <Thread>(renderingThreads, Thread.CurrentThread);

            CapturingPlotter plotter = new CapturingPlotter();

            plotters[threadIndex] = plotter;

            plotter.PerformLoad();
            plotter.ViewportClipToBoundsEnlargeFactor = 1;

            plotter.Measure(tileSize);
            plotter.Arrange(new Rect(tileSize));

            Interlocked.Increment(ref createdPlottersCount);

            AddChildToPlotter(plotter);

            plotter.Dispatcher.Hooks.DispatcherInactive += Hooks_DispatcherInactive;

            Dispatcher.Run();
        }
		private void AddChildToPlotter(CapturingPlotter plotter)
		{
			if (plotter.Children.Count == 0 && childCreateHandler != null)
			{
				int plotterIndex = Array.IndexOf<CapturingPlotter>(plotters, plotter);


				var child = childCreateHandler();
				if (plotterIndex == 0)
				{
					FrameworkElement element = (FrameworkElement)child;
					element.AddHandler(Viewport2D.ContentBoundsChangedEvent, new RoutedEventHandler(OnChildContentBoundsChanged));
					element.AddHandler(BackgroundRenderer.UpdateRequested, new RoutedEventHandler(OnChildUpdateRequested));
				}
				plotter.Children.Add(child);
			}
		}
		private void RenderTask()
		{
			var threadIndex = Array.IndexOf<Thread>(renderingThreads, Thread.CurrentThread);

			CapturingPlotter plotter = new CapturingPlotter();
			plotters[threadIndex] = plotter;

			plotter.PerformLoad();
			plotter.ViewportClipToBoundsEnlargeFactor = 1;

			plotter.Measure(tileSize);
			plotter.Arrange(new Rect(tileSize));

			Interlocked.Increment(ref createdPlottersCount);

			AddChildToPlotter(plotter);

			plotter.Dispatcher.Hooks.DispatcherInactive += Hooks_DispatcherInactive;

			Dispatcher.Run();
		}