+ SetUiEncodeFinished();\r
+ ResetQueue(); // Reset the Queue Window\r
+ }\r
+\r
+ /// <summary>\r
+ /// Handle the Encode Started event\r
+ /// </summary>\r
+ /// <param name="sender">\r
+ /// The sender.\r
+ /// </param>\r
+ /// <param name="e">\r
+ /// The e.\r
+ /// </param>\r
+ private void QueueOnEncodeStart(object sender, EventArgs e)\r
+ {\r
+ SetUiEncodeStarted(); // make sure the UI is set correctly\r
+ UpdateUiElementsOnQueueChange(); // Redraw the Queue, a new encode has started.\r
+ }\r
+\r
+ /// <summary>\r
+ /// Initializes the Queue list with the Arraylist from the Queue class\r
+ /// </summary>\r
+ public void SetQueue()\r
+ {\r
+ UpdateUiElementsOnQueueChange();\r
+ }\r
+\r
+ /// <summary>\r
+ /// Initializes the Queue list, then shows and activates the window\r
+ /// </summary>\r
+ public new void Show()\r
+ {\r
+ Show(true);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Initializes the Queue list only if doSetQueue is true, then shows and activates the window\r
+ /// </summary>\r
+ /// <param name="doSetQueue">Indicates whether to call setQueue() before showing the window</param>\r
+ public void Show(bool doSetQueue)\r
+ {\r
+ if (doSetQueue) SetQueue();\r
+ base.Show();\r
+ }\r
+\r
+ /// <summary>\r
+ /// Handle the Encode button Click event\r
+ /// </summary>\r
+ /// <param name="sender">The sender</param>\r
+ /// <param name="e">the EventArgs</param>\r
+ private void BtnEncodeClick(object sender, EventArgs e)\r
+ {\r
+ if (queue.Paused)\r
+ {\r
+ SetUiEncodeStarted();\r
+ }\r
+\r
+ lbl_encodeStatus.Text = "Encoding ...";\r
+ queue.Start();\r
+ }\r
+\r
+ /// <summary>\r
+ /// Handle the Pause button click event.\r
+ /// </summary>\r
+ /// <param name="sender">\r
+ /// The sender.\r
+ /// </param>\r
+ /// <param name="e">\r
+ /// The EventArgs.\r
+ /// </param>\r
+ private void BtnPauseClick(object sender, EventArgs e)\r
+ {\r
+ queue.Pause();\r
+ MessageBox.Show(\r
+ "No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode' when you wish to continue encoding the queue.",\r
+ "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ }\r
+\r
+ // UI Work\r
+\r
+ /// <summary>\r
+ /// Setup the UI to show that an encode has started\r
+ /// </summary>\r
+ private void SetUiEncodeStarted()\r
+ {\r
+ if (InvokeRequired)\r
+ {\r
+ BeginInvoke(new UpdateHandler(SetUiEncodeStarted));\r
+ return;\r
+ }\r
+ btn_encode.Enabled = false;\r
+ btn_pause.Visible = true;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Setup the UI to indicate that an encode has finished.\r
+ /// </summary>\r
+ private void SetUiEncodeFinished()\r
+ {\r
+ if (InvokeRequired)\r
+ {\r
+ BeginInvoke(new UpdateHandler(SetUiEncodeFinished));\r
+ return;\r
+ }\r
+ btn_pause.Visible = false;\r
+ btn_encode.Enabled = true;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Reset the Queue Window display\r
+ /// </summary>\r
+ private void ResetQueue()\r
+ {\r
+ if (InvokeRequired)\r
+ {\r
+ BeginInvoke(new UpdateHandler(ResetQueue));\r
+ return;\r
+ }\r
+ btn_pause.Visible = false;\r
+ btn_encode.Enabled = true;\r
+\r
+ ResetEncodeText();\r
+ }\r
+\r
+ /// <summary>\r
+ /// Reset the current job text\r
+ /// </summary>\r
+ private void ResetEncodeText()\r
+ {\r
+ if (InvokeRequired)\r
+ {\r
+ BeginInvoke(new UpdateHandler(ResetEncodeText));\r
+ return;\r
+ }\r
+ lbl_encodeStatus.Text = "Ready";\r
+\r
+ lbl_source.Text = "-";\r
+ lbl_dest.Text = "-";\r
+ lbl_encodeOptions.Text = "-";\r
+\r
+ lbl_encodesPending.Text = list_queue.Items.Count + " encode(s) pending";\r
+ }\r
+\r
+ /// <summary>\r
+ /// Redraw the Queue window with the latest information about HandBrakes status\r
+ /// </summary>\r
+ private void RedrawQueue()\r
+ {\r
+ if (InvokeRequired)\r
+ {\r
+ BeginInvoke(new UpdateHandler(RedrawQueue));\r
+ return;\r
+ }\r
+\r
+ list_queue.Items.Clear();\r
+ ReadOnlyCollection<Job> theQueue = queue.CurrentQueue;\r
+ foreach (Job queueItem in theQueue)\r