All pastes #371596 Raw Edit

Untitled

public text v1 · immutable
#371596 ·published 2007-02-25 14:03 UTC
rendered paste body
(below code from an event triggered by a button_clicked event)

Thread thread;
				
ThreadStart download = new ThreadStart ( vDownload );
thread = new Thread ( download );
//thread.Priority.Highest();
thread.Start ( );
		
ThreadStart apb1 = new ThreadStart ( AdjustProgressBar1 );
thread = new Thread ( apb1 );
//thread.Priority.Normal();
thread.Start ( );

(there's more of the button clicked code but mostly commented out)

protected virtual void vDownload()
	{
		try
		{
			StreamWriter GenerateScript = new StreamWriter ( "download.sh" );
			GenerateScript.WriteLine ( "#!/bin/bash" );
			GenerateScript.WriteLine ( "mkdir temp" );
			GenerateScript.WriteLine ( "cd temp" );
			GenerateScript.WriteLine ( "wget {0}", ENURL.Text );
			GenerateScript.Close ( );
					
			ProcessStartInfo ExeScript = new ProcessStartInfo ( );
			ExeScript.FileName = "chmod";
			ExeScript.Arguments = "+x download.sh";
			Process process = Process.Start ( ExeScript );
			process.WaitForExit ( );
			process.Close ( );
					
			ProcessStartInfo RunScript = new ProcessStartInfo ( );
			RunScript.FileName = "sh";
			RunScript.Arguments = "download.sh";
			Process process2 = Process.Start ( RunScript );
			process2.WaitForExit ( );
			process2.Close ( );
		}
		
		catch (Exception ex)
		{
			ENInfo.Text = ex.Message;
		}
	}

	protected void AdjustProgressBar1 ( )
	{
		PBStatus.Fraction = 0.20;
	}