Example #1
0
        public EditorContext()
        {
            //Initialize events
            _context        = Package.GetGlobalService(typeof(DTE)) as DTE;
            _solutionEvents = _context.Events.SolutionEvents;
            _buildEvents    = _context.Events.BuildEvents;

            _solutionEvents.Opened        += OnSolutionOpened;
            _solutionEvents.BeforeClosing += OnSolutionClosing;
            _buildEvents.OnBuildBegin     += OnBuildBegin;
            _buildEvents.OnBuildDone      += OnBuildDone;

            //Initialize log pane
            _outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
            new System.Threading.Thread(() => //Save a second on startup
            {
                _outputWindow.CreatePane(VSConstants.OutputWindowPaneGuid.GeneralPane_guid, "AxoCover", 1, 1);
                _outputWindow.GetPane(VSConstants.OutputWindowPaneGuid.GeneralPane_guid, out _outputPane);
            }).Start();

            //Initialize commands
            _buildCommand    = _context.GetCommand("Build.BuildSolution");
            _goToLineCommand = _context.GetCommand("Edit.GoTo");

            LastBuildTime = DateTime.MinValue;
        }