public RelaxBuildResults QueueBuild(RelaxBuildDefinition entity) { var build = _tfs.GetService<IBuildServer>(); var definition = build.GetBuildDefinition(entity.Uri); var queuedBuild = build.QueueBuild(definition); while (queuedBuild.Status == QueueStatus.InProgress || queuedBuild.Status == QueueStatus.Queued) { Thread.Sleep(1000); queuedBuild.Refresh(QueryOptions.All); } return new RelaxBuildResults { BuildName = queuedBuild.BuildDefinition.Name, BuildStatus = String.Format("Build {0}", queuedBuild.Build.Status.ToString()), RegistrationIds = new List<string> { entity.RegistrationId } }; }
public bool QueueBuild(string id, RelaxBuildDefinition entity) { try { var repository = new BuildServiceRepository(entity); var queueBuild = new AsyncDelegates.AsyncQueueBuild(repository.QueueBuild); var callback = new AsyncCallback(Notification); IAsyncResult result = queueBuild.BeginInvoke(entity, callback, queueBuild); } catch (Exception e) { _eventLog.WriteEntry(e.Message, EventLogEntryType.Error); } return true; }