private void LoadState(IEnumerable <string> events) { commanderToasts.UnsubscribeToasts(); // Clear state: State.Cargo.ToList().ForEach(k => State.IncrementCargo(k.Value.Data.Name, -1 * k.Value.Count)); LastUpdate = Instant.MinValue; ApplyEventsToSate(events); ThresholdsManagerWindow.InitThresholds(State.Cargo); commanderToasts.SubscribeToasts(); if (Settings.Default.EntriesHighlighted == null) { Settings.Default.EntriesHighlighted = new StringCollection(); Settings.Default.Save(); } var highlightedEntries = Settings.Default.EntriesHighlighted.Cast <string>().OrderBy(s => s).ToList(); var entries = State.Cargo.Select(kv => kv.Value).OrderBy(e => e.Data.Name).ToList(); for (int i = 0, j = 0; i < entries.Count && j < highlightedEntries.Count; i++) { if (entries[i].Data.Name == highlightedEntries[j]) { entries[i].Highlighted = true; j++; } } }
private void LoadState(IEnumerable <string> events) { commanderToasts?.UnsubscribeToasts(); State.InitLoad(); // Clear state: State.Cargo.ToList().ForEach(k => State.IncrementCargo(k.Value.Data.Name, -1 * k.Value.Count)); LastUpdate = Instant.MinValue; ApplyEventsToSate(events); ThresholdsManagerWindow.InitThresholds(State.Cargo); commanderToasts?.SubscribeToasts(); State.Cargo.RefreshSort(); State.CompleteLoad(); }