//Listener to right click remove a line private void removeLine_Click(object sender, RoutedEventArgs e) { if (exclusionsGrid.SelectedItem != null) { FileExclusion exclusion = exclusionsGrid.SelectedItem as FileExclusion; if (exclusion != null) { Console.WriteLine("Removing item: " + exclusion.type + " " + exclusion.rule); list.Remove(exclusion); refreshRuleList(); } } }
//Append the exlusions private void appendFileExlusions(List <FileExclusion> exclusions, StringBuilder stringBuilder) { if (exclusions != null && exclusions.Count > 0) { FileExclusion last = exclusions.Last(); foreach (FileExclusion exclusion in exclusions) { switch (exclusion.type) { case Resources.IEnums.ExclusionType.Term: stringBuilder.Append("{\"match_phrase\": {\"filename\": \"" + exclusion.rule + "\"}}"); break; case Resources.IEnums.ExclusionType.Wildcard: stringBuilder.Append("{\"wildcard\": {\"filename.keyword\": \"" + exclusion.rule + "\"}}"); break; } if (exclusion != last) { stringBuilder.Append(","); } } } }