public SerializableSession(Session session, NotifyingCollection <Session> sessions, NotifyingCollection <SerializableSource> sources, ConfigurationViewModel configuration) : base(session) { m_sessions = sessions; m_sources = sources; m_configuration = configuration; if (Model.Filters.FilterPair.Count == 0) { m_configuration.AddFilterPair(this); } foreach (var v in Model.Filters.FilterPair) { m_filterPairViewModels.Add(new FilterPairViewModel(v, Model, m_configuration)); } DefaultFilterPair = m_filterPairViewModels.FirstOrDefault(); Model.Filters.FilterPair.ItemAdded += new ItemAddedEventHandler <FilterPair>(FilterPair_ItemAdded); Model.Filters.FilterPair.ItemRemoved += new ItemRemovedEventHandler <FilterPair>(FilterPair_ItemRemoved); Model.Filters.FilterPair.ItemReplaced += new ItemReplacedEventHandler <FilterPair>(FilterPair_ItemReplaced); }
private void addFilterButton_Click(object sender, RoutedEventArgs e) { SerializableSession session = (sender as Button).DataContext as SerializableSession; m_configuration.AddFilterPair(session); }