diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2022-12-20 12:27:47 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2022-12-20 12:27:47 +0300 |
commit | 73569a43644309d0342817580bcfd86c1face5b8 (patch) | |
tree | f3c6e15db82130b02ec8c3fa1b64674e6a9cf48d /src/Models/Dialog.cs | |
parent | 3d186c22e8665b80839495fdcf4b176c2f3e03b9 (diff) |
Namespace refactoring
Diffstat (limited to 'src/Models/Dialog.cs')
-rw-r--r-- | src/Models/Dialog.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Models/Dialog.cs b/src/Models/Dialog.cs new file mode 100644 index 0000000..abc89b8 --- /dev/null +++ b/src/Models/Dialog.cs @@ -0,0 +1,40 @@ +using Microsoft.Office.Interop.Excel; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace RhSolutions.Models +{ + static class Dialog + { + public static string GetFilePath() + { + using (OpenFileDialog dialog = new OpenFileDialog()) + { + dialog.Filter = "Файлы Excel (*.xls;*.xlsx;*.xlsm)|*.xls;*.xlsx;*.xlsm"; + + if (dialog.ShowDialog() == DialogResult.OK) + { + return dialog.FileName; + } + + else return string.Empty; + } + } + + public static string[] GetMultiplyFiles() + { + using (OpenFileDialog dialog = new OpenFileDialog()) + { + dialog.Filter = "Файлы Excel (*.xls;*.xlsx;*.xlsm)|*.xls;*.xlsx;*.xlsm"; + dialog.Multiselect = true; + + if (dialog.ShowDialog() == DialogResult.OK) + { + return dialog.FileNames; + } + + else return null; + } + } + } +} |