Exemplo n.º 1
0
        /// IDispose pattern lets us clean up our stuff!
        protected override void Dispose(bool disposing)
        {
            if (Ticker != null && Ticker.IsAlive)
            {
                Thread.Sleep(TickPeriod + TickPeriod);
                if (Ticker.IsAlive)
                {
                    Logging.WriteLine("WARNING: Force aborting Ticker thread");
                    Ticker.Abort();
                }
            }

            base.Dispose(disposing);

            // Clean up singleton instance
            PrivateInstance = null;

            CommandLineEditor      = null;
            StartupProjectSelector = null;
            BatchBuilder           = null;
            QuickBuilder           = null;

            if (CompileSingleFile != null)
            {
                CompileSingleFile.Dispose();
                CompileSingleFile = null;
            }

            // No longer want solution events
            if (SolutionEventsHandle != 0)
            {
                SolutionManager.UnadviseSolutionEvents(SolutionEventsHandle);
                SolutionEventsHandle = 0;
            }
            SolutionManager = null;

            // No longer want selection events
            if (SelectionEventsHandle != 0)
            {
                SelectionManager.UnadviseSelectionEvents(SelectionEventsHandle);
                SelectionEventsHandle = 0;
            }
            SelectionManager = null;

            // No longer want update solution events
            if (UpdateSolutionEventsHandle != 0)
            {
                SolutionBuildManager.UnadviseUpdateSolutionEvents(UpdateSolutionEventsHandle);
                UpdateSolutionEventsHandle = 0;
            }
            SolutionBuildManager = null;

            Logging.WriteLine("Closing UnrealVS extension");
            Logging.Close();
        }