/// <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(); } } } }
void OnSheetLoaded(GstuSpreadSheet ss) { datas = new VisibleData(); for (int i = 1; i < ss.columns["A"].Count; i++) { int id = int.Parse(ss.rows[i + 1][0].value); datas.Add(id, new Data()); for (int j = 0; j < ss.rows[i + 1].Count; j++) { //Debug.Log("ss.rows[i]: " + ss.rows[i + 1][j].value); datas[id].UpdateStats(ss.rows[i + 1]); } } #if UNITY_EDITOR EditorUtility.SetDirty(this); #endif onGoogleSynced?.Invoke(); }