예제 #1
0
        /// Called by combo control to query the text to display or to apply newly-entered text
        void StartupProjectComboHandler(object Sender, EventArgs Args)
        {
            var OleArgs = (OleMenuCmdEventArgs)Args;

            // If OutValue is non-zero, then Visual Studio is querying the current combo value to display
            if (OleArgs.OutValue != IntPtr.Zero)
            {
                string ValueString = MakeStartupProjectComboText();
                Marshal.GetNativeVariantForObject(ValueString, OleArgs.OutValue);
            }

            // Has a new input value been entered?
            else if (OleArgs.InValue != null)
            {
                var InputString = OleArgs.InValue.ToString();

                // Lookup the ProjectReference in CachedStartupProjects to get the full name
                ProjectReference ProjectRefMatch = _CachedStartupProjects.FirstOrDefault(ProjRef => ProjRef.Name == InputString);

                if (ProjectRefMatch != null && ProjectRefMatch.Project != null)
                {
                    // Switch to this project using the standard SDK method set_StartupProject
                    var ProjectHierarchy = Utils.ProjectToHierarchyObject(ProjectRefMatch.Project);
                    UnrealVSPackage.Instance.SolutionBuildManager.set_StartupProject(ProjectHierarchy);

                    // Select in solution exp and set as startup project
                    // This forces the .suo to save the project change
                    if (Utils.SelectProjectInSolutionExplorer(ProjectRefMatch.Project))
                    {
                        UnrealVSPackage.Instance.DTE.ExecuteCommand("Project.SetasStartUpProject");
                    }
                }
            }
        }
        /// Called by combo control to query the text to display or to apply newly-entered text
        void StartupProjectComboHandler(object Sender, EventArgs Args)
        {
            var OleArgs = (OleMenuCmdEventArgs)Args;

            // If OutValue is non-zero, then Visual Studio is querying the current combo value to display
            if (OleArgs.OutValue != IntPtr.Zero)
            {
                string ValueString = MakeStartupProjectComboText();
                Marshal.GetNativeVariantForObject(ValueString, OleArgs.OutValue);
            }

            // Has a new input value been entered?
            else if (OleArgs.InValue != null)
            {
                var InputString = OleArgs.InValue.ToString();

                // Lookup the ProjectReference in CachedStartupProjects to get the full name
                ProjectReference ProjectRefMatch = _CachedStartupProjects.FirstOrDefault(ProjRef => ProjRef.Name == InputString);

                if (ProjectRefMatch != null && ProjectRefMatch.Project != null)
                {
                    // Switch to this project!
                    var ProjectHierarchy = Utils.ProjectToHierarchyObject(ProjectRefMatch.Project);
                    UnrealVSPackage.Instance.SolutionBuildManager.set_StartupProject(ProjectHierarchy);
                }
            }
        }
        private void OnDblClickBuildListItem(object sender, MouseButtonEventArgs e)
        {
            var Elem = sender as FrameworkElement;

            if (Elem == null)
            {
                return;
            }

            BuildJob Job = Elem.DataContext as BuildJob;

            if (Job == null)
            {
                return;
            }

            // Switch the Startup Project and the build config and platform to match this Job
            if (Job.Project != null)
            {
                IsBusy = true;

                var Project = Job.Project.GetProjectSlow();

                if (Project != null)
                {
                    // Switch to this project
                    var ProjectHierarchy = Utils.ProjectToHierarchyObject(Project);
                    UnrealVSPackage.Instance.SolutionBuildManager.set_StartupProject(ProjectHierarchy);

                    // Switch the build config
                    Utils.SetActiveSolutionConfiguration(Job.Config, Job.Platform);
                }

                IsBusy = false;
            }
        }
예제 #4
0
        public static void ExecuteProjectBuild(Project Project,
                                               string SolutionConfig,
                                               string SolutionPlatform,
                                               BatchBuilderToolControl.BuildJob.BuildJobType BuildType,
                                               Action ExecutingDelegate,
                                               Action FailedToStartDelegate)
        {
            IVsHierarchy ProjHierarchy = Utils.ProjectToHierarchyObject(Project);

            if (ProjHierarchy != null)
            {
                SolutionConfigurations SolutionConfigs =
                    UnrealVSPackage.Instance.DTE.Solution.SolutionBuild.SolutionConfigurations;

                var MatchedSolutionConfig =
                    (from SolutionConfiguration2 Sc in SolutionConfigs select Sc).FirstOrDefault(
                        Sc =>
                        String.CompareOrdinal(Sc.Name, SolutionConfig) == 0 && String.CompareOrdinal(Sc.PlatformName, SolutionPlatform) == 0);

                if (MatchedSolutionConfig != null)
                {
                    SolutionContext ProjectSolutionCtxt = MatchedSolutionConfig.SolutionContexts.Item(Project.UniqueName);

                    if (ProjectSolutionCtxt != null)
                    {
                        IVsCfgProvider2 CfgProvider2 = Utils.HierarchyObjectToCfgProvider(ProjHierarchy);
                        if (CfgProvider2 != null)
                        {
                            IVsCfg Cfg;
                            CfgProvider2.GetCfgOfName(ProjectSolutionCtxt.ConfigurationName, ProjectSolutionCtxt.PlatformName, out Cfg);

                            if (Cfg != null)
                            {
                                if (ExecutingDelegate != null)
                                {
                                    ExecutingDelegate();
                                }

                                int JobResult = VSConstants.E_FAIL;

                                if (BuildType == BatchBuilderToolControl.BuildJob.BuildJobType.Build)
                                {
                                    JobResult =
                                        UnrealVSPackage.Instance.SolutionBuildManager.StartUpdateSpecificProjectConfigurations(
                                            1,
                                            new[] { ProjHierarchy },
                                            new[] { Cfg },
                                            null,
                                            new uint[] { 0 },
                                            null,
                                            (uint)VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_BUILD,
                                            0);
                                }
                                else if (BuildType == BatchBuilderToolControl.BuildJob.BuildJobType.Rebuild)
                                {
                                    JobResult =
                                        UnrealVSPackage.Instance.SolutionBuildManager.StartUpdateSpecificProjectConfigurations(
                                            1,
                                            new[] { ProjHierarchy },
                                            new[] { Cfg },
                                            new uint[] { 0 },
                                            null,
                                            null,
                                            (uint)(VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_BUILD | VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_FORCE_UPDATE),
                                            0);
                                }
                                else if (BuildType == BatchBuilderToolControl.BuildJob.BuildJobType.Clean)
                                {
                                    JobResult =
                                        UnrealVSPackage.Instance.SolutionBuildManager.StartUpdateSpecificProjectConfigurations(
                                            1,
                                            new[] { ProjHierarchy },
                                            new[] { Cfg },
                                            new uint[] { 0 },
                                            null,
                                            null,
                                            (uint)VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_CLEAN,
                                            0);
                                }

                                if (JobResult == VSConstants.S_OK)
                                {
                                    // Job running - show output
                                    PrepareOutputPane();
                                }
                                else
                                {
                                    if (FailedToStartDelegate != null)
                                    {
                                        FailedToStartDelegate();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }