Esempio n. 1
0
        public void Dispose()
        {
            if (isDisposed)
            {
                return;
            }

            isDisposed = true;

            OnDisposed?.Invoke(this, new EventArgs());

            if (userActivityTimeout > 0 && EnvironmentHelper.CurrentTime.Subtract(lastUserActionDate) > TimeSpan.FromSeconds(userActivityTimeout))
            {
                Logger.Log("Disposing session stream {0}/{1} due to user timeout", session.SessionId, streamId);
            }
            else
            {
                Logger.Log("Disposing session stream {0}/{1} due to unexpected reason", session.SessionId, streamId);
            }

            lock (pullingCallbackLock)
            {
                if (pullingCallback != null)
                {
                    pullingCallback.OnDisposed -= OnConnectionDisposed;
                    pullingCallback.Dispose();
                    pullingCallback = null;
                }
            }

            userInfo?.Dispose();
            userInfo = null;
        }
        public void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }
            IsDisposed = true;

            if (GetBlockPartyServerTimer != null)
            {
                GetBlockPartyServerTimer.Stop();
            }

            if (Socket != null)
            {
                if (Socket.IsConnected)
                {
                    //Leave server if we're in a server
                    if (LastServer != "NONE")
                    {
                        leave_server(LastServer);
                    }

                    Socket.Close();
                }
            }

            OnDisposed?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 3
0
 public void Dispose()
 {
     if (Interlocked.Increment(ref _disposeCount) != 1)
     {
         return;
     }
     OnDisposed?.Invoke();
 }
Esempio n. 4
0
        public void Dispose()
        {
            _UIElement.Visibility = Visibility.Hidden;
            _HTMLControlBase.MainGrid.Children.Remove(_UIElement);

            _WPFWebWindow.Dispose();

            OnDisposed?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 5
0
        /// <summary>
        /// handle the raising of disposal events
        /// </summary>
        public override void Dispose()
        {
            // If this object hasn't be disposed yet, raise the callback(s)
            if (!IsDisposed)
            {
                OnDisposed?.Invoke(this);
            }

            // Handle the base disposal behaviour
            base.Dispose();
        }
Esempio n. 6
0
 public void Dispose()
 {
     if (!IsDisposed)
     {
         IsDisposed = true;
         connection.DataReceived   -= OnDataReceived;
         connection.OnDisconnected -= OnDisconnected;
         Task.Run(() => DisposeInternal());
         OnDisposed?.Invoke(this);
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Disposes the control.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="ControlDisposedException">The control has already been disposed</exception>
        /// <exception cref="Exceptions.ComponentNotAddedToMapException">The control has not been added to the map</exception>
        public async ValueTask DisposeAsync()
        {
            Logger?.LogAzureMapsControlInfo(AzureMapLogEvent.GeolocationControl_DisposeAsync, "GeolocationControl - DisposeAsync");
            Logger?.LogAzureMapsControlDebug(AzureMapLogEvent.GeolocationControl_DisposeAsync, $"Id: {Id}");

            EnsureJsRuntimeExists();
            EnsureNotDisposed();

            await JsRuntime.InvokeVoidAsync(Constants.JsConstants.Methods.GeolocationControl.Dispose.ToGeolocationControlNamespace(), Id);

            Disposed = true;
            OnDisposed?.Invoke();
        }
Esempio n. 8
0
 public void Dispose()
 {
     foreach (var comp in _components)
     {
         comp.Dispose();
     }
     while (Children.Count > 0)
     {
         Children[Children.Count - 1].Dispose();
     }
     Children.Clear();
     OnDisposed?.Invoke(this);
 }
Esempio n. 9
0
        protected virtual void Dispose(bool disposing)
        {
            if (Interlocked.CompareExchange(ref _disposed, 1, 0) != 0)
            {
                return;
            }
            if (disposing)
            {
                ///告诉GC,不要调用析构函数
                GC.SuppressFinalize(this);
            }

            OnDisposed?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 10
0
 /// <summary>
 /// Frees resources and detaches itself from parent node.
 /// </summary>
 public virtual void Dispose()
 {
     foreach (var comp in _components)
     {
         comp.Dispose();
     }
     _components.Clear();
     for (int i = Children.Count - 1; i >= 0; i--)
     {
         Children[i].Dispose();
     }
     Children.Clear();
     OnDisposed?.Invoke(this);
 }
Esempio n. 11
0
 /// <summary>
 ///
 /// </summary>
 public void Dispose()
 {
     if (Option == TransScopeOption.RequireNew || Parent == null)
     {
         if (Trans != null)
         {
             Trans.Dispose();
             LogDebug("Dispose Transaction. DbConnectionWrap.Guid={0}, TransScope.Guid={1}", _ConnectionId, Guid);
         }
         _State = TransScopeState.Dispose;
         LogDebug("Set TransScopeState to Dispose. DbConnectionWrap.Guid={0}, TransScope.Guid={1}", _ConnectionId, Guid);
     }
     OnDisposed?.Invoke(this, new EventArgs());
 }
Esempio n. 12
0
        void CleanUp(bool isDisposing)
        {
            if (_isCleanedUp)
            {
                return;
            }

            if (isDisposing)
            {
                FreeManagedResources();
            }
            FreeUnmanagedResources();
            _isCleanedUp = true;

            OnDisposed?.Invoke();
        }
Esempio n. 13
0
        /// <summary>
        /// 资源释放
        /// </summary>
        public void Dispose()
        {
            if (!_isBeginCalledBefore || IsDisposed)
            {
                return;
            }

            IsDisposed = true;

            if (!_succeed)
            {
                OnFailed?.Invoke(this, new UnitOfWorkFailedEventArgs(_exception));
            }

            DisposeUow();
            OnDisposed?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 14
0
            public void Dispose()
            {
                IEnumerator <T> tempEnumerator = mEnumerator;

                mEnumerator = null;

                if (tempEnumerator != null)
                {
                    tempEnumerator.Dispose();

                    mOnEnumerationEnded = null;

                    if (mOnDisposed != null)
                    {
                        mOnDisposed.Invoke(mEnumerationCount);
                        mOnDisposed = null;
                    }
                }
            }
Esempio n. 15
0
        /// <summary>子类重载实现资源释放逻辑时必须首先调用基类方法</summary>
        /// <param name="disposing">从Dispose调用(释放所有资源)还是析构函数调用(释放非托管资源)。
        /// 因为该方法只会被调用一次,所以该参数的意义不太大。</param>
        protected virtual void OnDispose(Boolean disposing)
        {
            // 只有从Dispose中调用,才有可能是1
            if (Interlocked.CompareExchange(ref disposed, 2, 1) != 1)
            {
                throw new Exception("设计错误,OnDispose应该只被调用一次!代码不应该直接调用OnDispose,而应该调用Dispose。");
            }

            if (disposing)
            {
                // 释放托管资源

                // 告诉GC,不要调用析构函数
                GC.SuppressFinalize(this);
            }

            // 释放非托管资源

            OnDisposed?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 16
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    Tooltip = null;

                    parent?.Remove(this);
                    manager.NotifyWidgetDisposed(this);
                    ClearWidgets();
                }
                children = null;

                disposedValue = true;
                if (disposing)
                {
                    OnDisposed?.Invoke(this, EventArgs.Empty);
                }
            }
        }
Esempio n. 17
0
        public void OnEndDrag()
        {
            toolIcon.sprite = buttonSpriteSet.normal;

            if (IsOverBin())
            {
                Tween hideTween = uiAnimation.Hide();
                hideTween.OnComplete(() =>
                {
                    Destroy(this);
                    OnDisposed.Invoke();
                });
            }
            else
            {
                transform.SetParent(Container);
                transform.SetSiblingIndex(placeholder.transform.GetSiblingIndex());
            }

            ToolBin.gameObject.SetActive(false);
            Destroy(placeholder);
        }
Esempio n. 18
0
        /// <summary>
        /// Free resources
        /// </summary>
        public void Dispose()
        {
            if (_IsDisposed)
            {
                return;
            }

            _IsDisposed = true;

            if (_Process != null)
            {
                try { _Process.Kill(); } catch { }
                _Process.Dispose();
                _Process = null;
            }

            if (_Thread != null)
            {
                try { _Thread.Abort(); } catch { }
                _Thread = null;
            }

            if (_Object != null)
            {
                try { _Object.Dispose(); } catch { }
                _Object = null;
            }

            OnDispose();

            OnDisposed?.Invoke(this, EventArgs.Empty);
            if (DisposeTag && Tag != null && Tag is IDisposable)
            {
                ((IDisposable)Tag).Dispose();
                Tag = null;
            }
        }
Esempio n. 19
0
 public void Dispose()
 {
     Items?.Clear();
     OnDisposed?.Invoke(this);
 }
Esempio n. 20
0
 public void Dispose()
 {
     OnDisposed?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 21
0
 protected void InvokeOnDisposed()
 {
     OnDisposed?.Invoke(this);
 }
Esempio n. 22
0
 public void DisposeView()
 {
     UnityEngine.Object.Destroy(View.GetGameObject);
     View = null;
     OnDisposed?.Invoke(this);
 }
Esempio n. 23
0
 public void Dispose()
 {
     OnDisposed.Invoke(this, new GameSoundEffectDisposedEventArgs(this));
     _soundEffectInstance.Dispose();
 }
Esempio n. 24
0
 public void Dispose()
 {
     OnDisposed?.Invoke(this, new EventArgs());
 }
Esempio n. 25
0
 private void Disposed(object sender, System.EventArgs args)
 {
     OnDisposed?.Invoke();
 }
Esempio n. 26
0
 public void Dispose()
 {
     Console.WriteLine("Disposed");
     OnDisposed?.Invoke(new object(), new ObjectDisposedEventArgs());
 }
Esempio n. 27
0
 protected void RaiseOnDisposed()
 {
     OnDisposed?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 28
0
 public void Dispose()
 {
     Clear();
     IsDisposed = true;
     OnDisposed?.Invoke();
 }
Esempio n. 29
0
 /// <inheritdoc />
 public void Dispose()
 {
     OnDisposed?.Invoke(this);
 }