Commit 189c05ad authored by tsuji's avatar tsuji

フォルダ参照ボタンの以下を修正

・前回値がある場合は、初期値に前回フォルダを表示(前回値フォルダが消去されている場合はC:直下で表示)
・フォルダを決定し、選択ダイアログ終了後はカーソルをテキストボックス文末に配置し、パスの終端を表示
parent 14bf83d1
...@@ -87,13 +87,22 @@ namespace CSRender ...@@ -87,13 +87,22 @@ namespace CSRender
var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog();
selectFile.IsFolderPicker = true; selectFile.IsFolderPicker = true;
selectFile.Title = "フォルダを選択してください"; selectFile.Title = "フォルダを選択してください";
selectFile.InitialDirectory = @"C:"; if(Directory.Exists(targetBox.Text))//前回値が存在する場合はそのフォルダを初期値として表示
{
selectFile.InitialDirectory = targetBox.Text.Substring(0, targetBox.Text.LastIndexOf(@"\"));
}
else
{
selectFile.InitialDirectory = @"C:";
}
if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok) if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok)
{ {
return; return;
} }
//共通部分 //共通部分
targetBox.Text = selectFile.FileName; targetBox.Text = selectFile.FileName;
targetBox.Focus();
targetBox.Select(this.targetBox.Text.Length, 0);
} }
//参照ボタンClickでフォルダ選択のダイアログを表示(リファレンスフォルダ) //参照ボタンClickでフォルダ選択のダイアログを表示(リファレンスフォルダ)
...@@ -104,13 +113,22 @@ namespace CSRender ...@@ -104,13 +113,22 @@ namespace CSRender
var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog();
selectFile.IsFolderPicker = true; selectFile.IsFolderPicker = true;
selectFile.Title = "フォルダを選択してください"; selectFile.Title = "フォルダを選択してください";
selectFile.InitialDirectory = @"C:"; if (Directory.Exists(referenceBox.Text))//前回値が存在する場合はそのフォルダを初期値として表示
{
selectFile.InitialDirectory = referenceBox.Text.Substring(0, referenceBox.Text.LastIndexOf(@"\"));
}
else
{
selectFile.InitialDirectory = @"C:";
}
if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok) if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok)
{ {
return; return;
} }
//共通部分 //共通部分
referenceBox.Text = selectFile.FileName; referenceBox.Text = selectFile.FileName;
referenceBox.Focus();
referenceBox.Select(this.referenceBox.Text.Length, 0);
} }
//参照ボタンClickでフォルダ選択のダイアログを表示(作業フォルダ) //参照ボタンClickでフォルダ選択のダイアログを表示(作業フォルダ)
...@@ -121,14 +139,23 @@ namespace CSRender ...@@ -121,14 +139,23 @@ namespace CSRender
var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog();
selectFile.IsFolderPicker = true; selectFile.IsFolderPicker = true;
selectFile.Title = "フォルダを選択してください"; selectFile.Title = "フォルダを選択してください";
selectFile.InitialDirectory = @"C:"; if (Directory.Exists(workBox.Text))//前回値が存在する場合はそのフォルダを初期値として表示
{
selectFile.InitialDirectory = workBox.Text.Substring(0, workBox.Text.LastIndexOf(@"\"));
}
else
{
selectFile.InitialDirectory = @"C:";
}
if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok) if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok)
{ {
return; return;
} }
//共通部分 //共通部分
workBox.Text = selectFile.FileName; workBox.Text = selectFile.FileName;
if(!Directory.Exists(System.IO.Path.Combine(selectFile.FileName, "report"))) workBox.Focus();
workBox.Select(this.workBox.Text.Length, 0);
if (!Directory.Exists(System.IO.Path.Combine(selectFile.FileName, "report")))
{ {
Directory.CreateDirectory(System.IO.Path.Combine(selectFile.FileName, "report")); Directory.CreateDirectory(System.IO.Path.Combine(selectFile.FileName, "report"));
} }
...@@ -143,13 +170,22 @@ namespace CSRender ...@@ -143,13 +170,22 @@ namespace CSRender
var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog();
selectFile.IsFolderPicker = true; selectFile.IsFolderPicker = true;
selectFile.Title = "フォルダを選択してください"; selectFile.Title = "フォルダを選択してください";
selectFile.InitialDirectory = @"C:"; if (Directory.Exists(workBox.Text))//前回値が存在する場合はそのフォルダを初期値として表示
{
selectFile.InitialDirectory = workBox.Text.Substring(0, workBox.Text.LastIndexOf(@"\"));
}
else
{
selectFile.InitialDirectory = @"C:";
}
if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok) if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok)
{ {
return; return;
} }
//共通部分 //共通部分
reportBox.Text = selectFile.FileName + @"\"; reportBox.Text = selectFile.FileName + @"\";
reportBox.Focus();
reportBox.Select(this.reportBox.Text.Length, 0);
} }
private void EditEnvFile() private void EditEnvFile()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment