Inside the event handler you need to intercept the state of last build using the LastBuildInfo variable. Refer : http://msdn.microsoft.com/en-US/library/envdte.solutionbuild.lastbuildinfo(v=vs.100).aspx
var solution = _applicationObject.Solution;
var lastBuildState = solution.SolutionBuild.LastBuildInfo;
if(lastBuildState == 0)
//Build succeeded