Exemple #1
0
 /// <summary>
 /// Load the builds for the project.
 /// </summary>
 /// <param name="value"></param>
 protected virtual void LoadBuilds(ProjectStatus value)
 {
     lock (lockObject)
     {
         buildsLoaded = true;
         if (builds.Count == 0)
         {
             // This is the first load - so load all of the builds
             string[] buildNames = { };
             try
             {
                 client.ProcessSingleAction(p =>
                 {
                     buildNames = client.GetBuildNames(p.Name);
                 }, InnerProject);
             }
             catch
             {
                 // Ignore any errors - just means that no builds will be loaded
             }
             foreach (var buildName in buildNames ?? new string[0])
             {
                 builds.Add(buildName, new ProjectBuild(buildName, this, client));
             }
         }
         else
         {
             if (project.LastBuildDate != value.LastBuildDate)
             {
                 // Last build date has changed, therefore there will be one or more builds to load
                 string[] buildNames = { };
                 try
                 {
                     client.ProcessSingleAction(p =>
                     {
                         // Cannot pass in a date, only a number, so guessing there will be no more then
                         // 10 builds since the last build
                         buildNames = client.GetMostRecentBuildNames(p.Name, 10);
                     }, InnerProject);
                 }
                 catch
                 {
                     // Ignore any errors - just means that no builds will be loaded
                 }
                 foreach (var buildName in buildNames)
                 {
                     if (!builds.ContainsKey(buildName))
                     {
                         builds.Add(buildName, new ProjectBuild(buildName, this, client));
                     }
                 }
             }
         }
     }
 }