internal void UpdateActiveContext() { for (int n = contexts.Count - 1; n >= 0; n--) { StatusBarContextImpl ctx = contexts [n]; if (ctx.StatusChanged) { if (ctx != activeContext) { activeContext = ctx; activeContext.Update(); } return; } } throw new InvalidOperationException(); // There must be at least the main context }
internal void Remove(StatusBarContextImpl ctx) { if (ctx == mainContext) { return; } StatusBarContextImpl oldActive = activeContext; contexts.Remove(ctx); UpdateActiveContext(); if (oldActive != activeContext) { // Removed the active context. Update the status bar. activeContext.Update(); } }