Click here to Skip to main content
15,887,596 members
Home / Discussions / C#
   

C#

 
QuestionInvoke a function every time that a function is been added to my event Pin
bonzaiholding30-Dec-09 1:17
bonzaiholding30-Dec-09 1:17 
AnswerRe: Invoke a function every time that a function is been added to my event Pin
OriginalGriff30-Dec-09 2:01
mveOriginalGriff30-Dec-09 2:01 
AnswerRe: Invoke a function every time that a function is been added to my event Pin
petercrab30-Dec-09 16:56
petercrab30-Dec-09 16:56 
QuestionThreads, speed up calculations Pin
Renven30-Dec-09 1:01
Renven30-Dec-09 1:01 
AnswerRe: Threads, speed up calculations Pin
Rob Philpott30-Dec-09 1:17
Rob Philpott30-Dec-09 1:17 
GeneralRe: Threads, speed up calculations Pin
Renven30-Dec-09 1:31
Renven30-Dec-09 1:31 
AnswerRe: Threads, speed up calculations Pin
Luc Pattyn30-Dec-09 2:01
sitebuilderLuc Pattyn30-Dec-09 2:01 
AnswerCODE Pin
Renven30-Dec-09 2:22
Renven30-Dec-09 2:22 
(how code looks after trying with 7 threads (because captured image is divided in 7 rows)) I have to warn you CODE is not optimized. as example I show you only 2 thread methods: ThreadOneP and ThreadTwoP


public int TransferToMatrixThread()
{
temptest = 0;
CabX = CabX - 18;
CabY = CabY + 53;
CabXX = CabX - 484; //POSSITION
CabYY = CabY + 20;
for (int i = 0; i < 11; i++) //FILLS MATRIX WITH 0
{
for (int j = 0; j < 11; j++)
{
transfered[i, j] = 0;
}
}
ThreadStart ts = new ThreadStart(ThreadOneP);
ThreadStart ts2 = new ThreadStart(ThreadTwoP);
ThreadStart ts3 = new ThreadStart(ThreadThreeP);
ThreadStart ts4 = new ThreadStart(ThreadFourP);
ThreadStart ts5 = new ThreadStart(ThreadFiveP);
ThreadStart ts6 = new ThreadStart(ThreadSixP);
ThreadStart ts7 = new ThreadStart(ThreadSevenP);
Thread thread1 = new Thread(ts);
Thread thread2 = new Thread(ts2);
Thread thread3 = new Thread(ts3);
Thread thread4 = new Thread(ts4);
Thread thread5 = new Thread(ts5);
Thread thread6 = new Thread(ts6);
Thread thread7 = new Thread(ts7);
DateTime startTime = DateTime.Now; //TIME
thread1.Start();
thread2.Start();
thread3.Start();
thread4.Start();
thread5.Start();
thread6.Start();
thread7.Start();

thread1.Join();
thread2.Join();
thread3.Join();
thread4.Join();
thread5.Join();
thread6.Join();
thread7.Join();

DateTime stopTime = DateTime.Now;
TimeSpan duration = stopTime - startTime;
listBox1.Items.Add("7 THREAD = " + duration);

TransfX = currX + CabXX + 9; // norima nustatyti i pav viduri todel pridedamos konstantos
TransfY = currY + CabYY + 11; // norima nustatyti i pav viduri todel pridedamos konstantos
return temptest;
}
public void ThreadOneP()
{
int o = CabYY;
int zy = 8;
int zx = 2;
for (int ok = CabXX; ok < CabXX + 490; ok = ok + 72)
{
var color22 = RGBreturnLVL(ok, o, 30, 30, bmpScreenshot51);
if (maze[0, 1] < color22.R && color22.R < maze[0, 2] && maze[0, 3] < color22.G && color22.G < maze[0, 4] && maze[0, 5] < color22.B && color22.B < maze[0, 6])
{ transfered[zy, zx] = maze[0, 0]; }
else if (maze[3, 1] < color22.R && color22.R < maze[3, 2] && maze[3, 3] < color22.G && color22.G < maze[3, 4] && maze[3, 5] < color22.B && color22.B < maze[3, 6])
{ transfered[zy, zx] = maze[3, 0]; }
else { transfered[zy, zx] = 0; temptest++; }
zx++;
}
}
public void ThreadTwoP()
{
int o = CabYY - 72;
int zy = 7;
int zx = 2;
for (int ok = CabXX; ok < CabXX + 490; ok = ok + 72)
{
var color22 = RGBreturnLVL(ok, o, 30, 30, bmpScreenshot61);
if (maze[0, 1] < color22.R && color22.R < maze[0, 2] && maze[0, 3] < color22.G && color22.G < maze[0, 4] && maze[0, 5] < color22.B && color22.B < maze[0, 6])
{ transfered[zy, zx] = maze[0, 0]; }
else if (maze[3, 1] < color22.R && color22.R < maze[3, 2] && maze[3, 3] < color22.G && color22.G < maze[3, 4] && maze[3, 5] < color22.B && color22.B < maze[3, 6])
{ transfered[zy, zx] = maze[3, 0]; }
else { transfered[zy, zx] = 0; temptest++; }
zx++;
}
}


waiting your response
GeneralRe: CODE Pin
Luc Pattyn30-Dec-09 3:00
sitebuilderLuc Pattyn30-Dec-09 3:00 
GeneralRe: CODE Pin
Renven30-Dec-09 3:27
Renven30-Dec-09 3:27 
GeneralRe: CODE Pin
Renven30-Dec-09 3:44
Renven30-Dec-09 3:44 
GeneralRe: CODE Pin
Luc Pattyn30-Dec-09 3:49
sitebuilderLuc Pattyn30-Dec-09 3:49 
GeneralRe: CODE Pin
harold aptroot30-Dec-09 3:49
harold aptroot30-Dec-09 3:49 
GeneralRe: CODE Pin
Daniel Grunwald30-Dec-09 3:50
Daniel Grunwald30-Dec-09 3:50 
GeneralRe: CODE Pin
Renven30-Dec-09 4:03
Renven30-Dec-09 4:03 
GeneralRe: CODE Pin
Luc Pattyn30-Dec-09 4:38
sitebuilderLuc Pattyn30-Dec-09 4:38 
GeneralRe: CODE Pin
Daniel Grunwald30-Dec-09 4:42
Daniel Grunwald30-Dec-09 4:42 
GeneralRe: CODE Pin
Luc Pattyn30-Dec-09 4:58
sitebuilderLuc Pattyn30-Dec-09 4:58 
AnswerRe: Threads, speed up calculations Pin
#realJSOP30-Dec-09 2:27
mve#realJSOP30-Dec-09 2:27 
GeneralRe: Threads, speed up calculations Pin
Ben Fair30-Dec-09 3:19
Ben Fair30-Dec-09 3:19 
GeneralRe: Threads, speed up calculations Pin
Renven30-Dec-09 4:05
Renven30-Dec-09 4:05 
QuestionIntegrate sql server's Query Editor Window with C# Project Pin
Dot-Net-Dev30-Dec-09 0:50
Dot-Net-Dev30-Dec-09 0:50 
AnswerRe: Integrate sql server's Query Editor Window with C# Project Pin
Eddy Vluggen30-Dec-09 4:03
professionalEddy Vluggen30-Dec-09 4:03 
Questionhow to make web application using multipoint sdk Pin
krunal2529-Dec-09 23:45
krunal2529-Dec-09 23:45 
AnswerRe: how to make web application using multipoint sdk Pin
Jimmanuel30-Dec-09 3:02
Jimmanuel30-Dec-09 3:02 

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.