From 24fda800e8b3c90ca847e8ea7406beba5e1b7ef1 Mon Sep 17 00:00:00 2001 From: tsuji Date: Thu, 11 Nov 2021 16:20:17 +0900 Subject: [PATCH] =?UTF-8?q?=E6=A4=9C=E6=9F=BB=E6=A4=9C=E7=89=88=E6=89=93?= =?UTF-8?q?=E5=90=88=E3=81=9B=E3=81=A7=E7=B4=B9=E4=BB=8B=E3=81=97=E3=81=9F?= =?UTF-8?q?=E6=99=82=E7=82=B9=E3=81=A7=E3=81=AECSRenderGUI=E3=82=92?= =?UTF-8?q?=E7=99=BB=E9=8C=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/CSRender/CSRender.sln | 25 +++ Code/CSRender/CSRender/App.config | 6 + Code/CSRender/CSRender/App.xaml | 10 ++ Code/CSRender/CSRender/App.xaml.cs | 17 ++ Code/CSRender/CSRender/CSRender.csproj | 114 ++++++++++++ Code/CSRender/CSRender/ComboBox.cs | 58 ++++++ .../CSRender/CSRender/CompareButtonSetting.cs | 135 ++++++++++++++ Code/CSRender/CSRender/CustomMsgBox.cs | 168 ++++++++++++++++++ Code/CSRender/CSRender/FilePathSelect.cs | 145 +++++++++++++++ Code/CSRender/CSRender/MainWindow.xaml | 81 +++++++++ Code/CSRender/CSRender/MainWindow.xaml.cs | 73 ++++++++ Code/CSRender/CSRender/NumericUpDown.cs | 88 +++++++++ .../CSRender/Properties/AssemblyInfo.cs | 55 ++++++ .../CSRender/Properties/Resources.Designer.cs | 71 ++++++++ .../CSRender/Properties/Resources.resx | 117 ++++++++++++ .../CSRender/Properties/Settings.Designer.cs | 30 ++++ .../CSRender/Properties/Settings.settings | 7 + Code/CSRender/CSRender/TIFFButtonsSetting.cs | 88 +++++++++ Code/CSRender/CSRender/packages.config | 5 + 19 files changed, 1293 insertions(+) create mode 100644 Code/CSRender/CSRender.sln create mode 100644 Code/CSRender/CSRender/App.config create mode 100644 Code/CSRender/CSRender/App.xaml create mode 100644 Code/CSRender/CSRender/App.xaml.cs create mode 100644 Code/CSRender/CSRender/CSRender.csproj create mode 100644 Code/CSRender/CSRender/ComboBox.cs create mode 100644 Code/CSRender/CSRender/CompareButtonSetting.cs create mode 100644 Code/CSRender/CSRender/CustomMsgBox.cs create mode 100644 Code/CSRender/CSRender/FilePathSelect.cs create mode 100644 Code/CSRender/CSRender/MainWindow.xaml create mode 100644 Code/CSRender/CSRender/MainWindow.xaml.cs create mode 100644 Code/CSRender/CSRender/NumericUpDown.cs create mode 100644 Code/CSRender/CSRender/Properties/AssemblyInfo.cs create mode 100644 Code/CSRender/CSRender/Properties/Resources.Designer.cs create mode 100644 Code/CSRender/CSRender/Properties/Resources.resx create mode 100644 Code/CSRender/CSRender/Properties/Settings.Designer.cs create mode 100644 Code/CSRender/CSRender/Properties/Settings.settings create mode 100644 Code/CSRender/CSRender/TIFFButtonsSetting.cs create mode 100644 Code/CSRender/CSRender/packages.config diff --git a/Code/CSRender/CSRender.sln b/Code/CSRender/CSRender.sln new file mode 100644 index 0000000..f02f530 --- /dev/null +++ b/Code/CSRender/CSRender.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.1684 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSRender", "CSRender\CSRender.csproj", "{135D5283-7F43-4946-B3D8-786ED901D457}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {135D5283-7F43-4946-B3D8-786ED901D457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {135D5283-7F43-4946-B3D8-786ED901D457}.Debug|Any CPU.Build.0 = Debug|Any CPU + {135D5283-7F43-4946-B3D8-786ED901D457}.Release|Any CPU.ActiveCfg = Release|Any CPU + {135D5283-7F43-4946-B3D8-786ED901D457}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {50369CFE-25D5-4DB7-B57F-A19F1248BD22} + EndGlobalSection +EndGlobal diff --git a/Code/CSRender/CSRender/App.config b/Code/CSRender/CSRender/App.config new file mode 100644 index 0000000..00bfd11 --- /dev/null +++ b/Code/CSRender/CSRender/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code/CSRender/CSRender/App.xaml b/Code/CSRender/CSRender/App.xaml new file mode 100644 index 0000000..743fe52 --- /dev/null +++ b/Code/CSRender/CSRender/App.xaml @@ -0,0 +1,10 @@ + + + + + diff --git a/Code/CSRender/CSRender/App.xaml.cs b/Code/CSRender/CSRender/App.xaml.cs new file mode 100644 index 0000000..ab246b7 --- /dev/null +++ b/Code/CSRender/CSRender/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace CSRender +{ + /// + /// App.xaml の相互作用ロジック + /// + public partial class App : Application + { + } +} diff --git a/Code/CSRender/CSRender/CSRender.csproj b/Code/CSRender/CSRender/CSRender.csproj new file mode 100644 index 0000000..f3d53b5 --- /dev/null +++ b/Code/CSRender/CSRender/CSRender.csproj @@ -0,0 +1,114 @@ + + + + + Debug + AnyCPU + {135D5283-7F43-4946-B3D8-786ED901D457} + WinExe + CSRender + CSRender + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.2\lib\Microsoft.WindowsAPICodePack.dll + + + ..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll + + + ..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + + + + MainWindow.xaml + Code + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + \ No newline at end of file diff --git a/Code/CSRender/CSRender/ComboBox.cs b/Code/CSRender/CSRender/ComboBox.cs new file mode 100644 index 0000000..22930fb --- /dev/null +++ b/Code/CSRender/CSRender/ComboBox.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Windows.Controls.Primitives; +using System.Text.RegularExpressions; + +namespace CSRender +{ + public partial class MainWindow : Window + { + //コンボボックスの要素 + public class ComboBoxSet + { + public int Id { get; set; } + public string Item { get; set; } + } + + //クリックしたときに全体を選択 + private void PageBox_GotFocusSelectAll(object sender, RoutedEventArgs e) + { + TextBox box = (TextBox)sender; + //box.SelectAll(); + this.Dispatcher.InvokeAsync(() => { Task.Delay(10); box.SelectAll(); }); + } + + //ページ指定のプルダウンに応じてテキストボックスを活性化/非活性化 + private void PageRange_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + var SelectedItem = (ComboBoxSet)PageRange.SelectedItem; + if (SelectedItem == null) return; + string PageType = (string)SelectedItem.Item; + if(PageType == "指定") + { + pageBox.IsEnabled = true; + pageLabel.IsEnabled = true; + } + else + { + pageBox.IsEnabled = false; + pageLabel.IsEnabled = false; + } + } + + } + + +} diff --git a/Code/CSRender/CSRender/CompareButtonSetting.cs b/Code/CSRender/CSRender/CompareButtonSetting.cs new file mode 100644 index 0000000..6648fd6 --- /dev/null +++ b/Code/CSRender/CSRender/CompareButtonSetting.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Windows.Controls.Primitives; +using System.Text.RegularExpressions; +using System.Diagnostics; +using System.IO; + +namespace CSRender +{ + public partial class MainWindow : Window + { + private void CompareButtonClick(object sender, RoutedEventArgs e) + { + ProcessStartInfo processStartInfo = new ProcessStartInfo(); + string stCurrentDir = System.IO.Directory.GetCurrentDirectory(); + string exePath = System.IO.Path.Combine("PureVerify.Data", "RipVerify", "bin", "x64"); + processStartInfo.FileName = System.IO.Path.Combine(stCurrentDir, exePath, "PureVerify.exe"); + processStartInfo.CreateNoWindow = true; // コマンドプロンプトを非表示 + processStartInfo.UseShellExecute = false; // シェル機能オフ + processStartInfo.RedirectStandardOutput = true;//標準出力をリダイレクト + + //引数設定 + //指定ファイル + processStartInfo.Arguments = "/tar "; + if (!Directory.Exists(targetBox.Text) && !File.Exists(targetBox.Text))//pathのチェック + { + CustomMsgBox.Show(mainWindow, "指定されたファイルあるいはフォルダが存在しません。" + + "\nもう一度設定してください。", "The specified file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); + return; + } + processStartInfo.Arguments += targetBox.Text; + + //リファレンスファイル + if (!Directory.Exists(referenceBox.Text) && !File.Exists(referenceBox.Text))//pathのチェック + { + CustomMsgBox.Show(mainWindow, "指定されたリファレンスファイルあるいはフォルダが存在しません。" + + "\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); + return; + } + processStartInfo.Arguments += " /ref "; + processStartInfo.Arguments += referenceBox.Text; + + //EquiosCenterの場所 + string EquiosCenter = System.IO.Path.Combine(stCurrentDir, "PureVerify.Data", "EquiosCenter_small"); + processStartInfo.Arguments += " /equios "; + processStartInfo.Arguments += EquiosCenter; + + //出力ファイル形式の引数 + processStartInfo.Arguments += " /work "; + + if (!Directory.Exists(workBox.Text) && !File.Exists(workBox.Text))//pathのチェック + { + CustomMsgBox.Show(mainWindow, "指定された作業フォルダが存在しません。" + + "\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); + return; + } + //processStartInfo.Arguments += workBox.Text; + string workDir = System.IO.Path.Combine(stCurrentDir, "PureVerify.Data", "RipVerify"); + processStartInfo.Arguments += workDir; + + + //検版の指定(2だとNGログ検版(LOG-Diff)になる) + processStartInfo.Arguments += " /operation \"1\""; + //差異箇所マークのサイズを指定 + processStartInfo.Arguments += " /markdis \"50\""; + //PDFReportの画像の圧縮形式(0:ZLIB、1:LZW、2:JPEG、3:JPEG2000、4:RUN_LENGTH) + processStartInfo.Arguments += " /encode \"1\""; + //検版結果OKとなったファイルリストをPDFレポートの最後に記載(0:記載しない、1:記載する) + processStartInfo.Arguments += " /show \"1\""; + //検版品質ファイルの選択(0:弱、1:中、2:強、3:カスタム) + processStartInfo.Arguments += " /quality \"2\""; + + //CSRender.exeを実行 + Process process = Process.Start(processStartInfo); + //ResultConsole.Text = process.StandardOutput.ReadToEnd(); + process.OutputDataReceived += process_DataReceived; + process.BeginOutputReadLine(); + //ResultConsole.ScrollToEnd(); + process.WaitForExit(); + process.Close(); + + //指定先にレポートを移動 + string reportPath = System.IO.Path.Combine(workBox.Text, "report"); + if (!Directory.Exists(reportPath))//指定先にreportフォルダがあるか + { + Directory.CreateDirectory(reportPath);//なければ新規でreportフォルダを作成 + } + var allReport = Directory.EnumerateFiles(System.IO.Path.Combine(workDir, "report") + , "*", SearchOption.TopDirectoryOnly);//reportフォルダ内の全てのファイルを取得 + foreach (string file in allReport) + { + string fileTarget = System.IO.Path.GetFileName(file); + File.Move(file, System.IO.Path.Combine(reportPath, fileTarget));//指定先に移動 + } + } + + //コンソール出力を読み取りする関数 + public void process_DataReceived(object sender, DataReceivedEventArgs e) + { + string VerifyResult = e.Data; + Dispatcher.BeginInvoke(new Action(() => + { + ResultConsole.Text = VerifyResult; + ResultConsole.ScrollToEnd(); + })); + } + + private string outputLog(string workDir) + { + StreamReader logString = new StreamReader(System.IO.Path.Combine(workDir, "report" + "hironimo.txt")); + string toString = ""; + string tranceString = logString + toString; + string cutString = "*****************************************************" + "\r\n" + + "Number of Processors = 8" + "\r\n" + + "HostName = I-N-21-00008" + "\r\n" + + "PlatformId = 0" + "\r\n" + "PureVerifyMainSetUp.txt" + "\r\n" + + " MakeThreadNums = 0" + " PDFREPORT_SPLIT_PAGENUM = 32" + "\r\n" + + "*****************************************************"; + string outputString = tranceString.Replace(cutString, ""); + return outputString; + } + } +} diff --git a/Code/CSRender/CSRender/CustomMsgBox.cs b/Code/CSRender/CSRender/CustomMsgBox.cs new file mode 100644 index 0000000..deab80b --- /dev/null +++ b/Code/CSRender/CSRender/CustomMsgBox.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Interop; +using System.Runtime.InteropServices; + +namespace CSRender +{ + class CustomMsgBox + { + /// + /// 親ウィンドウ + /// + private Window ownerWindow = null; + + /// + /// フックハンドル + /// + private IntPtr hHook = IntPtr.Zero; + + /// + /// メッセージボックスを表示する + /// + /// + /// + /// + /// + /// + /// + public static MessageBoxResult Show( + Window owner, + string messageBoxText, + string caption, + MessageBoxButton button, + MessageBoxImage icon) + { + + if (owner.WindowState == WindowState.Minimized) + { + return MessageBox.Show(owner, messageBoxText, caption, button, icon); + } + else + { + CustomMsgBox mbox = new CustomMsgBox(owner); + return mbox.Show(messageBoxText, caption, button, icon); + } + } + + /// + /// コンストラクタ + /// + /// Owner Window + private CustomMsgBox(Window window) + { + ownerWindow = window; + } + + /// + /// メッセージボックスを表示する + /// + /// + /// + /// + /// + /// + private MessageBoxResult Show( + string messageBoxText, + string caption, + MessageBoxButton button, + MessageBoxImage icon) + { + // フックを設定する。 + HwndSource hwndSource = (HwndSource)HwndSource.FromVisual(ownerWindow); + IntPtr hInstance = WinAPI.GetWindowLong(hwndSource.Handle, WinAPI.GWL_HINSTANCE); + IntPtr threadId = WinAPI.GetCurrentThreadId(); + hHook = WinAPI.SetWindowsHookEx(WinAPI.WH_CBT, new WinAPI.HOOKPROC(HookProc), hInstance, threadId); + + return MessageBox.Show(ownerWindow, messageBoxText, caption, button, icon); + } + + /// + /// フックプロシージャ + /// + /// + /// + /// + /// + private IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam) + { + + if (nCode == WinAPI.HCBT_ACTIVATE) + { + WinAPI.RECT rcForm = new WinAPI.RECT(0, 0, 0, 0); + WinAPI.RECT rcMsgBox = new WinAPI.RECT(0, 0, 0, 0); + + HwndSource hwndSource = (HwndSource)HwndSource.FromVisual(ownerWindow); + WinAPI.GetWindowRect(hwndSource.Handle, out rcForm); + WinAPI.GetWindowRect(wParam, out rcMsgBox); + + // センター位置を計算する。 + int x = (rcForm.Left + (rcForm.Right - rcForm.Left) / 2) - ((rcMsgBox.Right - rcMsgBox.Left) / 2); + int y = (rcForm.Top + (rcForm.Bottom - rcForm.Top) / 2) - ((rcMsgBox.Bottom - rcMsgBox.Top) / 2); + + WinAPI.SetWindowPos(wParam, 0, x, y, 0, 0, WinAPI.SWP_NOSIZE | WinAPI.SWP_NOZORDER | WinAPI.SWP_NOACTIVATE); + + IntPtr result = WinAPI.CallNextHookEx(hHook, nCode, wParam, lParam); + + // フックを解除する。 + WinAPI.UnhookWindowsHookEx(hHook); + hHook = IntPtr.Zero; + + return result; + + } + else + { + return WinAPI.CallNextHookEx(hHook, nCode, wParam, lParam); + } + } + } + + internal class WinAPI + { + [DllImport("user32.dll")] + public static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex); + [DllImport("kernel32.dll")] + public static extern IntPtr GetCurrentThreadId(); + [DllImport("user32.dll")] + public static extern IntPtr SetWindowsHookEx(int idHook, HOOKPROC lpfn, IntPtr hInstance, IntPtr threadId); + [DllImport("user32.dll")] + public static extern bool UnhookWindowsHookEx(IntPtr hHook); + [DllImport("user32.dll")] + public static extern IntPtr CallNextHookEx(IntPtr hHook, int nCode, IntPtr wParam, IntPtr lParam); + [DllImport("user32.dll")] + public static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); + [DllImport("user32.dll")] + public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect); + + public delegate IntPtr HOOKPROC(int nCode, IntPtr wParam, IntPtr lParam); + + public const int GWL_HINSTANCE = (-6); + public const int WH_CBT = 5; + public const int HCBT_ACTIVATE = 5; + + public const int SWP_NOSIZE = 0x0001; + public const int SWP_NOZORDER = 0x0004; + public const int SWP_NOACTIVATE = 0x0010; + + public struct RECT + { + public RECT(int inLeft, int inTop, int inRight, int inBottom) + { + Left = inLeft; + Top = inTop; + Right = inRight; + Bottom = inBottom; + } + + public int Left; + public int Top; + public int Right; + public int Bottom; + } + } +} diff --git a/Code/CSRender/CSRender/FilePathSelect.cs b/Code/CSRender/CSRender/FilePathSelect.cs new file mode 100644 index 0000000..31b0d64 --- /dev/null +++ b/Code/CSRender/CSRender/FilePathSelect.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Windows.Controls.Primitives; +using System.Text.RegularExpressions; +using Microsoft.Win32; +using MSAPI = Microsoft.WindowsAPICodePack; + +namespace CSRender +{ + public partial class MainWindow : Window + { + //フォルダ指定のためにファイルをドラッグ + private void textBox_PreviewDragOver(object sender, System.Windows.DragEventArgs e) + { + if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop, true)) + { + e.Effects = System.Windows.DragDropEffects.Copy; + } + else + { + e.Effects = System.Windows.DragDropEffects.None; + } + e.Handled = true; + } + + //エクスプローラーからテキストボックスにドロップして指定フォルダの場所をペースト + private void TargetBox_Drop(object sender, System.Windows.DragEventArgs e) + { + var dropFiles = e.Data.GetData(System.Windows.DataFormats.FileDrop) as string[]; + if (dropFiles == null) return; + //カーソルを終端に置く + targetBox.Text = dropFiles[0]; + targetBox.Focus(); + targetBox.Select(this.targetBox.Text.Length, 0); + } + private void RefBox_Drop(object sender, System.Windows.DragEventArgs e) + { + var dropFiles = e.Data.GetData(System.Windows.DataFormats.FileDrop) as string[]; + if (dropFiles == null) return; + //カーソルを終端に置く + referenceBox.Text = dropFiles[0]; + referenceBox.Focus(); + referenceBox.Select(this.referenceBox.Text.Length, 0); + } + private void WorkBox_Drop(object sender, System.Windows.DragEventArgs e) + { + var dropFiles = e.Data.GetData(System.Windows.DataFormats.FileDrop) as string[]; + if (dropFiles == null) return; + //カーソルを終端に置く + workBox.Text = dropFiles[0]; + workBox.Focus(); + workBox.Select(this.workBox.Text.Length, 0); + } + + //参照ボタンClickでフォルダ選択のダイアログを表示(対象フォルダ) + private void TagetButton_Click(object sender, RoutedEventArgs e) + { + //ファイル選択の場合 + //var selectFile = new OpenFileDialog(); + //selectFile.Title = "ファイルを選択してください"; + //selectFile.InitialDirectory = @"C:"; + //if ((bool)selectFile.ShowDialog()) + //{ + //FileName = selectFile.FileName; + //FileSelected(this, new EventArgs()); + //} + + //フォルダ選択の場合 + var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); + selectFile.IsFolderPicker = true; + selectFile.Title = "フォルダを選択してください"; + selectFile.InitialDirectory = @"C:"; + if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok) + { + return; + } + //共通部分 + targetBox.Text = selectFile.FileName; + } + + //参照ボタンClickでフォルダ選択のダイアログを表示(リファレンスフォルダ) + private void ReferenceButton_Click(object sender, RoutedEventArgs e) + { + //ファイル選択の場合 + //var selectFile = new OpenFileDialog(); + //selectFile.Title = "ファイルを選択してください"; + //selectFile.InitialDirectory = @"C:"; + //if ((bool)selectFile.ShowDialog()) + //{ + //FileName = selectFile.FileName; + //FileSelected(this, new EventArgs()); + //} + + //フォルダ選択の場合 + var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); + selectFile.IsFolderPicker = true; + selectFile.Title = "フォルダを選択してください"; + selectFile.InitialDirectory = @"C:"; + if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok) + { + return; + } + //共通部分 + referenceBox.Text = selectFile.FileName; + } + + //参照ボタンClickでフォルダ選択のダイアログを表示(作業フォルダ) + private void WorkButton_Click(object sender, RoutedEventArgs e) + { + //ファイル選択の場合 + //var selectFile = new OpenFileDialog(); + //selectFile.Title = "ファイルを選択してください"; + //selectFile.InitialDirectory = @"C:"; + //if ((bool)selectFile.ShowDialog()) + //{ + //FileName = selectFile.FileName; + //FileSelected(this, new EventArgs()); + //} + + //フォルダ選択の場合 + var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); + selectFile.IsFolderPicker = true; + selectFile.Title = "フォルダを選択してください"; + selectFile.InitialDirectory = @"C:"; + if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok) + { + return; + } + //共通部分 + workBox.Text = selectFile.FileName; + } + } +} diff --git a/Code/CSRender/CSRender/MainWindow.xaml b/Code/CSRender/CSRender/MainWindow.xaml new file mode 100644 index 0000000..d0441a9 --- /dev/null +++ b/Code/CSRender/CSRender/MainWindow.xaml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + +