示例#1
0
        private void addinsButton_Click(object sender, RoutedEventArgs e)
        {
            SerializableSource serializableSource = (sender as FrameworkElement).DataContext as SerializableSource;

            if (serializableSource != null)
            {
                MigrationSource migrationSource = serializableSource.Model;

                AddinsDialogViewModel addinsDialogVM = new AddinsDialogViewModel(migrationSource);
                AddinsDialog          dialog         = new AddinsDialog(addinsDialogVM);
                dialog.Owner = Application.Current.MainWindow;
                dialog.ShowDialog();
            }
        }
示例#2
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            SerializableSource serializableSource = (sender as FrameworkElement).DataContext as SerializableSource;
            ProviderHandler    providerView       = (e.OriginalSource as FrameworkElement).DataContext as ProviderHandler;

            if (serializableSource != null && providerView != null)
            {
                if (m_configuration.Providers.Count(x => providerView.ProviderId.Equals(new Guid(x.ReferenceName))) == 0)
                {
                    ProviderElement provider = new ProviderElement();
                    provider.FriendlyName  = providerView.ProviderName;
                    provider.ReferenceName = providerView.ProviderId.ToString();
                    m_configuration.Providers.Add(provider);
                }

                MigrationSource migrationSource  = serializableSource.Model;
                string          cachedProviderId = migrationSource.ProviderReferenceName;

                IMigrationSourceView serverView = m_configuration.ExtensibilityViewModel.GetMigrationSourceView(providerView.ProviderDescriptionAttribute.ShellAdapterIdentifier);
                serverView.Command(migrationSource);

                if (migrationSource.ProviderReferenceName == null) // user cancelled
                {
                    migrationSource.ProviderReferenceName = cachedProviderId;
                }
                else
                {
                    migrationSource.ProviderReferenceName = providerView.ProviderId.ToString();
                }

                serializableSource.Refresh();

                var session = m_configuration.SerializableSessions.FirstOrDefault(x => x.LeftMigrationSource.Model == migrationSource || x.RightMigrationSource.Model == migrationSource);
                if (session != null)
                {
                    foreach (FilterPair filterPair in session.Model.Filters.FilterPair)
                    {
                        foreach (FilterItem filterItem in filterPair.FilterItem)
                        {
                            if (string.Equals(filterItem.MigrationSourceUniqueId, migrationSource.InternalUniqueId, StringComparison.OrdinalIgnoreCase))
                            {
                                filterItem.FilterString = filterItem.FilterString.Replace("<SourceIdentifier>", migrationSource.SourceIdentifier);
                            }
                        }
                    }
                }
                UpdateActiveProviders();
            }
        }
示例#3
0
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            SerializableSource            serializableSource = values[0] as SerializableSource;
            IEnumerable <ProviderHandler> allProviders       = values[1] as IEnumerable <ProviderHandler>;

            if (allProviders == null)
            {
                return(null);
            }
            List <ProviderHandler> filteredProviders = allProviders.Where(x => x.ProviderCapabilityAttribute.SessionType == serializableSource.Session.SessionType).ToList();

            if (filteredProviders.Count(x => string.Equals(x.ProviderCapabilityAttribute.EndpointSystemName, serializableSource.Model.EndpointSystemName)) == 0)
            {
                return(filteredProviders);
            }
            else
            {
                return(filteredProviders.Where(x => string.Equals(x.ProviderCapabilityAttribute.EndpointSystemName, serializableSource.Model.EndpointSystemName)));
            }
        }