/// <summary> /// Needs to be called to update selections that depend on the available logs, such as /// filtering by encounter name. /// </summary> /// <param name="logs">A logs which will be filtered in the future.</param> public void UpdateLogs(IEnumerable <LogData> logs) { string previousKey = encounterFilterDropDown.SelectedKey; var encounterNames = new[] { LogFilters.EncounterFilterAll } .Concat(logs .Where(x => x.ParsingStatus == ParsingStatus.Parsed) .Select(x => logNameProvider.GetName(x)) .Distinct() .OrderBy(x => x) .ToArray() ).ToArray(); encounterFilterDropDown.DataStore = encounterNames; if (encounterNames.Contains(previousKey)) { encounterFilterDropDown.SelectedKey = previousKey; } else { encounterFilterDropDown.SelectedKey = LogFilters.EncounterFilterAll; } }
private bool FilterByEncounterName(LogData log) { return(EncounterFilter == EncounterFilterAll || log.ParsingStatus == ParsingStatus.Parsed && nameProvider.GetName(log) == EncounterFilter); }