Esempio n. 1
0
        private void browse_btn_Click(object sender, EventArgs e)
        {
            var dlg = new CommonOpenFileDialog();

            dlg.Title            = "Select Data Folder";
            dlg.IsFolderPicker   = true;
            dlg.EnsureFileExists = true;
            dlg.EnsurePathExists = true;
            dlg.EnsureValidNames = true;
            dlg.Multiselect      = false;

            if (dlg.ShowDialog() == CommonFileDialogResult.Ok)
            {
                var PathToData = dlg.FileName;
                textBox1.Text = PathToData;
                try
                {
                    String[] ParsedFiles = Directory.GetFiles(PathToData, "*.txt", SearchOption.TopDirectoryOnly);
                    String[] CSVFiles    = Directory.GetFiles(PathToData, "*.csv", SearchOption.TopDirectoryOnly);
                    if (CSVFiles.Length > 0)
                    {
                        Import_Wizard IW = new Import_Wizard();

                        IW.AddToList(CSVFiles);

                        IW.ShowDialog();
                    }
                    AddToList(ParsedFiles);
                }catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Esempio n. 2
0
        private void fromFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dlg = new CommonOpenFileDialog();

            dlg.Title            = "Select CSV Folder";
            dlg.IsFolderPicker   = true;
            dlg.EnsureFileExists = true;
            dlg.EnsurePathExists = true;
            dlg.EnsureValidNames = true;
            dlg.Multiselect      = false;
            if (dlg.ShowDialog() == CommonFileDialogResult.Ok)
            {
                var PathToData = dlg.FileName;
                textBox1.Text = PathToData;
                String[] files = Directory.GetFiles(PathToData, "*.csv", SearchOption.TopDirectoryOnly);
                if (files.Length > 0)
                {
                    Import_Wizard IW = new Import_Wizard();

                    IW.AddToList(files);

                    IW.ShowDialog();
                }
            }
        }
Esempio n. 3
0
        private void list_drag_complete(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
            foreach (string str in files)
            {
                if (Path.GetExtension(str).ToUpperInvariant() == ".CSV")
                {
                    Import_Wizard IW = new Import_Wizard();

                    IW.AddToList(files);

                    IW.ShowDialog();
                    return;
                }
            }
            AddToList(files);
        }
Esempio n. 4
0
        private void fromFilesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter      = "CSV (*.CSV)|*.CSV";
            openFileDialog1.Multiselect = true;
            openFileDialog1.Title       = "Select CSV";
            DialogResult dr = openFileDialog1.ShowDialog();

            if (dr == DialogResult.OK)
            {
                //AddToList(openFileDialog1.FileNames, listView1);
                if (openFileDialog1.FileNames.Length > 0)
                {
                    Import_Wizard IW = new Import_Wizard();

                    IW.AddToList(openFileDialog1.FileNames);

                    IW.ShowDialog();
                }
            }
        }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter      = "Text Files (*.TXT)|*.TXT|CSV Files (*.CSV)|*.CSV";
            openFileDialog1.Multiselect = true;
            openFileDialog1.Title       = "Select Data";
            DialogResult dr = openFileDialog1.ShowDialog();

            if (dr == DialogResult.OK)
            {
                String[] CSVFiles = openFileDialog1.FileNames.Where(f => Path.GetExtension(f).ToUpperInvariant() == ".CSV").ToArray();
                if (CSVFiles.Length > 0)
                {
                    Import_Wizard IW = new Import_Wizard();

                    IW.AddToList(CSVFiles);

                    IW.ShowDialog();
                    return;
                }
                AddToList(openFileDialog1.FileNames);
            }
        }