public AddTeleport(Main2 _parent, Cheat c) { InitializeComponent(); parent = _parent; before = buttonAdd.Text; UpdateAdd(); refresh = new Task(delegate { while (true) { c.ReadGameData(); if (InvokeRequired) { Invoke((MethodInvoker) delegate { textBoxXR.Text = c.gd.x.ToString("0.00"); textBoxYR.Text = c.gd.y.ToString("0.00"); }); } Thread.Sleep(10); } }, cts.Token); refresh.Start(); }
static public void StartGameDetection() { gameDetection = new Thread(new ThreadStart(delegate() { while (true) { var proc = DetectStart(); Program.cheat = new Cheat(proc); cheatThread = new Thread(new ThreadStart(Program.cheat.Start)); cheatThread.Name = "Cheat"; cheatThread.Start(); GUI.BlockDisable(); DetectExit(); cheatThread.Abort(); GUI.BlockEnable(); // Make Sure it is closes } })); gameDetection.Name = "GameDetection"; gameDetection.Start(); }