public void AddFilterPair(SerializableSession serializableSession) { Session session = serializableSession.Model; FilterItem leftItem = new FilterItem(); leftItem.MigrationSourceUniqueId = session.LeftMigrationSourceUniqueId; FilterItem rightItem = new FilterItem(); rightItem.MigrationSourceUniqueId = session.RightMigrationSourceUniqueId; string leftSourceIdentifier = MigrationSources.First(x => string.Equals(x.InternalUniqueId, session.LeftMigrationSourceUniqueId, StringComparison.OrdinalIgnoreCase)).SourceIdentifier; string rightSourceIdentifier = MigrationSources.First(x => string.Equals(x.InternalUniqueId, session.RightMigrationSourceUniqueId, StringComparison.OrdinalIgnoreCase)).SourceIdentifier; switch (session.SessionType) { case SessionTypeEnum.VersionControl: FilterPairViewModel existingFilterPair = serializableSession.DefaultFilterPair; if (existingFilterPair != null) { leftItem.FilterString = existingFilterPair.LeftFilterStringExtension.VCFilterStringPrefix + leftSourceIdentifier; rightItem.FilterString = existingFilterPair.RightFilterStringExtension.VCFilterStringPrefix + rightSourceIdentifier; } else { leftItem.FilterString = string.Empty; rightItem.FilterString = string.Empty; } break; case SessionTypeEnum.WorkItemTracking: leftItem.FilterString = string.Empty; rightItem.FilterString = string.Empty; break; } FilterPair newFilterPair = new FilterPair(); newFilterPair.FilterItem.Add(leftItem); newFilterPair.FilterItem.Add(rightItem); session.Filters.FilterPair.Add(newFilterPair); RefreshFilterStrings(); }
private void addFilterButton_Click(object sender, RoutedEventArgs e) { SerializableSession session = (sender as Button).DataContext as SerializableSession; m_configuration.AddFilterPair(session); }