- progressBar.Step = 100 / queue.count();\r
- Thread theQ = new Thread(startProc);\r
- theQ.IsBackground = true;\r
- theQ.Start();\r
- }\r
- catch (Exception exc)\r
- {\r
- MessageBox.Show(exc.ToString());\r
- }\r
- }\r
- }\r
-\r
- // Starts the encoding process\r
- private void startProc(object state)\r
- {\r
- try\r
- {\r
- // Run through each item on the queue\r
- while (queue.count() != 0)\r
- {\r
- string query = queue.getNextItemForEncoding();\r
- queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file\r
-\r
- setEncValue();\r
- if (this.Created)\r
- updateUIElements();\r
-\r
- hbProc = cliObj.runCli(this, query);\r
-\r
- hbProc.WaitForExit();\r
- cliObj.addCLIQueryToLog(query);\r
- cliObj.copyLog(query, queue.getLastQuery().Destination);\r
-\r
- hbProc.Close();\r
- hbProc.Dispose();\r
- hbProc = null;\r
- query = "";\r
-\r
- if (cancel == true)\r
- {\r
- break;\r
- }\r
- }\r
-\r
- resetQueue();\r
- mainWindow.setEncodeStatus(0); // Tell the main window encodes have finished.\r
-\r
- // After the encode is done, we may want to shutdown, suspend etc.\r
- cliObj.afterEncodeAction();\r
- }\r
- catch (Exception exc)\r
- {\r
- MessageBox.Show(exc.ToString());\r
- }\r
- }\r
-\r
- // Reset's the window to the default state.\r
- private void resetQueue()\r
- {\r
- try\r
- {\r
- if (this.InvokeRequired)\r
- {\r
- this.BeginInvoke(new ProgressUpdateHandler(resetQueue));\r
- return;\r
-\r