private void OnIterationChanged(object sender, IterationChangedEventArgs args) { LoopIteration iteration = args.PreviousIteration; if (iteration != null) { HashSet <int> removes = new HashSet <int>(); foreach (Operation op in iteration.Operations) { if (removes.Contains(op.Id)) { continue; } ViewCache cache = this.views[op.GetType()]; InstantView opAdorner = cache.GetView(op.Id); if (opAdorner != null) { this.layer.RemoveAdornment(opAdorner); } } } AdornCode(this.view.TextSnapshot, GetCancelSource(current: true).Token); //ITextSnapshot s = this.view.TextSnapshot; //var map = this.context.LineMap ?? await LineMap.ConstructAsync (this.view.TextSnapshot, this.context.Span.GetText (s), GetCancelSource (current: true).Token); //AdornOperationContainer (args.NewIteration, s, map, GetCancelSource (current: true).Token); }
public bool TryGetView(out InstantView view) { if (this.views.Count > this.index) { view = this.views[this.index++]; return(true); } view = this.visuals.CreateView(); this.views.Add(view); this.index++; return(false); }
private void OperationAdornerRemoved(object tag, UIElement element) { InstantView adorner = (InstantView)element; OperationViewModel vm = (OperationViewModel)adorner.DataContext; ViewCache cache; if (!this.views.TryGetValue(vm.Operation.GetType(), out cache)) { return; } cache.Remove(adorner); }
public InstantView[] ClearViews() { InstantView[] cleared; if (this.index >= this.views.Count) { cleared = new InstantView[0]; } else { cleared = new InstantView[this.views.Count - this.index]; for (int i = 0; i < cleared.Length; i++) { int x = this.views.Count - 1; cleared[i] = this.views[x]; this.views.RemoveAt(x); } } this.index = 0; return(cleared); }
public void Remove(InstantView view) { this.views.Remove(view); }