Was haltet ihr davon ?
Spoiler anzeigen
~blaze~: Thema verschoben
C#-Quellcode
-
- public class ThreadLoop
- {
- private delegate void ThreadLoopHandle();
- private ThreadLoopHandle ThreadLoopEvent;
- private Action Action;
- private int Delay;
- public uint LoopCount;
- public ThreadLoop(Action action, int delay = 0)
- {
- Action = action;
- Delay = delay;
- }
- //public ThreadLoop(double start, double end, double step, Action action, int delay = 0)
- //{
- // Action = action;
- // Delay = delay;
- //}
- public void Start()
- {
- ThreadLoopEvent += InnaStart;
- new SySThread.Thread(Start).Start();
- }
- private void InnaStart()
- {
- LoopCount += 1;
- Action();
- SySThread.Thread.Sleep(Delay);
- ThreadLoopEvent?.Invoke();
- }
- public void Stop() => ThreadLoopEvent = null;
- }
~blaze~: Thema verschoben
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „~blaze~“ ()