You are viewing our Forum Archives. To view or take place in current topics click here.
C# Question Help!
Posted:
C# Question Help!Posted:
Status: Offline
Joined: Jun 24, 201410Year Member
Posts: 39
Reputation Power: 1
Status: Offline
Joined: Jun 24, 201410Year Member
Posts: 39
Reputation Power: 1
Ok So im Coding a Gamertag Changer tool and im making a cylce part so it can cycle the colors but when i click it i have
But that Pauses the whole thread by thread i mean Form so i cant stop it from Cycleing because its looping forever so its just stuck so whats a code where it pauses the code instead of the thread??
int time = 100;
System.Threading.Thread.Sleep(time);
But that Pauses the whole thread by thread i mean Form so i cant stop it from Cycleing because its looping forever so its just stuck so whats a code where it pauses the code instead of the thread??
#2. Posted:
Status: Offline
Joined: Mar 11, 201113Year Member
Posts: 4,436
Reputation Power: 8964
Status: Offline
Joined: Mar 11, 201113Year Member
Posts: 4,436
Reputation Power: 8964
You could just add it to a for loop, and use a thread that way, if you using a sleep thread you making the tool it self sleep as well.
- 0useful
- 0not useful
#3. Posted:
Status: Offline
Joined: Jun 24, 201410Year Member
Posts: 39
Reputation Power: 1
Status: Offline
Joined: Jun 24, 201410Year Member
Posts: 39
Reputation Power: 1
ZZ9_x_iHaXoRZz wrote You could just add it to a for loop, and use a thread that way, if you using a sleep thread you making the tool it self sleep as well.
i tried adding it to a cylce thread but every time i click it i get like 20 errors
- 0useful
- 0not useful
#4. Posted:
Status: Offline
Joined: Mar 11, 201113Year Member
Posts: 4,436
Reputation Power: 8964
Status: Offline
Joined: Mar 11, 201113Year Member
Posts: 4,436
Reputation Power: 8964
Crimson-Mods wroteZZ9_x_iHaXoRZz wrote You could just add it to a for loop, and use a thread that way, if you using a sleep thread you making the tool it self sleep as well.
i tried adding it to a cylce thread but every time i click it i get like 20 errors
You could try something like this,
add to button
cycle = new Thread(new ThreadStart(cyclenow));
if (!cycleactivated)
{
if (!cyclefirst)
{
cycle.Start();
buttonbla.Text = "Cycle On";
cycleactivated = true;
cyclefirst = true;
}
else
{
buttonbla.Text = "Cycle On";
cycleactivated = true;
}
}
else
{
buttonbla.Text = "Cycle Off";
cycleactivated = false;
}
Then add this void
private void cyclenow()
{
while (true)
{
if (cycleactivated)
{
//your codding
Thread.Sleep(0x3e8);
}
}
}
and then add these
private Thread cycle;
private bool cycleactivated = false;
private bool cyclefirst = false;
Not sure if this works but worth a shot
- 1useful
- 0not useful
#5. Posted:
Status: Offline
Joined: Dec 25, 201310Year Member
Posts: 248
Reputation Power: 10
Status: Offline
Joined: Dec 25, 201310Year Member
Posts: 248
Reputation Power: 10
ZZ9 beat me too it again.
- 1useful
- 0not useful
#6. Posted:
Status: Offline
Joined: Feb 18, 201212Year Member
Posts: 773
Reputation Power: 32
Why not add a timer with a interval of like 5 seconds then add a loop counter and send the color accordingly to the loop counter. Make sense?
- 0useful
- 0not useful
#7. Posted:
Status: Offline
Joined: Jun 01, 201410Year Member
Posts: 74
Reputation Power: 2
Status: Offline
Joined: Jun 01, 201410Year Member
Posts: 74
Reputation Power: 2
ZZ9_x_iHaXoRZz wroteDavid look at your pm homesCrimson-Mods wroteZZ9_x_iHaXoRZz wrote You could just add it to a for loop, and use a thread that way, if you using a sleep thread you making the tool it self sleep as well.
i tried adding it to a cylce thread but every time i click it i get like 20 errors
You could try something like this,
add to button
cycle = new Thread(new ThreadStart(cyclenow));
if (!cycleactivated)
{
if (!cyclefirst)
{
cycle.Start();
buttonbla.Text = "Cycle On";
cycleactivated = true;
cyclefirst = true;
}
else
{
buttonbla.Text = "Cycle On";
cycleactivated = true;
}
}
else
{
buttonbla.Text = "Cycle Off";
cycleactivated = false;
}
Then add this void
private void cyclenow()
{
while (true)
{
if (cycleactivated)
{
//your codding
Thread.Sleep(0x3e8);
}
}
}
and then add these
private Thread cycle;
private bool cycleactivated = false;
private bool cyclefirst = false;
Not sure if this works but worth a shot
- 0useful
- 0not useful
#8. Posted:
Status: Offline
Joined: Jun 24, 201410Year Member
Posts: 39
Reputation Power: 1
Status: Offline
Joined: Jun 24, 201410Year Member
Posts: 39
Reputation Power: 1
ZZ9_x_iHaXoRZz wroteCrimson-Mods wroteZZ9_x_iHaXoRZz wrote You could just add it to a for loop, and use a thread that way, if you using a sleep thread you making the tool it self sleep as well.
i tried adding it to a cylce thread but every time i click it i get like 20 errors
You could try something like this,
add to button
cycle = new Thread(new ThreadStart(cyclenow));
if (!cycleactivated)
{
if (!cyclefirst)
{
cycle.Start();
buttonbla.Text = "Cycle On";
cycleactivated = true;
cyclefirst = true;
}
else
{
buttonbla.Text = "Cycle On";
cycleactivated = true;
}
}
else
{
buttonbla.Text = "Cycle Off";
cycleactivated = false;
}
Then add this void
private void cyclenow()
{
while (true)
{
if (cycleactivated)
{
//your codding
Thread.Sleep(0x3e8);
}
}
}
and then add these
private Thread cycle;
private bool cycleactivated = false;
private bool cyclefirst = false;
Not sure if this works but worth a shot
this is what i have that it dosnt work
if (Jtag.activeConnection)
{
if (!cycleState)
{
cycleThread = new System.Threading.Thread(new System.Threading.ThreadStart(VoidDownthere));
cycleState = true;
cycleThread.Start();
return;
}
cycleState = false;
cycleThread.Abort();
}
Then A Void
public void CyclePrestige1()//0-15
{
while (cycleState)
for (int i = 0; i <= 15; i++)
{
false);
Thread.Sleep(500);
if (i == 15)
{
i = -1;
}
}
}
Then have these voids
public bool cycleState;
public Thread cycleThread;
- 0useful
- 0not useful
#9. Posted:
Status: Offline
Joined: Mar 11, 201113Year Member
Posts: 4,436
Reputation Power: 8964
Status: Offline
Joined: Mar 11, 201113Year Member
Posts: 4,436
Reputation Power: 8964
Crimson-Mods wrote
ZZ9_x_iHaXoRZz wroteCrimson-Mods wroteZZ9_x_iHaXoRZz wrote You could just add it to a for loop, and use a thread that way, if you using a sleep thread you making the tool it self sleep as well.
i tried adding it to a cylce thread but every time i click it i get like 20 errors
You could try something like this,
add to button
cycle = new Thread(new ThreadStart(cyclenow));
if (!cycleactivated)
{
if (!cyclefirst)
{
cycle.Start();
buttonbla.Text = "Cycle On";
cycleactivated = true;
cyclefirst = true;
}
else
{
buttonbla.Text = "Cycle On";
cycleactivated = true;
}
}
else
{
buttonbla.Text = "Cycle Off";
cycleactivated = false;
}
Then add this void
private void cyclenow()
{
while (true)
{
if (cycleactivated)
{
//your codding
Thread.Sleep(0x3e8);
}
}
}
and then add these
private Thread cycle;
private bool cycleactivated = false;
private bool cyclefirst = false;
Not sure if this works but worth a shot
this is what i have that it dosnt work
if (Jtag.activeConnection)
{
if (!cycleState)
{
cycleThread = new System.Threading.Thread(new System.Threading.ThreadStart(VoidDownthere));
cycleState = true;
cycleThread.Start();
return;
}
cycleState = false;
cycleThread.Abort();
}
Then A Void
public void CyclePrestige1()//0-15
{
while (cycleState)
for (int i = 0; i <= 15; i++)
{
false);
Thread.Sleep(500);
if (i == 15)
{
i = -1;
}
}
}
Then have these voids
public bool cycleState;
public Thread cycleThread;
I will into it for you tomorrow bro and help you out, I am off to bed in a bit.
- 0useful
- 0not useful
#10. Posted:
Status: Offline
Joined: Dec 25, 201310Year Member
Posts: 248
Reputation Power: 10
Status: Offline
Joined: Dec 25, 201310Year Member
Posts: 248
Reputation Power: 10
You are turning it on then right back off.. Here try this:
if(Jtag.activeConnection)
{
if(!cyclestate)
{
cycleThread = new System.Threading.Thread(new System.Threading.ThreadStart(VoidDownthere));
cycleState = true;
cycleThread.Start();
}
else
{
cycleState = false;
cycleThread.Abort();
}
}
- 0useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.