diff --git a/Code/CSRender/CSRender/FilePathSelect.cs b/Code/CSRender/CSRender/FilePathSelect.cs index 869b1f73db818287ac33c9fcb2c5a9b0299b3d2a..a407237213b164837c973b2f0075ded835e827ed 100644 --- a/Code/CSRender/CSRender/FilePathSelect.cs +++ b/Code/CSRender/CSRender/FilePathSelect.cs @@ -87,13 +87,22 @@ namespace CSRender var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); selectFile.IsFolderPicker = true; 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) { return; } //共通部分 targetBox.Text = selectFile.FileName; + targetBox.Focus(); + targetBox.Select(this.targetBox.Text.Length, 0); } //参照ボタンClickでフォルダ選択のダイアログを表示(リファレンスフォルダ) @@ -104,13 +113,22 @@ namespace CSRender var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); selectFile.IsFolderPicker = true; 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) { return; } //共通部分 referenceBox.Text = selectFile.FileName; + referenceBox.Focus(); + referenceBox.Select(this.referenceBox.Text.Length, 0); } //参照ボタンClickでフォルダ選択のダイアログを表示(作業フォルダ) @@ -121,14 +139,23 @@ namespace CSRender var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); selectFile.IsFolderPicker = true; 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) { return; } //共通部分 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")); } @@ -143,13 +170,22 @@ namespace CSRender var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); selectFile.IsFolderPicker = true; 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) { return; } //共通部分 reportBox.Text = selectFile.FileName + @"\"; + reportBox.Focus(); + reportBox.Select(this.reportBox.Text.Length, 0); } private void EditEnvFile()