/// <summary> /// This method is used to load the VisibleData collection with the proper set of sequences. /// </summary> public void ReloadSequences() { INotificationVisualizer wait = Resolve <INotificationVisualizer>(); Debug.Assert(wait != null); using (wait.BeginWait("Refreshing View", "Loading Data")) { _groupedList.Clear(); // No entities? if (GroupedEntities == null) { if (_taxonomyJumper != null) { _taxonomyJumper.RaiseCloseRequest(); } VisibleData.Clear(); return; } // Add all the entries var seqCollection = new AlignmentEntityViewModel[GroupedEntities.Count]; Parallel.For(0, GroupedEntities.Count, i => seqCollection[i] = new AlignmentEntityViewModel(this, GroupedEntities[i], i)); // Push it to the UI VisibleData.Clear(); foreach (var item in seqCollection) { VisibleData.Add(item); } // Add in the proper line numbers var sequences = VisibleData.Where(vd => vd.IsSequence).ToList(); Parallel.For(0, sequences.Count, i => { sequences[i].DisplayIndex = i + 1; }); // If the taxonomy view is alive, refresh it. if (_taxonomyJumper != null) { if (IsGrouped) { _taxonomyJumper.ChangedGrouping(_data.Entities, Options.MinGroupingRange); } else { _taxonomyJumper.RaiseCloseRequest(); } } } }
/// <summary> /// This method selects or deselects a reference sequence /// </summary> /// <param name="wrapper">Entity</param> private void OnMakeReferenceSequence(AlignmentEntityViewModel wrapper) { if (!wrapper.IsReferenceSequence) { LockedRows.Add(wrapper); wrapper.ReferenceSequenceBorder = null; wrapper.ReferenceSequenceColor = Options.GetNextReferenceSequenceBrush(LockedRows.Count); wrapper.IsReferenceSequence = true; } else { wrapper.ReferenceSequenceBorder = null; wrapper.ReferenceSequenceColor = null; LockedRows.Remove(wrapper); wrapper.IsReferenceSequence = false; } OnPropertyChanged("HasReferenceSequence", "HasLockedRows", "FocusedColumnReferenceIndex"); }