Esempio n. 1
0
        private void ApplyBuildDefinitions(IEnumerable <IBuildDefinition> buildDefinitions)
        {
            BuildDefinitions.AddRange(buildDefinitions.Select(buildDefinition =>
            {
                var vm = new BuildDefinitionViewModel(buildDefinition);

                var definition = MonitorSettings.SelectedBuildDefinitions.SingleOrDefault(a => a.Id == vm.BuildDefinition.Id);
                if (definition != null && this.buildDefinitionEqualityComparer.Equals(definition, vm.BuildDefinition))
                {
                    vm.IsSelected = true;
                }

                return(vm);
            }));

            var obsoleteDefinitions = MonitorSettings.SelectedBuildDefinitions.Where(a => BuildDefinitions.All(x => x.BuildDefinition.Id != a.Id)).ToList();

            foreach (var obsoleteDefinition in obsoleteDefinitions)
            {
                var vm = new BuildDefinitionViewModel(obsoleteDefinition)
                {
                    IsDeleted  = true,
                    IsSelected = true
                };
                BuildDefinitions.Add(vm);
            }
        }