OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / frmPreview.cs
index 7ea4727..f2356ae 100644 (file)
@@ -4,7 +4,6 @@ using System.Threading;
 using System.Diagnostics;\r
 using System.Runtime.InteropServices;\r
 using System.IO;\r
-using AxQTOControlLib;\r
 using Handbrake.EncodeQueue;\r
 using Handbrake.Functions;\r
 using QTOControlLib;\r
@@ -20,7 +19,6 @@ namespace Handbrake
         private delegate void UpdateUIHandler();\r
         String currently_playing = "";\r
         readonly frmMain mainWindow;\r
-        private Process hbProc;\r
         private Thread player;\r
         private Boolean noQT;\r
 \r
@@ -32,7 +30,7 @@ namespace Handbrake
             }\r
             catch (Exception exc)\r
             {\r
-                MessageBox.Show(mw, "It would appear QuickTime 7 is not installed. QuickTime preview functionality will be disabled! \n\n Debug Info:\n" + exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+                MessageBox.Show(mw, "It would appear QuickTime 7 is not installed or not accessible. QuickTime preview functionality will be disabled! \n\n Debug Info:\n" + exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
                 btn_playQT.Enabled = false;\r
                 noQT = true;\r
             }\r
@@ -59,7 +57,7 @@ namespace Handbrake
             btn_playQT.Enabled = false;\r
             btn_playVLC.Enabled = false;\r
             lbl_status.Text = "Encoding Sample for (VLC) ...";\r
-            String query = hb_common_func.GeneratePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);\r
+            String query = hb_common_func.generatePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);\r
             ThreadPool.QueueUserWorkItem(procMonitor, query);\r
         }\r
         private void btn_playQT_Click(object sender, EventArgs e)\r
@@ -79,19 +77,22 @@ namespace Handbrake
             btn_playQT.Enabled = false;\r
             btn_playVLC.Enabled = false;\r
             lbl_status.Text = "Encoding Sample for (QT) ...";\r
-            String query = hb_common_func.GeneratePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);\r
+            String query = hb_common_func.generatePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);\r
             ThreadPool.QueueUserWorkItem(procMonitor, query);\r
         }\r
         private void procMonitor(object state)\r
         {\r
             // Make sure we are not already encoding and if we are then display an error.\r
-            if (hbProc != null)\r
+            if (process.hbProcess != null)\r
                 MessageBox.Show(this, "Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
             else\r
             {\r
-                hbProc = process.runCli((string)state).hbProcProcess;\r
-                hbProc.WaitForExit();\r
-                hbProc = null;\r
+                process.runCli((string)state);\r
+                if (process.hbProcess != null)\r
+                {\r
+                    process.hbProcess.WaitForExit();\r
+                    process.hbProcess = null;\r
+                }\r
                 encodeCompleted();\r
             }\r
         }\r