RhSolutions-AddIn/Source/Forms/Dialog.cs
2021-12-24 16:22:03 +03:00

47 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 = "Все файлы (*.*)|*.*";
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 = "Все файлы (*.*)|*.*";
dialog.Multiselect = true;
if (dialog.ShowDialog() == DialogResult.OK)
{
foreach (string file in dialog.FileNames)
{
fileNames.Add(file);
}
}
}
return fileNames.ToArray();
}
}
}