Пример #1
0
        /// <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();
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// This is invoked when the user selects a "jump" in the taxonomy view
        /// </summary>
        /// <param name="e">Name of taxonomy group to jump to</param>
        private void OnJumpToTaxonomyGroup(TaxonomyJumpEventArgs e)
        {
            var groupHeader = VisibleData.FirstOrDefault(vd => vd.IsGroupHeader && vd.Header == e.Name);

            if (groupHeader != null)
            {
                // De-select everything
                VisibleData.Where(vd => vd.IsSelected).ForEach(vd => vd.IsSelected = false);

                // Reposition and select this specific grouping
                TopRow = groupHeader.Position;
                if (e.SelectRows)
                {
                    Enumerable.Range(groupHeader.Position + 1, TotalRows - groupHeader.Position - 1).TakeWhile(
                        i => VisibleData[i].IsSequence).Select(i => VisibleData[i]).ForEach(vd => vd.IsSelected = true);
                }
            }
        }