private void ProcessMicrosoftProject(MicrosoftProjectDto microsoftProjectDto) { if (microsoftProjectDto == null) { throw new ArgumentNullException(nameof(microsoftProjectDto)); } lock (m_Lock) { ResetProject(); // Project Start Date. ProjectStartWithoutPublishing = microsoftProjectDto.ProjectStart; // Resources. foreach (ResourceDto resourceDto in microsoftProjectDto.Resources) { ResourceSettingsDto.Resources.Add(resourceDto); } //SetTargetResources(); // Activities. foreach (DependentActivityDto dependentActivityDto in microsoftProjectDto.DependentActivities) { m_CoreViewModel.AddManagedActivity(DtoConverter.FromDto(dependentActivityDto)); } } }
private void ProcessProjectPlanDto(ProjectPlanDto projectPlanDto) { if (projectPlanDto == null) { throw new ArgumentNullException(nameof(projectPlanDto)); } lock (m_Lock) { ResetProject(); // Project Start Date. ProjectStartWithoutPublishing = projectPlanDto.ProjectStart; // Resources. ResourceSettingsDto = projectPlanDto.ResourceSettings; // Compilation. GraphCompilation = DtoConverter.FromDto(projectPlanDto.GraphCompilation); CyclomaticComplexity = projectPlanDto.GraphCompilation.CyclomaticComplexity; Duration = projectPlanDto.GraphCompilation.Duration; // Activities. // Be sure to do this after the resources and project start date have been added. foreach (DependentActivityDto dependentActivityDto in projectPlanDto.DependentActivities) { m_CoreViewModel.AddManagedActivity(DtoConverter.FromDto(dependentActivityDto)); } m_CoreViewModel.UpdateActivitiesAllocatedToResources(); m_CoreViewModel.SetCompilationOutput(); m_CoreViewModel.CalculateCosts(); // Arrow Graph. ArrowGraphSettingsDto = projectPlanDto.ArrowGraphSettings; ArrowGraphDto = projectPlanDto.ArrowGraph; HasStaleOutputs = projectPlanDto.HasStaleOutputs; } PublishGraphCompilationUpdatedPayload(); PublishArrowGraphDtoUpdatedPayload(); //PublishGanttChartDtoUpdatedPayload(); }
public void RunCompile() { lock (m_Lock) { UpdateActivitiesTargetResourceDependencies(); var availableResources = new List <IResource <int> >(); if (!ResourceSettingsDto.AreDisabled) { availableResources.AddRange(ResourceSettingsDto.Resources.Select(x => DtoConverter.FromDto(x))); } GraphCompilation = m_VertexGraphCompiler.Compile(availableResources); CyclomaticComplexity = m_VertexGraphCompiler.CyclomaticComplexity; Duration = m_VertexGraphCompiler.Duration; CalculateCosts(); IsProjectUpdated = true; SetCompilationOutput(); HasStaleOutputs = false; } PublishGraphCompiledPayload(); PublishGraphCompilationUpdatedPayload(); }
public void RunCompile() { lock (m_Lock) { UpdateActivitiesTargetResourceDependencies(); var availableResources = new List <IResource <int> >(); if (!ResourceSettingsDto.AreDisabled) { availableResources.AddRange(ResourceSettingsDto.Resources.Select(x => DtoConverter.FromDto(x))); } GraphCompilation = m_VertexGraphCompiler.Compile(availableResources); Duration = m_VertexGraphCompiler.Duration; UpdateActivitiesAllocatedToResources(); CalculateCosts(); IsProjectUpdated = true; SetCompilationOutput(); // Cyclomatic complexity is calculated against the vertex graph without resource dependencies. CyclomaticComplexity = null; if (!HasCompilationErrors) { IList <IDependentActivity <int> > dependentActivities = GraphCompilation.DependentActivities .Select(x => (IDependentActivity <int>)x.WorkingCopy()) .ToList(); if (dependentActivities.Any()) { var vertexGraphCompiler = VertexGraphCompiler <int, IDependentActivity <int> > .Create(); foreach (DependentActivity <int> dependentActivity in dependentActivities) { dependentActivity.ResourceDependencies.Clear(); vertexGraphCompiler.AddActivity(dependentActivity); } vertexGraphCompiler.TransitiveReduction(); CyclomaticComplexity = vertexGraphCompiler.CyclomaticComplexity; } } HasStaleOutputs = false; } PublishGraphCompiledPayload(); PublishGraphCompilationUpdatedPayload(); }