private void ResetConnectionDependencies() { _rootTaxonomy = null; _seqTypes = null; _locationTypes = null; _matchingSequenceCount = -1; OnPropertyChanged("IsValid", "ConnectionString", "MatchingSequenceCount", "TaxonomyRoot", "SequenceTypes", "CellLocationTypes"); }
/// <summary> /// This is used to detect changes in the taxonomy selection. /// We could /// </summary> /// <param name="parameter"></param> private void OnTaxonomySelected(object parameter) { EventParameters ep = (EventParameters)parameter; RoutedPropertyChangedEventArgs <object> e = (RoutedPropertyChangedEventArgs <object>)ep.EventArgs; TaxonomyEntry tw = (TaxonomyEntry)e.NewValue; if (tw != null) { ParentTaxId = tw.Id; } }
/// <summary> /// Disposes the view /// </summary> /// <param name="isDisposing"></param> protected override void Dispose(bool isDisposing) { if (isDisposing) { if (_rootTaxonomy != null) { _rootTaxonomy.Dispose(); _rootTaxonomy = null; } } base.Dispose(isDisposing); }
private void LoadAndFindTaxonomy() { var dc = RcadSequenceProvider.CreateDbContext(ConnectionString); _rootTaxonomy = new TaxonomyEntry(dc, true); // Get a list of the taxids leading up to the selected one. string sql = @"with cte as (select ParentTaxID from Taxonomy where TaxID={0} " + @"union all select t.ParentTaxID from Taxonomy t join cte tp on t.TaxID = tp.ParentTaxID) " + @"select * from cte"; var taxIds = dc.ExecuteQuery <int>(sql, ParentTaxId).Reverse().ToList(); taxIds.RemoveAt(0); // Remove root entry taxIds.Add(ParentTaxId); TaxonomyEntry current = _rootTaxonomy; foreach (int tid in taxIds) { // Skip root (level 0) if (tid <= 1) { continue; } current.IsExpanded = true; foreach (var child in current.Children) { if (child.Id == tid) { current = child; break; } } } if (current.Id == ParentTaxId) { current.IsSelected = true; } else { _rootTaxonomy = null; dc.Dispose(); } }