--- /dev/null
+using System;\r
+using System.Collections.Generic;\r
+using System.Text;\r
+using System.Diagnostics;\r
+\r
+namespace Handbrake.CLI\r
+{\r
+ /// <summary>\r
+ /// still workin on this\r
+ /// </summary>\r
+ class Manager\r
+ {\r
+ private static Queue<Process> m_processQueue = new Queue<Process>();\r
+\r
+ public static void Enqueue(object s)\r
+ {\r
+ //TODO: create new Process object from passed \r
+ }\r
+ }\r
+}\r
\r
public override string ToString()\r
{\r
- return string.Format("{0} ({1}:{2}:{3})", this.m_titleNumber, this.m_duration.Hours, \r
+ return string.Format("{0} ({1:00}:{2:00}:{3:00})", this.m_titleNumber, this.m_duration.Hours, \r
this.m_duration.Minutes, this.m_duration.Seconds);\r
}\r
\r
{\r
public partial class frmQueue : Form\r
{\r
- private delegate void ProgressUpdateHandler(int progressSplit);\r
+ private delegate void ProgressUpdateHandler();\r
\r
public frmQueue()\r
{\r
{\r
progressBar.Value = 0;\r
lbl_progressValue.Text = "0 %";\r
+ progressBar.Step = 100 / list_queue.Items.Count;\r
progressBar.Update();\r
ThreadPool.QueueUserWorkItem(startProc);\r
}\r
\r
private void startProc(object state)\r
{\r
- int listSize = list_queue.Items.Count;\r
- listSize--;\r
- int counter = 0;\r
- int progressSplit = listSize / 100;\r
-\r
- while (counter <= listSize)\r
+ for (int i = 0; i < list_queue.Items.Count; i++)\r
{\r
- String query = list_queue.Items[0].ToString();\r
-\r
+ string query = list_queue.Items[i] as string;\r
Process hbProc = new Process();\r
hbProc.StartInfo.FileName = "hbcli.exe";\r
hbProc.StartInfo.Arguments = query;\r
hbProc.Start();\r
\r
// Set the process Priority\r
- string priority = Properties.Settings.Default.processPriority;\r
- switch (priority)\r
+\r
+ switch (Properties.Settings.Default.processPriority)\r
{\r
case "Realtime":\r
hbProc.PriorityClass = ProcessPriorityClass.RealTime;\r
\r
hbProc.WaitForExit();\r
hbProc.Close();\r
- counter++;\r
\r
- updateUIElements(progressSplit);\r
+ updateUIElements();\r
}\r
}\r
\r
- private void updateUIElements(int progressSplit)\r
+ private void updateUIElements()\r
{\r
if (this.InvokeRequired)\r
{\r
- this.BeginInvoke(new ProgressUpdateHandler(updateUIElements), new object[] { progressSplit });\r
+ this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));\r
return;\r
}\r
\r
- this.list_queue.Items.Remove(0);\r
- progressBar.Value = progressBar.Value + progressSplit;\r
+ this.list_queue.Items.RemoveAt(0);\r
+ progressBar.PerformStep();\r
+ lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);\r
progressBar.Update();\r
}\r
}\r