コード例 #1
0
        public void LoadConflictTypes()
        {
            ExtensibilityViewModel = new ExtensibilityViewModel();

            // load corresponding shell adapters and decorate extensibility view model, e.g. connect dialogs, conflict types (assert if user controls not paired)
            foreach (MigrationSource migrationSource in DataModel.Configuration.SessionGroup.MigrationSources.MigrationSource)
            {
                Guid sourceId   = new Guid(migrationSource.InternalUniqueId);
                Guid providerId = new Guid(migrationSource.ProviderReferenceName);

                Guid            shellAdapterIdentifier;
                ProviderHandler providerHandler = ConfigViewModel.AllProviders.FirstOrDefault(x => x.ProviderId.Equals(providerId));
                if (providerHandler != null)
                {
                    shellAdapterIdentifier = providerHandler.ProviderDescriptionAttribute.ShellAdapterIdentifier;
                }
                else
                {
                    shellAdapterIdentifier = providerId;
                }

                IEnumerable <IConflictTypeView> shellAdapterConflictTypes = PluginManager.GetConflictTypes(shellAdapterIdentifier) ?? new List <IConflictTypeView>();
                IEnumerable <ConflictType>      providerConflictTypes     = ConflictManager.Sync.GetConflictTypes(sourceId);
                IEnumerable <ConflictType>      sessionGroupConflictTypes = ConflictManager.Sync.GetConflictTypes(sourceId);

                foreach (ConflictType conflictType in providerConflictTypes)
                {
                    IConflictTypeView conflictTypeView = shellAdapterConflictTypes.FirstOrDefault(x => x.Guid.Equals(conflictType.ReferenceName));
                    if (conflictTypeView != null)
                    {
                        ExtensibilityViewModel.AddConflictTypeView(conflictTypeView, sourceId);
                    }
                    else
                    {
                        Debug.Fail(string.Format("UserControl not found for conflict type: {0}", conflictType.FriendlyName));
                    }
                }

                foreach (ConflictType conflictType in sessionGroupConflictTypes)
                {
                    IConflictTypeView conflictTypeView = shellAdapterConflictTypes.FirstOrDefault(x => x.Guid.Equals(conflictType.ReferenceName));
                    if (conflictTypeView != null)
                    {
                        ExtensibilityViewModel.AddConflictTypeView(conflictTypeView, Microsoft.TeamFoundation.Migration.Toolkit.Constants.FrameworkSourceId);
                    }
                    else
                    {
                        Debug.Fail(string.Format("UserControl not found for conflict type: {0}", conflictType.FriendlyName));
                    }
                }
            }
        }
コード例 #2
0
        public string GetConflictTypeDescription(RuleViewModelBase conflict, Guid sourceId)
        {
            IConflictTypeView conflictType = GetConflictTypeView(conflict, sourceId);

            if (conflictType == null || string.IsNullOrEmpty(conflictType.Description))
            {
                return("This conflict type has no description.");
            }
            else
            {
                return(conflictType.Description);
            }
        }
コード例 #3
0
        public string GetConflictTypeFriendlyName(RuleViewModelBase conflict, Guid sourceId)
        {
            IConflictTypeView conflictType = GetConflictTypeView(conflict, sourceId);

            if (conflictType == null || string.IsNullOrEmpty(conflictType.FriendlyName))
            {
                return(conflict.ConflictType.FriendlyName);
            }
            else
            {
                return(conflictType.FriendlyName);
            }
        }
コード例 #4
0
        public IConflictTypeUserControl GetConflictTypeUserControl(ConflictRuleViewModel conflict, Guid sourceId)
        {
            IConflictTypeView conflictType = GetConflictTypeView(conflict, sourceId);

            Type type;

            if (conflictType == null || conflictType.Type == null || conflictType.Type.GetInterface(typeof(IConflictTypeUserControl).Name) == null)
            {
                type = typeof(RuleEditView);
            }
            else
            {
                type = conflictType.Type;
            }

            IConflictTypeUserControl customControl = Activator.CreateInstance(type) as IConflictTypeUserControl;

            customControl.SetConflictRuleViewModel(conflict);
            return(customControl);
        }