/// <summary>
        /// CloseCore - Implemented be derivees to Close the context.
        /// This will only be called once (if ever) per instance.
        /// </summary>
        /// <param name="renderData"> The render data produced by this RenderDataDrawingContext.  </param>
        protected override void CloseCore(RenderData renderData)
        {
            Debug.Assert(null != _ownerVisual);
                
            _ownerVisual.RenderClose(renderData);

#if DEBUG
            _ownerVisual = null;
#endif
        }
Beispiel #2
0
        /// <summary>
        /// Converts a RenderData content representation into a DrawingGroup
        /// content representation.
        /// </summary>
        /// <param name="renderData"> The RenderData to convert </param>
        /// <returns>
        /// A new DrawingGroup representation that is functionally equivalent to the
        /// passed-in RenderData.
        /// </returns>
        internal static DrawingGroup DrawingGroupFromRenderData(RenderData renderData)
        {
            //
            // Create & open a new DrawingGroup
            //

            DrawingGroup drawingGroup = new DrawingGroup();

            DrawingContext dc = drawingGroup.Open();

            //
            // Create a DrawingGroup from the RenderData by walking
            // the RenderData & having it forward it's base value's
            // and animations to DrawingGroup
            //

            //
            // The Drawing tree we're about to produce should not be an inheritance context,
            // since that would place all mutable Freezables in the render data into shared
            // state, which would in turn case them to lose their inheritance context entirely.
            // This is controlled by setting "CanBeInheritanceContext" to false on the
            // DrawingContext which will then be applied to all new objects it creates.
            //

            DrawingDrawingContext ddc = dc as DrawingDrawingContext;

            if (ddc != null)
            {
                ddc.CanBeInheritanceContext = false;
            }

            DrawingContextDrawingContextWalker walker =
                new DrawingContextDrawingContextWalker(dc);

            renderData.BaseValueDrawingContextWalk(walker);

            //
            // Close the DrawingContext & return the new DrawingGroup
            //

            dc.Close();

            return drawingGroup;
        }
        /// <summary>
        /// Converts a RenderData content representation into a DrawingGroup
        /// content representation.
        /// </summary>
        /// <param name="renderData"> The RenderData to convert </param>
        /// <returns>
        /// A new DrawingGroup representation that is functionally equivalent to the
        /// passed-in RenderData.
        /// </returns>
        internal static DrawingGroup DrawingGroupFromRenderData(RenderData renderData)
        {
            //
            // Create & open a new DrawingGroup
            //

            DrawingGroup drawingGroup = new DrawingGroup();

            DrawingContext dc = drawingGroup.Open();

            //
            // Create a DrawingGroup from the RenderData by walking
            // the RenderData & having it forward it's base value's
            // and animations to DrawingGroup
            //

            //
            // The Drawing tree we're about to produce should not be an inheritance context,
            // since that would place all mutable Freezables in the render data into shared
            // state, which would in turn case them to lose their inheritance context entirely.
            // This is controlled by setting "CanBeInheritanceContext" to false on the
            // DrawingContext which will then be applied to all new objects it creates.
            //

            DrawingDrawingContext ddc = dc as DrawingDrawingContext;

            if (ddc != null)
            {
                ddc.CanBeInheritanceContext = false;
            }

            DrawingContextDrawingContextWalker walker =
                new DrawingContextDrawingContextWalker(dc);

            renderData.BaseValueDrawingContextWalk(walker);

            //
            // Close the DrawingContext & return the new DrawingGroup
            //

            dc.Close();

            return(drawingGroup);
        }
Beispiel #4
0
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            tileControl.AboutToRender += tileControl_AboutToRender;
            tileControl.TileLayoutChanged += tileControl_TileArrangementChanged;

            var symbolDrawingCache = new SymbolDrawingCache(new Uri("/Symbols/SymbolInfosGfx.xaml", UriKind.Relative));
            tileControl.SymbolDrawingCache = symbolDrawingCache;

            m_renderData = new RenderData<RenderTileDetailed>();
            tileControl.SetRenderData(m_renderData);
            tileControl.TileSize = 32;
            m_targetTileSize = tileControl.TileSize;

            this.MouseWheel += new MouseWheelEventHandler(MainWindow_MouseWheel);
            this.KeyDown += new KeyEventHandler(MainWindow_KeyDown);

            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
            m_timer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, OnTimerCallback, this.Dispatcher);
        }
Beispiel #5
0
 /// <summary>
 /// CloseCore - Implemented be derivees to Close the context.
 /// This will only be called once (if ever) per instance.
 /// </summary>
 /// <param name="renderData"> The render data produced by this RenderDataDrawingContext.  </param>
 protected virtual void CloseCore(RenderData renderData)
 {
 }
 /// <summary>
 /// EnsureRenderData - this method ensures that the _renderData variable is initialized.
 /// The render data's _buffer will be lazily instantiated via the Draw* methods which all
 /// call WriteDataRecord.  
 /// </summary>
 private void EnsureRenderData()
 {
     if (_renderData == null)
     {
         _renderData = new RenderData();
     }
 }
 /// <summary>
 /// CloseCore - Implemented be derivees to Close the context.
 /// This will only be called once (if ever) per instance.
 /// </summary>
 /// <param name="renderData"> The render data produced by this RenderDataDrawingContext.  </param>
 protected virtual void CloseCore(RenderData renderData) {}