diff options
author | sr55 <[email protected]> | 2007-08-22 15:29:49 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2007-08-22 15:29:49 +0000 |
commit | 784d350cf62da4ee14042e573d42765db84ddf1f (patch) | |
tree | 4787f511c70e7f11ea4200f308dd875b2bb0f73b /win/C#/frmReadDVD.cs | |
parent | d869f096d1b32bf2561203551f5fc6d9dd4d18ad (diff) |
WinGui:
- Added debuging / crash prevention code in frmReadDVD.
- Fixed issue with queue when adding items after initial encode.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@849 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmReadDVD.cs')
-rw-r--r-- | win/C#/frmReadDVD.cs | 103 |
1 files changed, 65 insertions, 38 deletions
diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs index d56f0f33d..ca6d23342 100644 --- a/win/C#/frmReadDVD.cs +++ b/win/C#/frmReadDVD.cs @@ -32,30 +32,45 @@ namespace Handbrake private void btn_ok_Click(object sender, EventArgs e)
{
- btn_ok.Enabled = false;
- //btn_skip.Visible = true;
- lbl_pressOk.Visible = false;
- lbl_progress.Text = "0%";
- //lbl_progress.Visible = true;
- lbl_status.Visible = true;
- // throw cli call and parsing on it's own thread
- ThreadPool.QueueUserWorkItem(startProc);
+
+ try
+ {
+ btn_ok.Enabled = false;
+ //btn_skip.Visible = true;
+ lbl_pressOk.Visible = false;
+ lbl_progress.Text = "0%";
+ //lbl_progress.Visible = true;
+ lbl_status.Visible = true;
+ // throw cli call and parsing on it's own thread
+ ThreadPool.QueueUserWorkItem(startProc);
+ }
+ catch(Exception exc)
+ {
+ MessageBox.Show(exc.ToString());
+ }
}
private void updateUIElements()
{
- if (this.InvokeRequired)
+ try
{
- this.BeginInvoke(new UpdateUIHandler(updateUIElements));
- return;
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new UpdateUIHandler(updateUIElements));
+ return;
+ }
+ // Now pass this streamreader to frmMain so that it can be used there.
+ mainWindow.setStreamReader(thisDvd);
+
+ mainWindow.drp_dvdtitle.Items.Clear();
+ mainWindow.drp_dvdtitle.Items.AddRange(thisDvd.Titles.ToArray());
+
+ this.Close();
+ }
+ catch(Exception exc)
+ {
+ MessageBox.Show(exc.ToString());
}
- // Now pass this streamreader to frmMain so that it can be used there.
- mainWindow.setStreamReader(thisDvd);
-
- mainWindow.drp_dvdtitle.Items.Clear();
- mainWindow.drp_dvdtitle.Items.AddRange(thisDvd.Titles.ToArray());
-
- this.Close();
}
Functions.CLI process = new Functions.CLI();
@@ -68,20 +83,27 @@ namespace Handbrake /*
* Quick and Dirty hack to get around the stderr crashes of hbcli. Lets try feeding brians parser text straight from a text file.
*/
- string appPath = Application.StartupPath.ToString();
- appPath = appPath + "\\";
- string strCmdLine = "cmd /c " + '"' + '"' + appPath + "\\hbcli.exe" + '"' + " -i" + '"' + inputFile + '"' + " -t0 >" + '"'+ appPath + "\\dvdinfo.dat" + '"' + " 2>&1" + '"';
- Process hbproc = Process.Start("CMD.exe", strCmdLine);
- hbproc.WaitForExit();
-
-
- StreamReader sr = new StreamReader(appPath + "dvdinfo.dat");
-
- thisDvd = Parsing.DVD.Parse(sr);
-
- sr.Close();
- Console.ReadLine();
- updateUIElements();
+ try
+ {
+ string appPath = Application.StartupPath.ToString();
+ appPath = appPath + "\\";
+ string strCmdLine = "cmd /c " + '"' + '"' + appPath + "\\hbcli.exe" + '"' + " -i" + '"' + inputFile + '"' + " -t0 >" + '"'+ appPath + "\\dvdinfo.dat" + '"' + " 2>&1" + '"';
+ Process hbproc = Process.Start("CMD.exe", strCmdLine);
+ hbproc.WaitForExit();
+
+
+ StreamReader sr = new StreamReader(appPath + "dvdinfo.dat");
+
+ thisDvd = Parsing.DVD.Parse(sr);
+
+ sr.Close();
+ Console.ReadLine();
+ updateUIElements();
+ }
+ catch (Exception exc)
+ {
+ MessageBox.Show(exc.ToString());
+ }
//*********************************************************************************************************************************************
/*
@@ -105,7 +127,7 @@ namespace Handbrake */
}
- private void Parser_OnScanProgress(object Sender, int CurrentTitle, int TitleCount)
+ /*private void Parser_OnScanProgress(object Sender, int CurrentTitle, int TitleCount)
{
if (this.InvokeRequired)
{
@@ -118,14 +140,19 @@ namespace Handbrake progress = 100;
}
this.lbl_progress.Text = progress.ToString() + "%";
- }
+ }*/
private void btn_skip_Click(object sender, EventArgs e)
{
- //process.killCLI();
- this.Close();
- cancel = 1;
+ try
+ {
+ this.Close();
+ cancel = 1;
+ }
+ catch (Exception exc)
+ {
+ MessageBox.Show(exc.ToString());
+ }
}
-
}
}
\ No newline at end of file |