public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = ""; var resultRegExList = new List <string>(); if (value is List <Tuple <Operation, string> > ) { var regExList = value as List <Tuple <Operation, string> >; // if the list contains only ´the initial item if (regExList.Count == 0 || (regExList.Count == 1 && regExList.ElementAt(0).Item2 == "")) { return(oldValue); } foreach (var r in regExList) { if (r is Tuple <Operation, string> ) { var opAndString = r as Tuple <Operation, string>; resultRegExList.Add(RegExUtility.GenerateRegEx(opAndString.Item2, opAndString.Item1)); } } result = RegExUtility.MergeRegEx(resultRegExList); } return(result); }
private void RegExMetricCriticalGenAdd_Click(object sender, RoutedEventArgs e) { if (MonitoringIndicatorList.SelectedItem != null) { RegExUtil.Operation op = RegExOperationConvertBack(this.RegExGenMetricCriticalOp.SelectedItem as string); string part = RegExUtility.GenerateRegEx(RegExGeneratorMetricCritical.Text, op); string oldRegEx = (MonitoringIndicatorList.SelectedItem as Indicator).StatementCritical; var mergeList = new List <string>(); mergeList.Add(oldRegEx); mergeList.Add(part); (MonitoringIndicatorList.SelectedItem as Indicator).StatementCritical = RegExUtility.MergeRegEx(mergeList); RegExGeneratorMetricCritical.Text = ""; } }