1 ~ 3 個のファイルを受け入れることができるコンソール プログラムを作成しています。ファイルを受け入れるのに 3 回使用しOpenFileDialog
ていますが、2 回目と 3 回目はファイル ダイアログがコンソール ウィンドウの背後にあるため、わかりにくくなっています。上に表示させる方法はありますか?
問題のイメージ:
関連するコードは次のとおりです。
static bool loadFile(ref List<string> ls)
{
OpenFileDialog f = new OpenFileDialog();
if (f.ShowDialog() == DialogResult.OK)
{
Console.WriteLine("Loaded file {0}", f.FileName);
ls.Add(f.FileName);
return true;
}
else
{
return false;
}
}
[STAThread]
static void Main(string[] args)
{
// sanity check
if (args.Length > 3)
{
Console.WriteLine("Sorry, this program currently supports a maximum of three different reports to analyze at a time.");
return;
}
else if (args.Length == 0)
{
List<string> fL = new List<string>();
for (int k = 0; k < 3; k++)
{
if (!loadFile(ref fL)) break;
}
if (fL.Count == 0)
{
InfoDisplay.HelpMessage();
return;
}
else
{
args = fL.ToArray();
}
}
// main program
...
}