Beispiel #1
0
        /// <summary>Releases the unmanaged resources used by the <see cref="T:System.Windows.Forms.ApplicationContext" /> and optionally releases the managed resources.</summary>
        /// <param name="disposing">
        /// <see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources. </param>
        protected override void Dispose(bool disposing)
        {
            AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;

            ToolPlugInService    toolPlugIns    = Interlocked.Exchange(ref _toolPlugIns, null);
            ContentPlugInService contentPlugIns = Interlocked.Exchange(ref _contentPlugIns, null);
            GraphicsContext      context        = Interlocked.Exchange(ref _graphicsContext, null);
            GorgonMefPlugInCache pluginCache    = Interlocked.Exchange(ref _pluginCache, null);
            FormMain             mainForm       = Interlocked.Exchange(ref _mainForm, null);
            FormSplash           splash         = Interlocked.Exchange(ref _splash, null);

            toolPlugIns?.Dispose();
            contentPlugIns?.Dispose();
            context?.Dispose();
            pluginCache?.Dispose();
            mainForm?.Dispose();
            splash?.Dispose();

            base.Dispose(disposing);
        }