Example #1
0
        private void ShowDifferencesButton_Click(object sender, RoutedEventArgs e)
        {
            List <string> leftStrings = RtbLeftItems.ToListOfString();
            List <string> rightStings = RtbRightItems.ToListOfString();

            var differences = new List <string>();

            // Find items that are not in the RIGHT list of strings
            differences.Add("In LEFT SIDE ONLY:");
            foreach (var item in leftStrings)
            {
                string itemFound = rightStings.FirstOrDefault(i => String.Compare(i, item, StringComparison.OrdinalIgnoreCase) == 0);
                if (itemFound == null)
                {
                    differences.Add(item);
                }
            }

            // Find items that are not in the LEFT list of strings
            differences.Add("--------------------------");
            differences.Add("In RIGHT SIDE ONLY:");
            foreach (var item in rightStings)
            {
                string itemFound = leftStrings.FirstOrDefault(i => String.Compare(i, item, StringComparison.OrdinalIgnoreCase) == 0);
                if (itemFound == null)
                {
                    differences.Add(item);
                }
            }

            // Show the results
            var myDialog = new RichTextDialogBox(differences, "Differences");

            myDialog.Show();
        }
Example #2
0
        private void ShowSimilaritiesButton_Click(object sender, RoutedEventArgs e)
        {
            List <string> leftStrings = RtbLeftItems.ToListOfString();
            List <string> rightStings = RtbRightItems.ToListOfString();

            var similarities = new List <string>();

            // Find items that are not in the RIGHT list of strings
            foreach (var item in leftStrings)
            {
                string itemFound = rightStings.FirstOrDefault(i => String.Compare(i, item, StringComparison.OrdinalIgnoreCase) == 0);
                if (itemFound != null)
                {
                    similarities.Add(item);
                }
            }

            // Show the results
            var myDialog = new RichTextDialogBox(similarities, "Similarities");

            myDialog.Show();
        }