diff options
author | Serghei Cebotari <51533848+schebotar@users.noreply.github.com> | 2021-12-24 17:43:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-24 17:43:04 +0300 |
commit | 0525ec1b42d5857b740dd0dae7f6d9baeb7088d1 (patch) | |
tree | 5d9c814fd023395d894ce36a9040cf7f7330198c /Source/Forms/Dialog.cs | |
parent | 8e5db1238ad3ed97f51d9f0a9c7de83c00a12983 (diff) | |
parent | 20cfbfcca3a779c04aecdca5e4b465651e2be42a (diff) |
Merge pull request #8 from schebotar/dev
Dev
Diffstat (limited to 'Source/Forms/Dialog.cs')
-rw-r--r-- | Source/Forms/Dialog.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Source/Forms/Dialog.cs b/Source/Forms/Dialog.cs new file mode 100644 index 0000000..170cc81 --- /dev/null +++ b/Source/Forms/Dialog.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using System.Windows.Forms; + +namespace RehauSku.Forms +{ + static class Dialog + { + public static string GetFilePath() + { + string filePath = string.Empty; + + using (OpenFileDialog dialog = new OpenFileDialog()) + { + dialog.Filter = "Файлы Excel (*.xls;*.xlsx;*.xlsm)|*.xls;*.xlsx;*.xlsm"; + + if (dialog.ShowDialog() == DialogResult.OK) + { + filePath = dialog.FileName; + } + } + + return filePath; + } + + public static string[] GetMultiplyFiles() + { + List<string> fileNames = new List<string>(); + + using (OpenFileDialog dialog = new OpenFileDialog()) + { + dialog.Filter = "Файлы Excel (*.xls;*.xlsx;*.xlsm)|*.xls;*.xlsx;*.xlsm"; + dialog.Multiselect = true; + + if (dialog.ShowDialog() == DialogResult.OK) + { + foreach (string file in dialog.FileNames) + { + fileNames.Add(file); + } + } + } + + return fileNames.ToArray(); + } + } +} |