+\r
+ this.mainWindow = mw;\r
+\r
+ this.queue = q;\r
+ queue.EncodeStarted += new EventHandler(QueueOnEncodeStart);\r
+ queue.QueueCompleted += new EventHandler(QueueOnQueueFinished);\r
+ queue.QueuePauseRequested += new EventHandler(QueueOnPaused);\r
+ }\r
+\r
+ private void QueueOnPaused(object sender, EventArgs e)\r
+ {\r
+ SetUIEncodeFinished();\r
+ UpdateUIElements();\r
+ }\r
+\r
+ private void QueueOnQueueFinished(object sender, EventArgs e)\r
+ {\r
+ SetUIEncodeFinished();\r
+ ResetQueue(); // Reset the Queue Window\r
+ }\r
+\r
+ private void QueueOnEncodeStart(object sender, EventArgs e)\r
+ {\r
+ SetUIEncodeStarted(); // make sure the UI is set correctly\r
+ SetCurrentEncodeInformation();\r
+ UpdateUIElements(); // 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
+ UpdateUIElements();\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
+ // Activate();\r
+ }\r
+\r
+ // Start and Stop Controls\r
+ private void btn_encode_Click(object sender, EventArgs e)\r
+ {\r
+ if (queue.PauseRequested)\r
+ {\r
+ SetUIEncodeStarted();\r
+ MessageBox.Show("Encoding restarted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
+ }\r
+\r
+ if (!queue.IsEncoding)\r
+ queue.Start();\r
+ }\r
+\r
+ private void btn_pause_Click(object sender, EventArgs e)\r
+ {\r
+ queue.Pause();\r
+ SetUIEncodeFinished();\r
+ ResetQueue();\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
+\r
+ // Window Display Management\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