コード例 #1
0
        ////private void SolutionEvents_OnAfterLoadProject(object sender, LoadProjectEventArgs e)
        ////{
        ////    ThreadHelper.ThrowIfNotOnUIThread();
        ////    _packageHelper.LogDebug("OnAfterLoadProject");
        ////    ProcessProjectRefs(e.RealHierarchy);
        ////}

        ////private void SolutionEvents_OnAfterOpenProject(object sender, OpenProjectEventArgs e)
        ////{
        ////    ThreadHelper.ThrowIfNotOnUIThread();
        ////    _packageHelper.LogDebug("OnAfterOpenProject");
        ////    ProcessProjectRefs(e.Hierarchy);
        ////}

        private void SolutionEvents_OnAfterOpenSolution(object sender, OpenSolutionEventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            _packageHelper.LogDebug("OnAfterOpenSolution");
            _solutionOpened = true;
            ProcessProjectRefs();
        }
コード例 #2
0
        private void HandleOpenSolution(object _, OpenSolutionEventArgs __)
        {
            var dte      = (DTE)GetGlobalService(typeof(DTE));
            var projects = dte.Solution.Projects;
            var modules  = new List <string>();

            foreach (Project myProject in projects)
            {
                foreach (ProjectItem myProjectProjectItem in myProject.ProjectItems)
                {
                    modules.AddRange(GetModules(myProjectProjectItem));
                }
            }

            if (modules.Count == 0)
            {
                return;
            }

            var moduleUnits = Compiler.Instance.CompileModules(modules.ToArray());

            moduleUnits
            .SelectMany(mUnit => mUnit
                        .CompilationUnit
                        .OnlyValidModules()
                        .ValidModules
                        .Select(validModule => new FileCompilationUnit <Extension.ValidModuleRegistration>(mUnit.FilePath, validModule)))
            .ForEach(x =>
            {
                ModuleHub.Instance.ModulePool.Request(
                    x,
                    x.CompilationUnit.ClassRegistrations.ToViewModels(),
                    x.CompilationUnit.ModuleRegistrations.CollectSubModules());
            });
        }
コード例 #3
0
        /// <summary>
        /// When a linqpad project exists, add new items in the LinqPad folders to the project.
        /// Add a FileSystemWatcher to monitor file actions in the LinqPad project
        /// </summary>
        private void SolutionEvents_OnAfterOpenSolution(object sender, OpenSolutionEventArgs e)
        {
            var dte = (EnvDTE80.DTE2) this.GetService(typeof(EnvDTE.DTE));

            FolderService = new FolderService(dte);

            ThreadHelper.ThrowIfNotOnUIThread();
            // add existing files
            FolderService.SolutionAddItems();
        }
コード例 #4
0
        private void AfterOpenSolution(object sender = null, OpenSolutionEventArgs e = null)
        {
            var solution = GetService(typeof(SVsSolution)) as IVsSolution;

            if (solution.GetProperty((int)__VSPROPID.VSPROPID_SolutionFileName, out object solutionFileNameValue) == VSConstants.S_OK &&
                solutionFileNameValue is string solutionFileName &&
                !string.IsNullOrEmpty(solutionFileName))
            {
                SolutionDirectoryPath = Path.GetDirectoryName(solutionFileName);
                ConfigFilePath        = Path.Combine(SolutionDirectoryPath, CodeAnalysisConfiguration.ConfigFileName);
            }

            UpdateSettings();

            WatchConfigFile();
        }
        private void OnSolutionOpened(object sender = null, OpenSolutionEventArgs e = null)
        {
            _isTwinCATProject = false;
            _systemManager    = null;

            ThreadHelper.ThrowIfNotOnUIThread();

            var dte = GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;

            if (dte != null)
            {
                _DTE = dte;

                // Get all projects in active solution
                _projects = _DTE.Solution.Projects
                            .Cast <EnvDTE.Project>()
                            .ToList();

                // Find TwinCAT Project and save the systemmanager
                foreach (var project in _projects)
                {
                    try
                    {
                        ITcSysManager sysMan = (ITcSysManager)project.Object;

                        if (sysMan != null)
                        {
                            _systemManager    = (ITcSysManager10)sysMan;
                            _isTwinCATProject = true;

                            break;
                        }
                    }
                    catch { }
                }
            }
        }
コード例 #6
0
        private void SolutionEvents_OnAfterOpenSolution(object sender, OpenSolutionEventArgs e)
        {
            foreach (var server in _servers)
            server.SolutionLoaded(_currentSolutionId);

              Debug.WriteLine($"tr: AfterOpenSolution(IsNewSolution='{e.IsNewSolution}', Id='{_currentSolutionId}')");
        }
コード例 #7
0
 private void AfterOpenSolution(object sender, OpenSolutionEventArgs e)
 {
     LoadSettings();
 }
コード例 #8
0
        private void AfterOpenSolution(object sender = null, OpenSolutionEventArgs e = null)
        {
            UpdateSettings();

            WatchConfigFile();
        }