private void GetStreams() { List <DatabaseStream> streams = DatabaseHandler.Streams; List <DatabaseStream> streamsValid = new List <DatabaseStream>(); List <DatabaseScheme> schemes = DatabaseHandler.Schemes; foreach (DatabaseStream stream in streams) { foreach (DatabaseScheme scheme in schemes) { bool template = mode == Mode.TRAIN || mode == Mode.COMPLETE; if (getTrainer(stream, scheme, template).Count > 0) { streamsValid.Add(stream); break; } } } StreamsBox.ItemsSource = streamsValid; if (StreamsBox.Items.Count > 0) { DatabaseStream stream = ((List <DatabaseStream>)StreamsBox.ItemsSource).Find(s => s.Name == Properties.Settings.Default.CMLDefaultStream); if (stream != null) { StreamsBox.SelectedItem = stream; } if (StreamsBox.SelectedItem == null) { StreamsBox.SelectedIndex = 0; } StreamsBox.ScrollIntoView(StreamsBox.SelectedItem); } }
private void GetStreams(DatabaseStream selected = null) { List <DatabaseStream> streams = DatabaseHandler.Streams; List <DatabaseStream> streamsValid = new List <DatabaseStream>(); foreach (DatabaseStream stream in streams) { if (mode == Mode.MERGE) { if (stream.Type == Defaults.CML.StreamTypeNameFeature) { streamsValid.Add(stream); } } else { if (getChains(stream).Count > 0) { streamsValid.Add(stream); } } } List <DatabaseStream> selectedStreams = null; if (mode == Mode.MERGE) { selectedStreams = new List <DatabaseStream>(); foreach (DatabaseStream s in StreamsBox.SelectedItems) { selectedStreams.Add(s); } } if (StreamsBox.HasItems) { StreamsBox.ItemsSource = null; } StreamsBox.ItemsSource = streamsValid; if (mode == Mode.MERGE && selectedStreams != null) { foreach (DatabaseStream s in selectedStreams) { StreamsBox.SelectedItems.Add(s); } } if (mode == Mode.EXTRACT && StreamsBox.Items.Count > 0) { DatabaseStream stream = ((List <DatabaseStream>)StreamsBox.ItemsSource).Find(s => s.Name == Properties.Settings.Default.CMLDefaultStream); if (stream != null) { StreamsBox.SelectedItem = stream; } if (StreamsBox.SelectedItem == null) { StreamsBox.SelectedIndex = 0; } if (selected != null) { StreamsBox.SelectedItem = selected; } StreamsBox.ScrollIntoView(StreamsBox.SelectedItem); } }