diff options
Diffstat (limited to 'win/C#')
-rw-r--r-- | win/C#/Functions/Encode.cs | 20 | ||||
-rw-r--r-- | win/C#/frmActivityWindow.cs | 6 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 8 |
3 files changed, 22 insertions, 12 deletions
diff --git a/win/C#/Functions/Encode.cs b/win/C#/Functions/Encode.cs index a6bfd263a..d5c6577e5 100644 --- a/win/C#/Functions/Encode.cs +++ b/win/C#/Functions/Encode.cs @@ -49,27 +49,31 @@ namespace Handbrake.Functions isEncoding = true;
currentQuery = query;
- // Set the process Priority
- if (hbProc != null)
+ // Set the process Priority
+ Process hbCliProcess = null;
+ if (processID != -1)
+ hbCliProcess = Process.GetProcessById(processID);
+
+ if (hbCliProcess != null)
switch (Properties.Settings.Default.processPriority)
{
case "Realtime":
- hbProc.PriorityClass = ProcessPriorityClass.RealTime;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.RealTime;
break;
case "High":
- hbProc.PriorityClass = ProcessPriorityClass.High;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.High;
break;
case "Above Normal":
- hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
break;
case "Normal":
- hbProc.PriorityClass = ProcessPriorityClass.Normal;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.Normal;
break;
case "Low":
- hbProc.PriorityClass = ProcessPriorityClass.Idle;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.Idle;
break;
default:
- hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
break;
}
}
diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs index d2d1ff17a..dc979f28e 100644 --- a/win/C#/frmActivityWindow.cs +++ b/win/C#/frmActivityWindow.cs @@ -22,11 +22,12 @@ namespace Handbrake Queue.QueueHandler encodeQueue;
int position; // Position in the arraylist reached by the current log output in the rtf box.
string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
+ private frmMain mainWin;
/// <summary>
/// This window should be used to display the RAW output of the handbrake CLI which is produced during an encode.
/// </summary>
- public frmActivityWindow(string file, Queue.QueueHandler eh)
+ public frmActivityWindow(string file, Queue.QueueHandler eh, frmMain mw)
{
InitializeComponent();
@@ -34,6 +35,7 @@ namespace Handbrake encodeQueue = eh;
read_file = file;
position = 0;
+ mainWin = mw;
// When the window closes, we want to abort the monitor thread.
this.Disposed += new EventHandler(forceQuit);
@@ -111,7 +113,7 @@ namespace Handbrake updateTextFromThread();
while (true)
{
- if (encodeQueue.isEncoding)
+ if (encodeQueue.isEncoding || mainWin.isScanning)
updateTextFromThread();
else
{
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 02fe25a1e..fa004ea4c 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -256,7 +256,7 @@ namespace Handbrake String file;
file = lastAction == "scan" ? "last_scan_log.txt" : "last_encode_log.txt";
- frmActivityWindow dvdInfoWindow = new frmActivityWindow(file, encodeQueue);
+ frmActivityWindow dvdInfoWindow = new frmActivityWindow(file, encodeQueue, this);
dvdInfoWindow.Show();
}
private void mnu_options_Click(object sender, EventArgs e)
@@ -632,6 +632,7 @@ namespace Handbrake setEncodeStarted(); // Encode is running, so setup the GUI appropriately
encodeQueue.startEncode(); // Start The Queue Encoding Process
+ this.Focus();
}
else if (text_source.Text == string.Empty || text_source.Text == "Click 'Source' to continue" || text_destination.Text == string.Empty)
MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
@@ -692,7 +693,7 @@ namespace Handbrake {
String file = lastAction == "scan" ? "last_scan_log.txt" : "last_encode_log.txt";
- frmActivityWindow ActivityWindow = new frmActivityWindow(file, encodeQueue);
+ frmActivityWindow ActivityWindow = new frmActivityWindow(file, encodeQueue, this);
ActivityWindow.Show();
}
#endregion
@@ -1608,6 +1609,7 @@ namespace Handbrake // MainWindow Components, Actions and Functions ***********************
#region Source Scan
+ public Boolean isScanning { get; set; }
private static int scanProcessID { get; set; }
private void setupGUIforScan(String filename)
{
@@ -1634,6 +1636,7 @@ namespace Handbrake {
lbl_encode.Visible = true;
lbl_encode.Text = "Scanning...";
+ isScanning = true;
ThreadPool.QueueUserWorkItem(scanProcess, filename);
}
catch (Exception exc)
@@ -1801,6 +1804,7 @@ namespace Handbrake text_destination.Text = "";
thisDVD = null;
selectedTitle = null;
+ isScanning = false;
}
#endregion
|