コード例 #1
0
        private void SortOrCompare_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ClearErrors();

                if (RowIdentifierSelectedList.Items.Count == 0)
                {
                    ErrorLabel.Content = "Please selected at least one column to use as an identifier.";
                    return;
                }

                DisableButtons();

                var rowIdentifierColumns = RowIdentifierSelectedList.Items.Cast <string>().ToList();

                if (UtilityMode == UtilityModes.Sort)
                {
                    if (SortWindow == null)
                    {
                        SortWindow = new SortingResultsWindow(this);
                    }

                    SortWindow.SetSettings(File1TextBox.Text, rowIdentifierColumns);
                    SortWindow.Show();
                    SortWindow.CreateResults();
                }
                if (UtilityMode == UtilityModes.Compare)
                {
                    var inclusionColumns = ExtraOutputSelectedList.Items.Cast <string>().ToList();
                    var exclusionColumns = CompareExcludeSelectedList.Items.Cast <string>().ToList();
                    var ignoreCase       = CaseInsensitiveCheckBox.IsChecked ?? false;
                    var alreadySorted    = SkipSortCheckBox.IsChecked ?? false;

                    if (ComparisonWindow == null)
                    {
                        ComparisonWindow = new ComparisonResultsWindow(this);
                    }

                    ComparisonWindow.SetSettings(File1TextBox.Text, File2TextBox.Text, rowIdentifierColumns, exclusionColumns, inclusionColumns, ignoreCase, alreadySorted);
                    ComparisonWindow.Show();
                    ComparisonWindow.CreateResults();
                }

                EnableButtons();
                Hide();
            }
            catch (ArgumentException ex) when(ex.Message == "An item with the same key has already been added.")
            {
                ErrorLabel.Content = "The identifier columns are not unique enough. Repeats founds between rows.";
                EnableButtons();
            }
            catch (Exception ex)
            {
                ErrorLabel.Content = $"Error: {ex.Message}{Environment.NewLine} Stack Trace: {ex.StackTrace}";
                EnableButtons();
            }
        }
コード例 #2
0
        private void Window_Closed(object sender, EventArgs e)
        {
            try
            {
                ClearErrors();

                IsClosed = true;
                if (!ComparisonWindow?.IsClosed ?? false)
                {
                    ComparisonWindow.Close();
                }
            }
            catch (Exception ex)
            {
                SetError($"Error: {ex.Message}{Environment.NewLine} Stack Trace: {ex.StackTrace}");
            }
        }
コード例 #3
0
        private void OpenComparison(object sender, RoutedEventArgs e)
        {
            ComparisonWindow w = new ComparisonWindow();

            w.Show();
        }