Пример #1
0
        public void RunBuild(string id)
        {
            if (BuildList == null)
            {
                throw new ApplicationException("builds collection is not initialized");
            }

            var buildToRun = BuildList.Find(b => b.Id == id);

            if (buildToRun != null)
            {
                var queuedBuild = BuildServer.QueueBuild(buildToRun.TFSBuildDefInstance);

                if (BuildStatusChanged != null)
                {
                    //need to get fresh build info

                    var details = buildToRun.TFSBuildDefInstance.QueryBuilds();
                    if (details != null && details.Length == 0)
                    {
                        // build is still in queue
                        var newLastRun = GetBuildRunInfo(details);
                        buildToRun.LastRun = newLastRun;

                        BuildStatusChanged(this, new BuildStatusChangedEventArgs()
                        {
                            BuildDefinitions = new BuildDefinitionItem[] { buildToRun }
                        });
                    }
                }
            }
        }
Пример #2
0
        public void StopBuild(string id)
        {
            if (BuildList == null)
            {
                throw new ApplicationException("builds collection is not initialized");
            }
            var buildToStop = BuildList.Find(b => b.Id == id);

            if (buildToStop != null)
            {
                BuildServer.StopBuilds(new IBuildDetail[] { ((TFSBuildRunItem)buildToStop.LastRun).TFSBuildLastDetails });

                if (BuildStatusChanged != null)
                {
                    buildToStop.LastRun.BuildStatus = BuildStatusType.Stopped;
                    BuildStatusChanged(this, new BuildStatusChangedEventArgs()
                    {
                        BuildDefinitions = new BuildDefinitionItem[] { buildToStop }
                    });
                }
            }
        }