aboutsummaryrefslogtreecommitdiff
path: root/src/Models/Dialog.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Models/Dialog.cs')
-rw-r--r--src/Models/Dialog.cs40
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;
+ }
+ }
+ }
+}