From 189c05ad5396ed60585aa5c227818600dc2773fc Mon Sep 17 00:00:00 2001 From: tsuji Date: Tue, 21 Dec 2021 10:36:13 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80=E5=8F=82?= =?UTF-8?q?=E7=85=A7=E3=83=9C=E3=82=BF=E3=83=B3=E3=81=AE=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=20=E3=83=BB=E5=89=8D=E5=9B=9E?= =?UTF-8?q?=E5=80=A4=E3=81=8C=E3=81=82=E3=82=8B=E5=A0=B4=E5=90=88=E3=81=AF?= =?UTF-8?q?=E3=80=81=E5=88=9D=E6=9C=9F=E5=80=A4=E3=81=AB=E5=89=8D=E5=9B=9E?= =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=EF=BC=88=E5=89=8D=E5=9B=9E=E5=80=A4=E3=83=95=E3=82=A9=E3=83=AB?= =?UTF-8?q?=E3=83=80=E3=81=8C=E6=B6=88=E5=8E=BB=E3=81=95=E3=82=8C=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=82=8B=E5=A0=B4=E5=90=88=E3=81=AFC:=E7=9B=B4?= =?UTF-8?q?=E4=B8=8B=E3=81=A7=E8=A1=A8=E7=A4=BA=EF=BC=89=20=E3=83=BB?= =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80=E3=82=92=E6=B1=BA=E5=AE=9A?= =?UTF-8?q?=E3=81=97=E3=80=81=E9=81=B8=E6=8A=9E=E3=83=80=E3=82=A4=E3=82=A2?= =?UTF-8?q?=E3=83=AD=E3=82=B0=E7=B5=82=E4=BA=86=E5=BE=8C=E3=81=AF=E3=82=AB?= =?UTF-8?q?=E3=83=BC=E3=82=BD=E3=83=AB=E3=82=92=E3=83=86=E3=82=AD=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9=E6=96=87=E6=9C=AB?= =?UTF-8?q?=E3=81=AB=E9=85=8D=E7=BD=AE=E3=81=97=E3=80=81=E3=83=91=E3=82=B9?= =?UTF-8?q?=E3=81=AE=E7=B5=82=E7=AB=AF=E3=82=92=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/CSRender/CSRender/FilePathSelect.cs | 46 +++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/Code/CSRender/CSRender/FilePathSelect.cs b/Code/CSRender/CSRender/FilePathSelect.cs index 869b1f7..a407237 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() -- 2.22.0