Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
QuestionDebug Help Pin
gmhanna7-Dec-05 9:22
gmhanna7-Dec-05 9:22 
AnswerRe: Debug Help Pin
Judah Gabriel Himango7-Dec-05 10:37
sponsorJudah Gabriel Himango7-Dec-05 10:37 
GeneralRe: Debug Help Pin
gmhanna8-Dec-05 5:40
gmhanna8-Dec-05 5:40 
Questionfailure of the code when the mouse go out of the picturebox area Pin
haytham_mohammad7-Dec-05 8:46
haytham_mohammad7-Dec-05 8:46 
AnswerRe: failure of the code when the mouse go out of the picturebox area Pin
Judah Gabriel Himango7-Dec-05 10:39
sponsorJudah Gabriel Himango7-Dec-05 10:39 
GeneralRe: failure of the code when the mouse go out of the picturebox area Pin
haytham_mohammad7-Dec-05 11:19
haytham_mohammad7-Dec-05 11:19 
GeneralRe: failure of the code when the mouse go out of the picturebox area Pin
Judah Gabriel Himango7-Dec-05 15:09
sponsorJudah Gabriel Himango7-Dec-05 15:09 
Questionasychronicly downloading files Pin
stassaf7-Dec-05 8:34
stassaf7-Dec-05 8:34 
Hi,

I'm trying to download several files at the same time in order to increase
performance.
I've tried to define a method that downloads a file, delegate this method and
call BeginInvoke in a loop.
The problem is that every BeginInvoke returns an IAsyncResult and I don't know
how to figure out when all the calls for this methods where completed.

My Code:
public class AsyncDemo
{
// The method to be executed asynchronously.
public bool TestMethod(string fileAdd, string fileName, out int threadId)
{
threadId = AppDomain.GetCurrentThreadId();
try
{
WebClient Client = new WebClient ();
Client.DownloadFile(fileAdd, fileName);
}
catch(Exception ex)
{
return false;
}
return true;
}
}

public delegate bool AsyncDelegate(string fileAdd, string fileName, out int threadId);

static void Main(string[] args)
{
//files to download
string[] fileUrlArr = new string[2];
string[] fileNameArr = new string[2];
fileUrlArr[0] = "http://www.site1.com/xxx.xml";
fileNameArr[0] = "file1.xml";
fileUrlArr[1] = "http://www.site2.com/xxx.xml";
fileNameArr[1] = "file2.xml";
int threadId;

// Create an instance of the test class.
AsyncDemo ad = new AsyncDemo();

// Create the delegate.
AsyncDelegate dlgt = new AsyncDelegate(ad.TestMethod);
IAsyncResult ar=null;

for(int i=0; i<2; i++)
{
// Initiate the asychronous call.
ar = dlgt.BeginInvoke(fileUrlArr[i], fileNameArr[i],out threadId, null, null);
}

ar.AsyncWaitHandle.WaitOne();
}

Any help will be appreciated.
Best Regards,
Assaf
AnswerRe: asychronicly downloading files Pin
Judah Gabriel Himango7-Dec-05 10:43
sponsorJudah Gabriel Himango7-Dec-05 10:43 
GeneralRe: asychronicly downloading files Pin
stassaf7-Dec-05 11:44
stassaf7-Dec-05 11:44 
Questionwhich column in a datarow? Pin
melanieab7-Dec-05 8:09
melanieab7-Dec-05 8:09 
Questionhow to call excel from a asp.net page specifing a file to open? Pin
Sasuko7-Dec-05 5:12
Sasuko7-Dec-05 5:12 
AnswerRe: how to call excel from a asp.net page specifing a file to open? Pin
J4amieC7-Dec-05 5:55
J4amieC7-Dec-05 5:55 
AnswerRe: how to call excel from a asp.net page specifing a file to open? Pin
Sasuko7-Dec-05 5:56
Sasuko7-Dec-05 5:56 
QuestionWinForms User Control in VB6 App Pin
Paul Gates7-Dec-05 5:05
Paul Gates7-Dec-05 5:05 
AnswerRe: WinForms User Control in VB6 App Pin
miah alom7-Dec-05 6:55
miah alom7-Dec-05 6:55 
QuestionComponent and ServicedComponent Pin
faviochilo7-Dec-05 4:39
faviochilo7-Dec-05 4:39 
QuestionHow to make pretty forms in VS Pin
mehrdadc487-Dec-05 2:34
mehrdadc487-Dec-05 2:34 
AnswerRe: How to make pretty forms in VS Pin
Judah Gabriel Himango7-Dec-05 4:04
sponsorJudah Gabriel Himango7-Dec-05 4:04 
QuestionCustom Titlebar Pin
PHDENG817-Dec-05 2:15
PHDENG817-Dec-05 2:15 
QuestionIn java for xml binding zews framework is used ,let me know in C#.net? Pin
sridevi20057-Dec-05 1:28
sridevi20057-Dec-05 1:28 
QuestionHow to get PeakWorkingSet property after process exited? Pin
m3rlinez7-Dec-05 1:19
m3rlinez7-Dec-05 1:19 
QuestionTo access and print the values in Hashtable? Pin
MudkiSekhon7-Dec-05 1:16
MudkiSekhon7-Dec-05 1:16 
AnswerRe: To access and print the values in Hashtable? Pin
Maqsood Ahmed7-Dec-05 1:46
Maqsood Ahmed7-Dec-05 1:46 
GeneralRe: To access and print the values in Hashtable? Pin
MudkiSekhon7-Dec-05 2:14
MudkiSekhon7-Dec-05 2:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.