diff options
-rw-r--r-- | win/C#/frmQueue.Designer.cs | 39 | ||||
-rw-r--r-- | win/C#/frmQueue.cs | 85 | ||||
-rw-r--r-- | win/C#/frmQueue.resx | 3 | ||||
-rw-r--r-- | win/C#/frmReadDVD.Designer.cs | 1 |
4 files changed, 110 insertions, 18 deletions
diff --git a/win/C#/frmQueue.Designer.cs b/win/C#/frmQueue.Designer.cs index 1e29450ed..1c809e18e 100644 --- a/win/C#/frmQueue.Designer.cs +++ b/win/C#/frmQueue.Designer.cs @@ -28,6 +28,7 @@ namespace Handbrake /// </summary>
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmQueue));
this.btn_down = new System.Windows.Forms.Button();
this.btn_up = new System.Windows.Forms.Button();
@@ -41,6 +42,9 @@ namespace Handbrake this.label1 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label3 = new System.Windows.Forms.Label();
+ this.btn_cancel = new System.Windows.Forms.Button();
+ this.lbl_status = new System.Windows.Forms.Label();
+ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
@@ -189,12 +193,44 @@ namespace Handbrake this.label3.TabIndex = 39;
this.label3.Text = "Queue";
//
+ // btn_cancel
+ //
+ this.btn_cancel.BackColor = System.Drawing.SystemColors.ControlLight;
+ this.btn_cancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
+ this.btn_cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btn_cancel.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn_cancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.btn_cancel.Location = new System.Drawing.Point(143, 302);
+ this.btn_cancel.Name = "btn_cancel";
+ this.btn_cancel.Size = new System.Drawing.Size(91, 22);
+ this.btn_cancel.TabIndex = 41;
+ this.btn_cancel.TabStop = false;
+ this.btn_cancel.Text = "Stop Queue";
+ this.toolTip1.SetToolTip(this.btn_cancel, "This will prevent any more encode processes from starting. It will not stop the c" +
+ "urrent process!");
+ this.btn_cancel.UseVisualStyleBackColor = false;
+ this.btn_cancel.Visible = false;
+ this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
+ //
+ // lbl_status
+ //
+ this.lbl_status.AutoSize = true;
+ this.lbl_status.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lbl_status.Location = new System.Drawing.Point(260, 268);
+ this.lbl_status.Name = "lbl_status";
+ this.lbl_status.Size = new System.Drawing.Size(176, 13);
+ this.lbl_status.TabIndex = 42;
+ this.lbl_status.Text = "Encode Queue Completed!";
+ this.lbl_status.Visible = false;
+ //
// frmQueue
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLight;
this.ClientSize = new System.Drawing.Size(723, 332);
+ this.Controls.Add(this.lbl_status);
+ this.Controls.Add(this.btn_cancel);
this.Controls.Add(this.label1);
this.Controls.Add(this.label3);
this.Controls.Add(this.pictureBox1);
@@ -232,5 +268,8 @@ namespace Handbrake private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
+ internal System.Windows.Forms.Button btn_cancel;
+ private System.Windows.Forms.Label lbl_status;
+ private System.Windows.Forms.ToolTip toolTip1;
}
}
\ No newline at end of file diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 117bb147f..bec77f402 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -21,13 +21,21 @@ namespace Handbrake }
#region Queue Handling
-
+ Boolean cancel = false;
private void btn_q_encoder_Click(object sender, EventArgs e)
{
+ // Reset some values
+
+ lbl_status.Visible = false;
+ cancel = false;
+
+ // Start the encode
try
{
if (list_queue.Items.Count != 0)
{
+ // Setup or reset some values
+ btn_cancel.Visible = true;
progressBar.Value = 0;
lbl_progressValue.Text = "0 %";
progressBar.Step = 100 / list_queue.Items.Count;
@@ -41,6 +49,12 @@ namespace Handbrake }
}
+ private void btn_cancel_Click(object sender, EventArgs e)
+ {
+ cancel = true;
+ btn_cancel.Visible = false;
+ 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);
+ }
[DllImport("user32.dll")]
public static extern void LockWorkStation();
@@ -54,6 +68,7 @@ namespace Handbrake while (list_queue.Items.Count != 0)
{
string query = list_queue.Items[0].ToString();
+
updateUIElements();
Functions.CLI process = new Functions.CLI();
@@ -62,9 +77,18 @@ namespace Handbrake hbProc.WaitForExit();
hbProc.Close();
hbProc.Dispose();
+
+ query = "";
+
+ if (cancel == true)
+ {
+ break;
+ }
+
}
resetQueue();
+
// Do something whent he encode ends.
switch (Properties.Settings.Default.CompletionOption)
@@ -90,8 +114,6 @@ namespace Handbrake default:
break;
}
-
- MessageBox.Show("Encode Queue Completed!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
catch (Exception exc)
{
@@ -101,28 +123,55 @@ namespace Handbrake private void updateUIElements()
{
- if (this.InvokeRequired)
+ try
{
- this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
- return;
- }
- this.list_queue.Items.RemoveAt(0);
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
+ return;
+ }
+ this.list_queue.Items.RemoveAt(0);
- progressBar.PerformStep();
- lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
- progressBar.Update();
+ progressBar.PerformStep();
+ lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
+ progressBar.Update();
+ }
+ catch (Exception exc)
+ {
+ MessageBox.Show(exc.ToString());
+ }
}
private void resetQueue()
{
- if (this.InvokeRequired)
+ try
+ {
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new ProgressUpdateHandler(resetQueue));
+ return;
+ }
+
+ if (cancel == true)
+ {
+ lbl_status.Visible = true;
+ lbl_status.Text = "Encode Queue Cancelled!";
+ }
+ else
+ {
+ lbl_status.Visible = true;
+ lbl_status.Text = "Encode Queue Completed!";
+ }
+ btn_cancel.Visible = false;
+
+ lbl_progressValue.Text = "0 %";
+ progressBar.Value = 0;
+ progressBar.Update();
+ }
+ catch (Exception exc)
{
- this.BeginInvoke(new ProgressUpdateHandler(resetQueue));
- return;
+ MessageBox.Show(exc.ToString());
}
- lbl_progressValue.Text = "0 %";
- progressBar.Value = 0;
- progressBar.Update();
}
#endregion
@@ -181,5 +230,7 @@ namespace Handbrake base.OnClosing(e);
}
+
+
}
}
\ No newline at end of file diff --git a/win/C#/frmQueue.resx b/win/C#/frmQueue.resx index 37f92905a..2ddcb6921 100644 --- a/win/C#/frmQueue.resx +++ b/win/C#/frmQueue.resx @@ -117,6 +117,9 @@ <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
diff --git a/win/C#/frmReadDVD.Designer.cs b/win/C#/frmReadDVD.Designer.cs index e2395fcbf..0d3384154 100644 --- a/win/C#/frmReadDVD.Designer.cs +++ b/win/C#/frmReadDVD.Designer.cs @@ -81,7 +81,6 @@ namespace Handbrake this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(538, 113);
this.Name = "frmReadDVD";
- this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Reading DVD...";
this.TopMost = true;
|