Click here to Skip to main content
15,895,462 members
Home / Discussions / C#
   

C#

 
AnswerRe: "Event" is null while invoking custom event Pin
Luc Pattyn1-Mar-10 7:49
sitebuilderLuc Pattyn1-Mar-10 7:49 
GeneralRe: "Event" is null while invoking custom event Pin
Arindam Tewary1-Mar-10 7:57
professionalArindam Tewary1-Mar-10 7:57 
GeneralRe: "Event" is null while invoking custom event Pin
DaveyM691-Mar-10 10:32
professionalDaveyM691-Mar-10 10:32 
Questionsafely end a thread Pin
Yustme1-Mar-10 6:54
Yustme1-Mar-10 6:54 
AnswerRe: safely end a thread Pin
Paulo Zemek1-Mar-10 7:07
mvaPaulo Zemek1-Mar-10 7:07 
GeneralRe: safely end a thread Pin
Yustme1-Mar-10 11:45
Yustme1-Mar-10 11:45 
GeneralRe: safely end a thread Pin
Paulo Zemek1-Mar-10 13:53
mvaPaulo Zemek1-Mar-10 13:53 
GeneralRe: safely end a thread Pin
Yustme1-Mar-10 22:31
Yustme1-Mar-10 22:31 
Yes I'm sure. The variable gets checked alright. But it doesn't seem to stop it.

Here is that thread i'm talking about with the code:

private void FileComparerThread()
		{

			while (this.stopRequested != true)
			{

				for (int i = 0; i < Directory.GetFiles(this.dest).Length; i++)
				{
					string[] filePaths = Directory.GetFiles(this.dest, "*.txt");

					for (int j = 0; j < filePaths.Length; j++)
					{ // check if btnCancel has been pressed if so, end this thread.
						if (this.stopRequested != true)
						{
							// check if file names are not the same:
							if (filePaths[i].ToString() != filePaths[j].ToString())
							{
								bool comparedFiles = this.FileCompare(filePaths[i].ToString(), filePaths[j].ToString());

								// move 1 file if they are both the same to another directory
								if (comparedFiles)
									Directory.Move(filePaths[j], Path.Combine(this.dest2, Path.GetFileName(filePaths[j])));
							}
						}

					}
					
					if(filePaths.Length > 3)
						File.Move(filePaths[i], Path.Combine(this.dest, Path.GetFileName(filePaths[i])));
					
					Thread.Sleep(5000);
				}
			}
		}



And then I got a this.FileCompare() function that checks 2 files for equality thats it.

I've done some big time debugging. Its just looping those for statements.
Even though the stopRequested = true.

It's not comming out that for statement.
GeneralRe: safely end a thread Pin
Paulo Zemek2-Mar-10 6:17
mvaPaulo Zemek2-Mar-10 6:17 
GeneralRe: safely end a thread Pin
Yustme2-Mar-10 6:19
Yustme2-Mar-10 6:19 
AnswerRe: safely end a thread Pin
Luc Pattyn1-Mar-10 7:13
sitebuilderLuc Pattyn1-Mar-10 7:13 
GeneralRe: safely end a thread Pin
Yustme1-Mar-10 22:34
Yustme1-Mar-10 22:34 
QuestionHELP on .NET Remoting Pin
jekkup11-Mar-10 6:03
jekkup11-Mar-10 6:03 
AnswerRe: HELP on .NET Remoting Pin
Abhinav S1-Mar-10 6:23
Abhinav S1-Mar-10 6:23 
QuestionClick a button from a external/downloaded (unknown) html Pin
Serenity11-Mar-10 5:36
Serenity11-Mar-10 5:36 
AnswerRe: Click a button from a external/downloaded (unknown) html Pin
Saksida Bojan1-Mar-10 5:41
Saksida Bojan1-Mar-10 5:41 
GeneralRe: Click a button from a external/downloaded (unknown) html Pin
Serenity11-Mar-10 5:55
Serenity11-Mar-10 5:55 
GeneralRe: Click a button from a external/downloaded (unknown) html Pin
Saksida Bojan1-Mar-10 6:04
Saksida Bojan1-Mar-10 6:04 
GeneralRe: Click a button from a external/downloaded (unknown) html Pin
Serenity11-Mar-10 6:27
Serenity11-Mar-10 6:27 
GeneralRe: Click a button from a external/downloaded (unknown) html Pin
Saksida Bojan1-Mar-10 7:06
Saksida Bojan1-Mar-10 7:06 
QuestionPrevent Visual Studio opening the designer on custom controls Pin
Rob Philpott1-Mar-10 5:07
Rob Philpott1-Mar-10 5:07 
AnswerRe: Prevent Visual Studio opening the designer on custom controls Pin
Luc Pattyn1-Mar-10 5:19
sitebuilderLuc Pattyn1-Mar-10 5:19 
GeneralRe: Prevent Visual Studio opening the designer on custom controls Pin
Rob Philpott1-Mar-10 5:35
Rob Philpott1-Mar-10 5:35 
GeneralRe: Prevent Visual Studio opening the designer on custom controls Pin
Luc Pattyn1-Mar-10 5:39
sitebuilderLuc Pattyn1-Mar-10 5:39 
GeneralRe: Prevent Visual Studio opening the designer on custom controls Pin
Som Shekhar1-Mar-10 5:47
Som Shekhar1-Mar-10 5:47 

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.