private void RefreshAvailableItems() { AvailableOwners.Clear(); AvailableOwners.Add(ALL); AvailableOwners.AddRange( (_logMessageViewModels.SourceCollection as IEnumerable <ILogMessageViewModel>) .Select((model => model.Owner)).Distinct()); SelectedOwner = ALL; AvailableMessageTypes.Clear(); AvailableMessageTypes.Add(ALL); AvailableMessageTypes.AddRange( (_logMessageViewModels.SourceCollection as IEnumerable <ILogMessageViewModel>) .Select((model => model.LogMessageType)).Distinct()); SelectedMessageType = ALL; }
private void UpdateRootMessageTypes() { const string MessageRegex = @"message\s+(\w+)\s+{"; var originalRootMessage = RootMessageName; var availableMessageTypes = Regex.Matches(MessageDefinition, MessageRegex) .Cast <Match>() .Select(m => m.Groups[1].Value) .ToList(); AvailableMessageTypes.Clear(); foreach (var availableMessageType in availableMessageTypes) { AvailableMessageTypes.Add(availableMessageType); } RootMessageName = string.IsNullOrWhiteSpace(originalRootMessage) ? AvailableMessageTypes.LastOrDefault() : AvailableMessageTypes.Contains(originalRootMessage) ? originalRootMessage : AvailableMessageTypes.LastOrDefault(); }