/// <summary>
        /// Initializes a new instance of the <see cref="SourceControlDefinitionEditorViewModel" /> class.
        /// </summary>
        /// <param name="accessService">The TFS access service.</param>
        /// <param name="type">The resolver type.</param>
        /// <param name="xmlDependencyViewModel">The XML dependency view model.</param>
        /// <param name="validDependencyDefinitonFilenameList">The list with valid dependency definition filenames.</param>
        /// <param name="tpcUrl">The team project collection url.</param>
        internal SourceControlDefinitionEditorViewModel(ITfsAccessService accessService, IDependencyResolverType type, IXmlDependencyViewModel xmlDependencyViewModel, string validDependencyDefinitonFilenameList, string tpcUrl)
        {
            if (null == accessService)
            {
                throw new ArgumentNullException("accessService");
            }

            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (xmlDependencyViewModel == null)
            {
                throw new ArgumentNullException("xmlDependencyViewModel");
            }

            if (xmlDependencyViewModel.XmlDependency == null)
            {
                throw new ArgumentException(
                          "The argument xmlDependencyViewModel does not contain an IXmlDependency object.",
                          "xmlDependencyViewModel");
            }

            if (string.IsNullOrWhiteSpace(validDependencyDefinitonFilenameList))
            {
                throw new ArgumentNullException("validDependencyDefinitonFilenameList");
            }

            if (string.IsNullOrWhiteSpace(tpcUrl))
            {
                throw new ArgumentNullException("tpcUrl");
            }

            _tpcUrl        = tpcUrl;
            _accessService = accessService;
            _accessService.Connect(new Uri(_tpcUrl));
            _xmlDependencyViewModel = xmlDependencyViewModel;
            _xmlDependency          = xmlDependencyViewModel.XmlDependency;
            _validDependencyDefinitonFilenameList = validDependencyDefinitonFilenameList;
            _validationErrors = new Dictionary <string, string>();
            _versionSpecToDisplayStringDictionary = new Dictionary <string, string>
            {
                { "T", "Latest version" }, { "C", "Changeset" }, { "D", "Date" }, { "L", "Label" }, { "W", "Workspace Version" }
            };
            _displayStringToVersionSpecDictionary = new Dictionary <string, string>();
            foreach (var e in _versionSpecToDisplayStringDictionary)
            {
                _displayStringToVersionSpecDictionary.Add(e.Value, e.Key);
            }

            LoadAvailableVersionSpecs();
            ValidateAll();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BinaryRepositoryDefinitionEditorViewModel"/> class.
        /// </summary>
        /// <param name="accessService">The helper service used to get team foundation server specific information.</param>
        /// <param name="type">The resolver type for BinaryRepository.</param>
        /// <param name="xmlDependencyViewModel">The Xml dependency view model.</param>
        /// <param name="validDependencyDefinitonFilenameList">The list of valid dependency definition file names.</param>
        /// <param name="filter">The filter to use to filter the available components.</param>
        /// <param name="tpcUrl">The team project collection url.</param>
        internal BinaryRepositoryDefinitionEditorViewModel(ITfsAccessService accessService, BinaryRepositoryResolverType type, IXmlDependencyViewModel xmlDependencyViewModel, string validDependencyDefinitonFilenameList, IComponentFilter filter, string tpcUrl)
        {
            if (null == accessService)
            {
                throw new ArgumentNullException("accessService");
            }

            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (xmlDependencyViewModel == null)
            {
                throw new ArgumentNullException("xmlDependencyViewModel");
            }

            if (xmlDependencyViewModel.XmlDependency == null)
            {
                throw new ArgumentException(
                          "The argument xmlDependencyViewModel does not contain an IXmlDependency object.",
                          "xmlDependencyViewModel");
            }

            if (string.IsNullOrWhiteSpace(validDependencyDefinitonFilenameList))
            {
                throw new ArgumentNullException("validDependencyDefinitonFilenameList");
            }

            if (string.IsNullOrWhiteSpace(tpcUrl))
            {
                throw new ArgumentNullException("tpcUrl");
            }

            _accessService          = accessService;
            _resolverType           = type;
            _xmlDependencyViewModel = xmlDependencyViewModel;
            _xmlDependency          = xmlDependencyViewModel.XmlDependency;
            _validDependencyDefinitonFilenameList = validDependencyDefinitonFilenameList;
            _filter = filter;

            _validationErrors = new Dictionary <string, string>();

            if (string.IsNullOrEmpty(SelectedBinaryTeamProjectCollection))
            {
                SelectedBinaryTeamProjectCollection = tpcUrl;
            }

            ValidateAll();

            // TODO: Use setting to determine whether outputpath should be set automatically
            PropertyChanged += BinaryRepositoryDefinitionEditorViewModel_PropertyChanged;
        }