diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2021-12-26 18:22:32 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2021-12-26 18:22:32 +0300 |
commit | 54fc3320e7d64d7903b4d091fe0d5c15df01fd78 (patch) | |
tree | ac8b9aa1e883a85339a594b2797ab319cca73c4e /src/Forms/Dialog.cs | |
parent | 20cfbfcca3a779c04aecdca5e4b465651e2be42a (diff) |
Move to /src
Diffstat (limited to 'src/Forms/Dialog.cs')
-rw-r--r-- | src/Forms/Dialog.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Forms/Dialog.cs b/src/Forms/Dialog.cs new file mode 100644 index 0000000..170cc81 --- /dev/null +++ b/src/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(); + } + } +} |