From 73569a43644309d0342817580bcfd86c1face5b8 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Tue, 20 Dec 2022 12:27:47 +0300 Subject: Namespace refactoring --- src/Models/Dialog.cs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Models/Dialog.cs (limited to 'src/Models/Dialog.cs') 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; + } + } + } +} -- cgit v1.2.3