예제 #1
0
        /// <summary>
        /// Unloads local content then calls <see cref="OnUnloadContent()"/> for inheriting controls.
        /// </summary>
        protected void UnloadContent()
        {
            _brushes.Cleanup();
            _brushes = null;
            _fonts.Cleanup();
            _fonts = null;

            foreach (var layer in Layers)
            {
                layer.UnloadContent();

                var disposableLayer = layer as IDisposable;
                if (disposableLayer != null)
                {
                    disposableLayer.Dispose();
                }
            }
            Layers.Clear();

            OnUnloadContent();
        }
예제 #2
0
        /// <summary>
        /// Unload content and cleanup unmanaged resources.
        /// </summary>
        public override void UnloadContent()
        {
            base.UnloadContent();
            brushes.Cleanup();
            brushes = null;

            var regionProxies = regions.Values.ToList();

            regions.Clear();

            foreach (var r in regionProxies)
            {
                if (!r.IsDisposed)
                {
                    r.Dispose();
                }
            }

            if (state != null && !state.IsDisposed)
            {
                state.Dispose();
                state = null;
            }
        }