Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileShareDefinitionEditorViewModel"/> class.
        /// </summary>
        /// <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>
        internal FileShareDefinitionEditorViewModel(FileShareResolverType type, IXmlDependencyViewModel xmlDependencyViewModel, string validDependencyDefinitonFilenameList)
        {
            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");
            }

            _resolverType           = type;
            _xmlDependencyViewModel = xmlDependencyViewModel;
            _xmlDependency          = xmlDependencyViewModel.XmlDependency;
            _validDependencyDefinitonFilenameList = validDependencyDefinitonFilenameList;

            _validationErrors = new Dictionary <string, string>();
            ValidateAll();
        }
        /// <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();
        }
Ejemplo n.º 3
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;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildResultDefinitionEditorViewModel"/> class.
        /// </summary>
        /// <param name="buildService">The helper service used to get team foundation server specific information.</param>
        /// <param name="type">The resolver type for BuildResult.</param>
        /// <param name="xmlDependencyViewModel">The Xml dependency view model.</param>
        /// <param name="validDependencyDefinitonFilenameList">The list of valid dependency definition file names.</param>
        internal BuildResultDefinitionEditorViewModel(TfsBuildHelper buildService, BuildResultResolverType type, IXmlDependencyViewModel xmlDependencyViewModel, string validDependencyDefinitonFilenameList)
        {
            if (null == buildService)
            {
                throw new ArgumentNullException("buildService");
            }

            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");
            }

            _buildService           = buildService;
            _xmlDependencyViewModel = xmlDependencyViewModel;
            _xmlDependency          = xmlDependencyViewModel.XmlDependency;

            _validationErrors    = new Dictionary <string, string>();
            _importedBuildStatus = _buildService.GetBuildStatus();

            if (!string.IsNullOrEmpty(SelectedBuildNumber))
            {
                _filterByStatusAndQuality = false;
            }
            else
            {
                _filterByStatusAndQuality = true;
            }

            OnPropertyChanged("IsCheckedFilterByBuildNumber");
            OnPropertyChanged("IsCheckedFilterByStatusAndQuality");

            ValidateAll();
        }
        /// <summary>
        /// Constructor checks argument and saves xml dependency.
        /// </summary>
        /// <param name="xmlDependency"></param>
        public XmlDependencyViewModel(IXmlDependency xmlDependency, bool isNew)
        {
            if (xmlDependency == null)
            {
                throw new ArgumentNullException("xmlDependency");
            }

            _xmlDependency = xmlDependency;
            _isNew         = isNew;
            _isValid       = true;

            // create an initial reference point
            ((IEditableObject)this).BeginEdit();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SourceControlDefinitionEditorViewModel" /> class.
        /// </summary>
        /// <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="svnUrl">The team project collection url.</param>
        internal SubversionDefinitionEditorViewModel(IDependencyResolverType type, IXmlDependencyViewModel xmlDependencyViewModel, string validDependencyDefinitonFilenameList, string svnUrl)
        {
            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(svnUrl))
            {
                throw new ArgumentNullException("svnUrl");
            }

            _svnUrl = svnUrl;
            _xmlDependencyViewModel = xmlDependencyViewModel;
            _xmlDependency          = xmlDependencyViewModel.XmlDependency;
            _validDependencyDefinitonFilenameList = validDependencyDefinitonFilenameList;
            _validationErrors = new Dictionary <string, string>();
            _versionSpecToDisplayStringDictionary = new Dictionary <string, string>
            {
                { "H", "Head revision" }, { "R", "Revision" }
            };
            _displayStringToVersionSpecDictionary = new Dictionary <string, string>();
            foreach (var e in _versionSpecToDisplayStringDictionary)
            {
                _displayStringToVersionSpecDictionary.Add(e.Value, e.Key);
            }

            LoadAvailableVersionSpecs();
            ValidateAll();
        }
Ejemplo n.º 7
0
        private void CreateXmlDependencyViewModel_XmlDependencyCreationRequest(object sender, XmlDependencyCreationEventArgs xmlDependencyCreationEventArgs)
        {
            if (xmlDependencyCreationEventArgs == null || xmlDependencyCreationEventArgs.ResolverType == null)
            {
                return;
            }

            var            resolverType     = xmlDependencyCreationEventArgs.ResolverType;
            IXmlDependency newXmlDependency = DependencyService.CreateEmptyIXmlDependency(resolverType);

            // create the view model and add it to our list as well as the component
            var newXmlDependencyViewModel = new XmlDependencyViewModel(newXmlDependency, true);

            XmlDependencies.Insert(XmlDependencies.Count - 1, newXmlDependencyViewModel);
            _xmlComponentViewModel.AddDependency(newXmlDependencyViewModel);

            // pre-select the new dependency
            SelectedXmlDependency = newXmlDependencyViewModel;
        }
Ejemplo n.º 8
0
 // TODO: workaround for the bad list behavior above
 public void RemoveDependency(IXmlDependency dependency)
 {
     EnsureDependencyList();
     _DependencyList.Remove((XmlDependency)dependency);
 }
Ejemplo n.º 9
0
 // TODO: workaround for the bad list behavior above
 public void AddDependency(IXmlDependency dependency)
 {
     EnsureDependencyList();
     _DependencyList.Add((XmlDependency)dependency);
 }