Пример #1
0
        //  _____      _                 _   _____        _          ______ _ _
        // |  __ \    | |               | | |  __ \      | |        |  ____(_) |
        // | |__) |___| | ___   __ _  __| | | |  | | __ _| |_ __ _  | |__   _| | ___
        // |  _  // _ \ |/ _ \ / _` |/ _` | | |  | |/ _` | __/ _` | |  __| | | |/ _ \
        // | | \ \  __/ | (_) | (_| | (_| | | |__| | (_| | || (_| | | |    | | |  __/
        // |_|  \_\___|_|\___/ \__,_|\__,_| |_____/ \__,_|\__\__,_| |_|    |_|_|\___|



        private void ReloadCSVButton_Click(object sender, EventArgs e)
        {
            ColumnNameCheckedListbox.Items.Clear();

            FilenameLabel.Text = "Clearing old preview... (This might take a while for previews with a large number of columns.)";
            FilenameLabel.Invalidate();
            FilenameLabel.Update();
            FilenameLabel.Refresh();

            dataGridView1.DataSource = null;
            FilenameLabel.Text       = "Ready to load a data file preview.";

            if (FilenameDisplayBox.Text != "No file selected...")
            {
                DisableButtons();
                BgWorkerInformation BgData = new BgWorkerInformation();

                BgData.InputFile   = FilenameDisplayBox.Text;
                BgData.HasHeaders  = HeaderRowDropdown.SelectedItem.ToString();
                BgData.Delimiters  = DelimiterTextBox.Text.ToString();
                BgData.UsingQuotes = EnclosedInQuotesDropdown.SelectedItem.ToString();

                LoadCSVPreview_BGWorker.RunWorkerAsync(BgData);
            }
        }
Пример #2
0
        //  _                     _   _____        _          ____        _   _
        // | |                   | | |  __ \      | |        |  _ \      | | | |
        // | |     ___   __ _  __| | | |  | | __ _| |_ __ _  | |_) |_   _| |_| |_ ___  _ __
        // | |    / _ \ / _` |/ _` | | |  | |/ _` | __/ _` | |  _ <| | | | __| __/ _ \| '_ \ 
        // | |___| (_) | (_| | (_| | | |__| | (_| | || (_| | | |_) | |_| | |_| || (_) | | | |
        // |______\___/ \__,_|\__,_| |_____/ \__,_|\__\__,_| |____/ \__,_|\__|\__\___/|_| |_|
        //


        private void GeneratePreviewButton_Click(object sender, EventArgs e)
        {
            FirstColumnComboBox.Items.Clear();
            LastColumnComboBox.Items.Clear();
            TokenColumnComboBox.Items.Clear();

            FilenameDisplayBox.Text = "No file selected...";

            FilenameLabel.Text = "Clearing old preview... (This might take a while for previews with a large number of columns.)";
            FilenameLabel.Invalidate();
            FilenameLabel.Update();
            FilenameLabel.Refresh();

            dataGridView1.DataSource = null;
            FilenameLabel.Text       = "Ready to load a data file preview.";

            openFileDialog.Title = "Please select you data file...";

            DialogResult InputFileDialog = openFileDialog.ShowDialog();

            if (InputFileDialog != DialogResult.Cancel)
            {
                DisableButtons();
                string InputFile = openFileDialog.FileName;

                FilenameDisplayBox.Text = InputFile;

                FilenameDisplayBox.Focus();
                // Move the caret to the end of the text box
                FilenameDisplayBox.Select(FilenameDisplayBox.Text.Length, 0);


                BgWorkerInformation BgData = new BgWorkerInformation();

                BgData.InputFile   = FilenameDisplayBox.Text;
                BgData.HasHeaders  = HeaderRowDropdown.SelectedItem.ToString();
                BgData.Delimiters  = DelimiterTextBox.Text.ToString();
                BgData.UsingQuotes = EnclosedInQuotesDropdown.SelectedItem.ToString();

                LoadCSVPreview_BGWorker.RunWorkerAsync(BgData);
            }
            else
            {
                FilenameDisplayBox.Text = "No file selected...";
                StartButton.Enabled     = false;
                ReloadCSVButton.Enabled = false;
                FirstColumnComboBox.Items.Clear();
                LastColumnComboBox.Items.Clear();
                TokenColumnComboBox.Items.Clear();
            }
        }