Пример #1
0
        public static Tuple <string, string[][]>[] DialogMultiLoad(IWin32Window owner)
        {
            var dialog = new OpenFileDialog();

            dialog.Filter      = "CSV file|*.csv";
            dialog.Multiselect = true;

            Tuple <string, string[][]>[] sheets = null;

            if (dialog.ShowDialog(owner) == DialogResult.OK)
            {
                try
                {
                    sheets = dialog.FileNames.Select(path => Tuple.Create(path, CSVTools.Load(path))).ToArray();
                }
                catch (Exception exn)
                {
                    MessageBox.Show(exn.Message);
                }
            }

            dialog.Dispose();

            return(sheets);
        }
Пример #2
0
        public static string[][] DialogLoad(IWin32Window owner)
        {
            var dialog = new OpenFileDialog();

            dialog.Filter = "CSV file|*.csv";

            string[][] rows = null;

            if (dialog.ShowDialog(owner) == DialogResult.OK)
            {
                try
                {
                    rows = CSVTools.Load(dialog.FileName);
                }
                catch (Exception exn)
                {
                    MessageBox.Show(exn.Message);
                }
            }

            dialog.Dispose();

            return(rows);
        }