Ejemplo n.º 1
0
        private void EffectLayer_Unloaded(object sender, RoutedEventArgs e)
        {
            // Explicitly remove references to allow the Win2D controls to get garbage collected
            if (canvas != null)
            {
                canvas.Draw -= OnDraw;
                canvas.RemoveFromVisualTree();

                canvas = null;
            }

            if (_eg != null)
            {
                _eg.Dispose(); _eg = null;
            }
            _paths.Clear();
            _uielements.Clear();
            _uielements.Clear();

            _bkgLayer.Content = null;
        }
Ejemplo n.º 2
0
        public void InitLayer(double canvasWidth, double canvasHeight, double offsetX = 0, double offsetY = 0, EffectGraphType graphType = EffectGraphType.Shadow)
        {
            return;

            if (graphType == EffectGraphType.Shadow)
            {
                _eg = new ShadowEffectGraph();
            }
            else if (graphType == EffectGraphType.Glow)
            {
                _eg = new GlowEffectGraph();
            }

            ParentWidth  = canvasWidth - offsetX;
            ParentHeight = canvasHeight - offsetY;

            //x
            canvas = new CanvasControl();
            if (ShowGlowArea)
            {
                canvas.ClearColor = Windows.UI.Colors.CornflowerBlue;
            }
            canvas.Width  = ParentWidth + ExpandAmount;
            canvas.Height = ParentHeight + ExpandAmount;

            //if the control begins invisible or hidden then it will not have rendered its tree yet
            //we can only do this init if bkglayer exists, which means only after OnApplyTemplate
            //.. this is such a hack BUT it's a chicken and egg problem, sometimes the InitLayer gets
            //called too early :(
            if (_bkgLayer == null)
            {
                doDlayedInitBkgLayerLaterAfterOnApplyTemplate = true;
            }
            else
            {
                InitBkgLayer(offsetX, offsetY);
            }
        }
Ejemplo n.º 3
0
        private void EffectLayer_Unloaded(object sender, RoutedEventArgs e)
        {
            // Explicitly remove references to allow the Win2D controls to get garbage collected
            if (canvas != null)
            {
                canvas.Draw -= OnDraw;
                canvas.RemoveFromVisualTree();
                
                canvas = null;
            }

            if (_eg != null) { _eg.Dispose(); _eg = null; }
            _paths.Clear();
            _uielements.Clear();
            _uielements.Clear();

            _bkgLayer.Content = null;


        }
Ejemplo n.º 4
0
        public void InitLayer(double canvasWidth, double canvasHeight, double offsetX = 0, double offsetY = 0, EffectGraphType graphType = EffectGraphType.Shadow) {

            return;

            if(graphType == EffectGraphType.Shadow) _eg = new ShadowEffectGraph();
            else if (graphType == EffectGraphType.Glow) _eg = new GlowEffectGraph();

            ParentWidth = canvasWidth - offsetX;
            ParentHeight = canvasHeight - offsetY;

            //x    
            canvas = new CanvasControl();
            if (ShowGlowArea) canvas.ClearColor = Windows.UI.Colors.CornflowerBlue;
            canvas.Width = ParentWidth + ExpandAmount;
            canvas.Height = ParentHeight + ExpandAmount;

            //if the control begins invisible or hidden then it will not have rendered its tree yet 
            //we can only do this init if bkglayer exists, which means only after OnApplyTemplate
            //.. this is such a hack BUT it's a chicken and egg problem, sometimes the InitLayer gets
            //called too early :(
            if (_bkgLayer == null) doDlayedInitBkgLayerLaterAfterOnApplyTemplate = true;
            else InitBkgLayer(offsetX, offsetY);
        }