示例#1
0
        /// <summary>
        /// The invoke handler passed to this object's QuickBuildMenuCommand, called by the base OleMenuCommand when an item is clicked
        /// </summary>
        private void OnInvokedDynamicItem(object sender, EventArgs args)
        {
            var MenuCommand = (QuickBuildMenuCommand)sender;

            // Get the project clicked in the solution explorer by accessing the current selection and converting to a Project if possible.
            IntPtr             HierarchyPtr, SelectionContainerPtr;
            uint               ProjectItemId;
            IVsMultiItemSelect MultiItemSelect;

            UnrealVSPackage.Instance.SelectionManager.GetCurrentSelection(out HierarchyPtr, out ProjectItemId, out MultiItemSelect, out SelectionContainerPtr);
            if (HierarchyPtr == null)
            {
                return;
            }

            IVsHierarchy SelectedHierarchy = Marshal.GetTypedObjectForIUnknown(HierarchyPtr, typeof(IVsHierarchy)) as IVsHierarchy;

            if (SelectedHierarchy == null)
            {
                return;
            }

            var SelectedProject = Utils.HierarchyObjectToProject(SelectedHierarchy);

            if (SelectedProject == null)
            {
                return;
            }

            // Builds the selected project with the clicked platform and config
            Utils.ExecuteProjectBuild(SelectedProject, MenuCommand.Text, PlaformName, BatchBuilderToolControl.BuildJob.BuildJobType.Build, null, null);
        }
        private void TickBuildQueue()
        {
            if (_ActiveBuildJob != null || _BuildQueue.Count == 0)
            {
                return;
            }

            while (_ActiveBuildJob == null && _BuildQueue.Count > 0)
            {
                BuildJob Job = _BuildQueue.Dequeue();

                Project Project = Job.Project.GetProjectSlow();

                if (Project != null)
                {
                    Utils.ExecuteProjectBuild(
                        Project,
                        Job.Config,
                        Job.Platform,
                        Job.JobType,
                        delegate
                    {
                        // Job starting
                        _ActiveBuildJob           = Job;
                        _ActiveBuildJob.JobStatus = BuildJob.BuildJobStatus.Executing;
                        _BuildJobStartTime        = DateTime.Now;
                    },
                        delegate
                    {
                        // Job failed to start - clear active job
                        _ActiveBuildJob.JobStatus  = BuildJob.BuildJobStatus.FailedToStart;
                        _ActiveBuildJob.OutputText = GetBuildJobOutputText(_ActiveBuildJob, _BuildJobStartTime);
                        _ActiveBuildJob            = null;
                    });
                }
            }
        }