public void Stop() { Trading = false; if (TradeThread?.ThreadState == ThreadState.Running) { TradeThread.Join(); } if (LogThread.ThreadState == ThreadState.WaitSleepJoin) { LogThread.Abort(); } else if (LogThread.ThreadState == ThreadState.Running) { LogThread.Join(); } }