You are viewing our Forum Archives. To view or take place in current topics click here.
C# Question Help!
Posted:

C# Question Help!Posted:

Crimson-Mods
  • New Member
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

                                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:
ZZ9_x_iHaXoRZz
  • Rigged Luck
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.
#3. Posted:
Crimson-Mods
  • New Member
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
#4. Posted:
ZZ9_x_iHaXoRZz
  • Rated Awesome
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 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
#5. Posted:
Mildot
  • Resident Elite
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.
#6. Posted:
RC4
  • Rising Star
Status: Offline
Joined: Feb 18, 201212Year Member
Posts: 773
Reputation Power: 32
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?
#7. Posted:
Maybe_Ethernet
  • Junior Member
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 wrote
Crimson-Mods wrote
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


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
David look at your pm homes
#8. Posted:
Crimson-Mods
  • New Member
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
Crimson-Mods wrote
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


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;
#9. Posted:
ZZ9_x_iHaXoRZz
  • Rated Awesome
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 wrote
Crimson-Mods wrote
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


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.
#10. Posted:
Mildot
  • Resident Elite
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();
   }
}
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.