private delegate void ProgressUpdateHandler();\r
private delegate void setEncoding();\r
Functions.Encode cliObj = new Functions.Encode();\r
- Boolean cancel = false;\r
+ Boolean paused = false;\r
Process hbProc = null;\r
Queue.Queue queue;\r
frmMain mainWindow = null;\r
+ Thread theQ;\r
\r
public frmQueue(frmMain main)\r
{\r
/// </summary>\r
public void frmMain_encode()\r
{\r
- cancel = false;\r
+ paused = false;\r
// Start the encode\r
try\r
{\r
{\r
if (queue.count() != 0)\r
{\r
- btn_encode.Enabled = false;\r
- mainWindow.setLastAction("encode");\r
- mainWindow.setEncodeStatus(1);\r
-\r
- cancel = false;\r
-\r
- // Start the encode\r
- try\r
+ if (paused == true)\r
{\r
- // Setup or reset some values\r
+ paused = false;\r
btn_encode.Enabled = false;\r
btn_stop.Visible = true;\r
-\r
- Thread theQ = new Thread(startProc);\r
- theQ.IsBackground = true;\r
- theQ.Start();\r
+ MessageBox.Show("Encoding will now continue!","Info", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
}\r
- catch (Exception exc)\r
+ else\r
{\r
- MessageBox.Show(exc.ToString());\r
+ paused = false;\r
+ btn_encode.Enabled = false;\r
+ mainWindow.setLastAction("encode");\r
+ mainWindow.setEncodeStatus(1);\r
+\r
+ // Start the encode\r
+ try\r
+ {\r
+ // Setup or reset some values\r
+ btn_encode.Enabled = false;\r
+ btn_stop.Visible = true;\r
+\r
+ 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
hbProc = null;\r
query = "";\r
\r
- if (cancel == true)\r
+ while (paused == true) // Need to find a better way of doing this.\r
{\r
- break;\r
+ Thread.Sleep(10000);\r
}\r
}\r
\r
// Stop's the queue from continuing. \r
private void btn_stop_Click(object sender, EventArgs e)\r
{\r
- cancel = true;\r
+ paused = true;\r
btn_stop.Visible = false;\r
btn_encode.Enabled = true;\r
MessageBox.Show("No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode Video' when you wish to continue encoding the queue.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r