Пример #1
0
        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);
        }
Пример #2
0
 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;
     }
 }
Пример #5
0
        public static void Dispose()
        {
            DisposeEvent?.Invoke();
            SystemEvents.DisplaySettingsChanged -= SystemEventsOnDisplaySettingsChanged;

            App.WaitDispatchersShutdown();

            App.BaseDispatcher.Invoke(() =>
            {
                TrayIcon?.Dispose();
                CloseOtherWindows();
            });
        }
Пример #6
0
 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);
     }
 }
Пример #7
0
        public void Dispose()
        {
            if (_isDisposed)
            {
                return;
            }
            _isDisposed = true;

            DisposeEvent?.Invoke(this);

            if (_handle != null)
            {
                Addressables.Release(_handle.Value);
                _handle = null;
            }

            Assets = _emptyAssets;
        }
Пример #8
0
        /// <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);
            }
        }
Пример #9
0
 public void Dispose()
 {
     DisposeEvent?.Invoke(this, new EventArgs());
     ConsoleManager?.Dispose();
 }