Example #1
0
        /// <summary>
        /// Synchronises the projects.
        /// </summary>
        /// <param name="result">The server summary with the projects.</param>
        private void SynchroniseProjects(ServerSummary result)
        {
            var current = this.projects.ToDictionary(p => p.Name);

            foreach (var project in result.Projects)
            {
                ProjectSummary currentProject;
                if (current.TryGetValue(project.Name, out currentProject))
                {
                    current.Remove(project.Name);
                    currentProject.Status      = project.Status;
                    currentProject.Activity    = project.Activity;
                    currentProject.BuildStatus = project.BuildStatus;
                    currentProject.Labels      = project.Labels;
                    currentProject.Times       = project.Times;
                    currentProject.Messages.Clear();
                    foreach (var message in project.Messages)
                    {
                        currentProject.Messages.Add(message);
                    }
                }
                else
                {
                    this.projects.Add(project);
                }
            }

            foreach (var project in current.Values)
            {
                this.projects.Remove(project);
            }
        }
        /// <summary>
        /// Synchronises the projects.
        /// </summary>
        /// <param name="result">The server summary with the projects.</param>
        private void SynchroniseProjects(ServerSummary result)
        {
            var current = this.projects.ToDictionary(p => p.Name);
            foreach (var project in result.Projects)
            {
                ProjectSummary currentProject;
                if (current.TryGetValue(project.Name, out currentProject))
                {
                    current.Remove(project.Name);
                    currentProject.Status = project.Status;
                    currentProject.Activity = project.Activity;
                    currentProject.BuildStatus = project.BuildStatus;
                    currentProject.Labels = project.Labels;
                    currentProject.Times = project.Times;
                    currentProject.Messages.Clear();
                    foreach (var message in project.Messages)
                    {
                        currentProject.Messages.Add(message);
                    }
                }
                else
                {
                    this.projects.Add(project);
                }
            }

            foreach (var project in current.Values)
            {
                this.projects.Remove(project);
            }
        }