/// <summary>
        /// Initialize a new instance of the <see cref="ProjectReferencesViewModel"/> class.
        /// </summary>
        /// <param name="projectInspectResult">The project's unused references.</param>
        public ProjectReferencesViewModel(IProjectInspectResult projectInspectResult)
        {
            if (projectInspectResult == null)
            {
                throw Error.ArgumentNull("projectInspectResult");
            }

            _projectInspectResult = projectInspectResult;
            this.Project          = new ProjectData(projectInspectResult);
        }
Exemple #2
0
        /// <summary>
        /// Add result of inspection of a project.
        /// </summary>
        /// <param name="result"></param>
        public void AddResult(IProjectInspectResult result)
        {
            if (result == null)
            {
                throw Error.ArgumentNull("result");
            }

            if (_inspectResults.Any(p => p.Project.Equals(result.Project)))
            {
                throw Error.InvalidOperation(Resources.InspectResult_ResultAlreadyAdded, result.Project.Name);
            }

            _inspectResults.Add(result);
        }
        /// <summary>
        /// Initialize a new instance of the <see cref="ProjectData"/> class.
        /// </summary>
        /// <param name="projectInspectResult">The information about project.</param>
        public ProjectData(IProjectInspectResult projectInspectResult)
        {
            if (projectInspectResult == null)
            {
                throw Error.ArgumentNull("projectInspectResult");
            }

            _projectInspectResult = projectInspectResult;
            this.ErrorMessage     = (!projectInspectResult.IsSuccess) ? projectInspectResult.Exception.Message : null;
            this.References       = new ReadOnlyObservableCollection <ReferenceData>
                                    (
                new ObservableCollection <ReferenceData>(projectInspectResult.UnusedReferences.Select(item => new ReferenceData(item)))
                                    );
        }