private static void Update() { if (ActionsToExport.Count > 0 && PlayersToExport.Count > 0 && HandsToExport.Count > 0) { if (ExportThread != null) { if (ExportThread.IsAlive || ExportThread.ThreadState == ThreadState.Running) { ExportThread.Abort(); ExportThread.Join(3000); } ExportThread = null; } VitaNexCore.TryCatch <Action>( ConnectAsync, () => { ExportThread = new Thread(UpdateCallback) { Name = CMOptions.ModuleName, Priority = ThreadPriority.BelowNormal }; ExportThread.Start(); }, x => { CMOptions.ToConsole(x); Cancel(); }); } }
private static void OnAbort() { ExportQueue.Clear(); if (ExportThread != null) { if (ExportThread.IsAlive || ExportThread.ThreadState == ThreadState.Running) { ExportThread.Abort(); ExportThread.Join(3000); } ExportThread = null; } if (_Connection != null && _Connection.Connected) { _Connection.Close(); _Connection = null; } CMOptions.ToConsole("Update aborted."); _Updating = false; }
private static void Cancel() { if (!_Updating) { ExportQueue.Clear(); return; } if (ExportThread != null) { if (ExportThread.IsAlive || ExportThread.ThreadState == ThreadState.Running) { ExportThread.Abort(); ExportThread.Join(3000); } ExportThread = null; } if (_Connection != null) { _Connection.Close(); _Connection = null; } _Updating = false; }