public NamespaceViewModel(string name, ApplicationViewModel applicationViewModel) { IsChecked = true; IsExpanded = true; Name = name; Children = new ObservableCollection<NamespaceViewModel>(); ApplicationViewModel = applicationViewModel; }
private void UpdateApplications(IEnumerable<LogViewModel> logsToInsert) { try { foreach (var log in logsToInsert) { var application = Applications.FirstOrDefault(m => m.Name == log.Application); if (application == null) { application = new ApplicationViewModel(log.Application, Logs, Namespaces); Applications.Add(application); } } } catch (Exception e) { Console.WriteLine("Could not update applications: " + e); } }
private void HandleNamespace(NamespaceViewModel parent, string suffix, ApplicationViewModel application, LogViewModel log) { // Example: VerbTeX.View (Verbosus was processed before) string nsLogFull = suffix; // Example: VerbTeX string nsLogPart = nsLogFull.Split(new string[] { Constants.NAMESPACE_SPLITTER }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(); // Try to get existing namespace with name VerbTeX var nsChild = parent.Children.FirstOrDefault(m => m.Name == nsLogPart); if (nsChild == null) { nsChild = new NamespaceViewModel(nsLogPart, application); nsChild.IsChecked = parent.IsChecked; parent.Children.Add(nsChild); nsChild.Parent = parent; } if (suffix.Contains(Constants.NAMESPACE_SPLITTER)) { HandleNamespace(nsChild, suffix.Substring(suffix.IndexOf(Constants.NAMESPACE_SPLITTER) + 1), application, log); } else { SetLogCountByLevel(log, nsChild); } }