Esempio n. 1
0
        private void InitializeWithDTEAndSolutionReady()
        {
            m_dte = (EnvDTE.DTE) this.GetService(typeof(EnvDTE.DTE));

            if (m_dte == null)
            {
                ErrorHandler.ThrowOnFailure(1);
            }

            var solutionBase = "";
            var solutionName = "";

            if (m_dte.Solution != null)
            {
                solutionBase = System.IO.Path.GetDirectoryName(m_dte.Solution.FullName);
                solutionName = System.IO.Path.GetFileNameWithoutExtension(m_dte.Solution.FullName);
            }
            //string dbName = string.Format("Ganji.History-{0}.sdf", solutionName);

            var basePath     = PreparePath();
            var ganjiContext = new GanjiContext();

            ganjiContext.RepositoryPath = System.IO.Path.Combine(basePath, "LocalHistory");
            ganjiContext.SolutionPath   = solutionBase;

            CodeElementMagic.m_applicationObject = m_dte;

            HistoryContext.ConfigureDatabase(basePath);
            RemindersContext.ConfigureDatabase(basePath);
            SessionsContext.ConfigureDatabase(basePath);

            m_saveListener = new SaveListener();
            m_saveListener.Register(m_dte, ganjiContext);

            m_navigateListener = new NavigateListener();
            m_navigateListener.Register(m_dte, ganjiContext);

            m_exceptionListener = new ExceptionListener();
            m_exceptionListener.Register(m_dte, ganjiContext);
            //if (m_version != null)
            //{
            //    dbName = string.Format("ActivityDB{0}-{1}.sdf", m_version.ToString(),solutionName);
            //}

            //var basePath = PreparePath();
            //var path = System.IO.Path.Combine(basePath, dbName);
            //database = new Database(path);
            //database.OpenOrCreate();
        }
Esempio n. 2
0
        private void InitializeWithSolutionAndDTEReady()
        {
            string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);

            dte = (EnvDTE.DTE) this.GetService(typeof(EnvDTE.DTE));
            if (dte != null && dte.Solution != null)
            {
                path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData);
                path = System.IO.Path.Combine(path, "attachables", System.IO.Path.GetFileNameWithoutExtension(dte.Solution.FullName));
            }
            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }


            RemindersContext.ConfigureDatabase(path);
            Manager = new ReminderManager(this);

            // Check due reminders once during startup.
            Manager.CheckTodoBy();

            // Need to always have reference to avoid COM releasing.
            buildEvents = dte.Events.BuildEvents;

            buildEvents.OnBuildBegin += (scope, action) =>
            {
                // Check due reminders when building.
                Manager.CheckTodoBy();
            };

            buildEvents.OnBuildDone += (scope, action) =>
            {
            };


            buildEvents.OnBuildProjConfigBegin += (project, config, platform, solutionConfig) =>
            {
            };


            buildEvents.OnBuildProjConfigDone += (project, config, platform, solutionConfig, success) =>
            {
            };
        }