public CustomTimer(System.Threading.TimerCallback callback, object state, int dueTime, int period, DisposeEvent _eventDispose, StartEvent _eventStart) { onDispose += _eventDispose; onStart += _eventStart; timer = new System.Threading.Timer(callback, state, dueTime, period); }
public override void Stop() { if (IsRunning) { _curState.Exit(_owner); IsRunning = false; DisposeEvent?.Invoke(this); } }
void OnMessageDispose(DisposeEvent e) { Debug.Log("Dequeuing --Total Count" + _pendingQueue.Count); if (_pendingQueue.Count > 0) { _pendingQueue.Dequeue(); } notificationActive = false; }
/// <summary> /// Implement <see cref="IDisposable.Dispose"/> /// </summary> public void Dispose() { if (!IsDisposed && !_inDispose) { _inDispose = true; GC.SuppressFinalize(this); DisposeEvent?.Invoke(true); Dispose(true); IsDisposed = true; } }
public static void Dispose() { DisposeEvent?.Invoke(); SystemEvents.DisplaySettingsChanged -= SystemEventsOnDisplaySettingsChanged; App.WaitDispatchersShutdown(); App.BaseDispatcher.Invoke(() => { TrayIcon?.Dispose(); CloseOtherWindows(); }); }
public void Dispose() { // Make sure finally runs. using (_cancellationToken) { var dispose = new DisposeEvent(); OnEventPublishing(0, ref dispose); _cancellationToken.Cancel(); OnEventPublished(0, dispose); OnEventExecuting(0, ref dispose); Dispose(true); OnEventExecuted(0, dispose, EventStatus.Halt); } }
public void Dispose() { if (_isDisposed) { return; } _isDisposed = true; DisposeEvent?.Invoke(this); if (_handle != null) { Addressables.Release(_handle.Value); _handle = null; } Assets = _emptyAssets; }
/// <summary> /// call this rather than destroy. /// </summary> protected void Dispose() { if (!HasInit) { ZLog.warn(gameObject.name, "has't Init. Dispose() makes no sense."); return; } if (DisposeEvent != null) { if (DisposeEvent.GetInvocationList().Length > 1) { ZLog.error(gameObject.name, "disposeEvent should only have one listener(Manager)"); } DisposeEvent(GUID); } else { ZLog.warn(gameObject.name, "no manager attached, destroy itself"); UnInit(); Destroy(gameObject); } }
public void Dispose() { DisposeEvent?.Invoke(this, new EventArgs()); ConsoleManager?.Dispose(); }