/// <devdoc>
        /// WindowsGraphicsCacheManager needs to track DeviceContext
        /// objects so it can ask them if a font is in use before they 
        /// it's deleted.  
        internal static void AddDeviceContext(DeviceContext dc) {
            if (activeDeviceContexts == null) {
                activeDeviceContexts = new ClientUtils.WeakRefCollection();
                activeDeviceContexts.RefCheckThreshold = 20; // See DevDiv#82664 (the repro app attached to this bug was used to determine this number).
            }

            if (!activeDeviceContexts.Contains(dc)) {
                dc.Disposing += new EventHandler(OnDcDisposing);
                activeDeviceContexts.Add(dc);
            }
        }
Пример #2
0
        /// <summary>
        /// WindowsGraphicsCacheManager needs to track DeviceContext objects so it can ask them if a font is in use
        /// before they it's deleted.
        /// </summary>
        internal static void AddDeviceContext(DeviceContext dc)
        {
            ClientUtils.WeakRefCollection wrc = t_activeDeviceContexts ??= new ClientUtils.WeakRefCollection()
            {
                RefCheckThreshold = 20
            };

            if (!wrc.Contains(dc))
            {
                dc.Disposing += new EventHandler(OnDcDisposing);
                wrc.Add(dc);
            }
        }
Пример #3
0
        /// <devdoc>
        /// WindowsGraphicsCacheManager needs to track DeviceContext
        /// objects so it can ask them if a font is in use before they
        /// it's deleted.
        internal static void AddDeviceContext(DeviceContext dc)
        {
            if (t_activeDeviceContexts == null)
            {
                t_activeDeviceContexts = new ClientUtils.WeakRefCollection();
                t_activeDeviceContexts.RefCheckThreshold = 20;
            }

            if (!t_activeDeviceContexts.Contains(dc))
            {
                dc.Disposing += new EventHandler(OnDcDisposing);
                t_activeDeviceContexts.Add(dc);
            }
        }
Пример #4
0
        /// <devdoc>
        /// WindowsGraphicsCacheManager needs to track DeviceContext
        /// objects so it can ask them if a font is in use before they
        /// it's deleted.
        internal static void AddDeviceContext(DeviceContext dc)
        {
            if (activeDeviceContexts == null)
            {
                activeDeviceContexts = new ClientUtils.WeakRefCollection();
                activeDeviceContexts.RefCheckThreshold = 20; // See DevDiv#82664 (the repro app attached to this
            }

            if (!activeDeviceContexts.Contains(dc))
            {
                dc.Disposing += new EventHandler(OnDcDisposing);
                activeDeviceContexts.Add(dc);
            }
        }