Esempio n. 1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (this.CadastralArea == null)
            {
                this.CadastralArea = new CadastralArea(0);
            }

            if (!Int32.TryParse(inputID.Text, out int id))
            {
                goto DoNothing;
            }

            this.CadastralArea.ID = id;
            string oldName = this.CadastralArea.Name;

            this.CadastralArea.Name = inputName.Text;

            if (this.CadastralArea == null || this.CadastralArea.ID == 0)
            {
                MessageBox.Show("ID is mandatory field, please fill it up");
            }
            onDispose?.Invoke(this.CadastralArea, oldName);
            this.Dispose();
            goto Finish;

            DoNothing :;
            MessageBox.Show("ID has to be integer");
            Finish :;
        }
Esempio n. 2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                lock (_idleNodeModulesLock) {
                    if (_idleNodeModulesTimer != null)
                    {
                        _idleNodeModulesTimer.Dispose();
                    }
                    _idleNodeModulesTimer = null;
                }

                NodejsPackage.Instance.GeneralOptionsPage.ShowBrowserAndNodeLabelsChanged -= ShowBrowserAndNodeLabelsChanged;

                OnDispose?.Invoke(this, EventArgs.Empty);

                RemoveChild(ModulesNode);
                ModulesNode?.Dispose();
                ModulesNode = null;
#if DEV14
                _typingsAcquirer = null;
#endif
            }
            base.Dispose(disposing);
        }
Esempio n. 3
0
        public void Dispose()
        {
            _stopwatch.Stop();

            var entryType = Info.IsRoot ? ContextLogEntryType.ContextEnd : ContextLogEntryType.ChildContextEnd;

            Logger.LogAsType(Settings.ContextEndMessageLevel,
                             $"Context {Info.ContextName} has ended.", entryType);

            _stack.Pop();

            Logger.CompleteIfRoot();
            Logger.TrySetContext(_parent);

            if (_stack.IsEmpty)
            {
                // Logger = null;
                // State = null;

                _namedStacks.Remove(Info.ContextGroupName, out _);

                if (!_namedStacks.Any())
                {
                    _asyncLocalStacks.Value = null;
                }
            }

            OnDispose?.Invoke(this);
            Unloaded?.Invoke(this);
        }
Esempio n. 4
0
 public void Dispose()
 {
     _registerDisposer?.Dispose();
     _registerDisposer = null;
     OnDispose?.Invoke();
     OnDispose = null;
 }
Esempio n. 5
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                lock (this._idleNodeModulesLock)
                {
                    if (this._idleNodeModulesTimer != null)
                    {
                        this._idleNodeModulesTimer.Dispose();
                    }
                    this._idleNodeModulesTimer = null;
                }

                OnDispose?.Invoke(this, EventArgs.Empty);

                var node = this.ModulesNode;
                if (node != null)
                {
                    RemoveChild(node);
                    node.Dispose();
                }
                this.ModulesNode = null;
            }
            base.Dispose(disposing);
        }
Esempio n. 6
0
 public void Dispose()
 {
     OnDispose?.Invoke();
     Dispose(true);
     GC.SuppressFinalize(this);
     _isDisposed = true;
 }
        public virtual void Dispose()
        {
            if (Interlocked.CompareExchange(ref status, 0, 0) == Status.Disposed)
            {
                return;
            }

            Stop();

            if (Interlocked.CompareExchange(ref status, Status.Disposed, Status.Stopped) != Status.Stopped)
            {
                Interlocked.CompareExchange(ref status, Status.Disposed, Status.Stopping);
            }

            try
            {
                OnDispose?.Invoke();
            }
            catch (Exception ex)
            {
                Log.Error("Error OnDispose(): ", ex);
            }

            try
            {
                Thread.Sleep(100); //give it a small chance to die gracefully
                KillBgThreadIfExists();
            }
            catch (Exception ex)
            {
                OnError?.Invoke(ex);
            }

            DisposeHeartbeatTimer();
        }
        private void OnDestroy()
        {
            OnDispose?.Invoke();

            OnFrameEnter = null;
            OnFrameExit  = null;
            OnDispose    = null;
        }
 public virtual void Dispose()
 {
     if (OnDispose != null)
     {
         OnDispose.Invoke(this, new EventArgs());
     }
     Disposed = true;
 }
Esempio n. 10
0
 public void Dispose()
 {
     if (socket.IsAlive)
     {
         socket.Close();
     }
     OnDispose?.Invoke(this);
 }
        /// <exclude />
        public void Dispose()
        {
            OnDispose?.Invoke();
            _disposed = true;

#if LeakCheck
            GC.SuppressFinalize(this);
#endif
        }
 public void Dispose()
 {
     if (isDisposed)
     {
         return;
     }
     GameObject.Destroy(menu);
     OnDispose?.Invoke();
 }
Esempio n. 13
0
        /// <summary>
        /// Disposes of the game mode.
        /// </summary>
        public virtual void Dispose()
        {
            if (OnDispose != null)
            {
                OnDispose.Invoke();
            }

            OnDispose  = null;
            CurrentMap = null;
        }
Esempio n. 14
0
 public void Dispose()
 {
     if (!helpIAmBeingHacked)
     {
         SqlConnection.Close();
         SqlConnection.Dispose();
         SqlConnection = null;
         OnDispose?.Invoke();
     }
 }
Esempio n. 15
0
 public override void Dispose()
 {
     while (CacheStack.Count > 0)
     {
         TComponent item = CacheStack.Pop();
         OnDispose?.Invoke(item);
         Object.Destroy(item.gameObject);
     }
     CacheStack.Clear();
 }
Esempio n. 16
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     if (this.person == null)
     {
         this.person = new Person(tb_ID.Text, "", "");
     }
     this.person.Firstname = tb_CA.Text;
     this.person.Lastname  = tb_RN.Text;
     onDispose?.Invoke(this.person);
     this.Dispose();
 }
Esempio n. 17
0
 /// <summary>
 /// 释放对象.
 /// </summary>
 public void Dispose()
 {
     if (_disposed)
     {
         return;
     }
     _transaction?.Dispose();
     _dbContext.Dispose();
     OnDispose?.Invoke();
     _disposed = true;
 }
Esempio n. 18
0
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposedValue)
     {
         OnDispose?.Invoke(this, this.DocumentsToInsert);
         if (disposing)
         {
         }
         _disposedValue = true;
     }
 }
Esempio n. 19
0
        protected virtual void Dispose(bool isDisposing)
        {
            if (!IsDisposed)
            {
                Marshal.FreeHGlobal(new IntPtr(_memoryBlock));
                AllocatedBytes = 0;
                IsDisposed     = true;

                OnDispose?.Invoke();
            }
        }
Esempio n. 20
0
        public void Dispose()
        {
            Stop();
            stream?.Dispose();
            stream = null;

            mes?.Dispose();
            mes = null;

            OnDispose?.Invoke(this, null);
        }
Esempio n. 21
0
        /// <summary>
        ///     Releases all resources used by the object.
        /// </summary>
        public virtual void Dispose()
        {
            // Raise the event OnDispose
            OnDispose?.Invoke(this, new EventArgs());

            //// Close the process handle
            //Handle.Close();

            // Avoid the finalizer
            GC.SuppressFinalize(this);
        }
Esempio n. 22
0
        protected override void Dispose(bool isDisposing)
        {
            OnDispose?.Invoke(IsDisposable, null);

            if (IsDisposable && texture != null)
            {
                texture.Dispose();
                texture = null;
            }

            base.Dispose(isDisposing);
        }
Esempio n. 23
0
 public void Dispose()
 {
     if (_encryptionBuffers != null) // Encryption enabled
     {
         foreach (var buffer in _encryptionBuffers)
         {
             NativeMemory.Free4KbAlignedMemory(buffer.Pointer, buffer.Size, buffer.AllocatingThread);
         }
         BeforeCommitFinalization?.Invoke(this);
     }
     OnDispose?.Invoke(this);
 }
Esempio n. 24
0
 /// <summary>
 /// Does the same as stop. Does not need to be called for cleanup will be called after the execution has finished.
 /// </summary>
 public void Dispose()
 {
     if (_disposed)
     {
         return;
     }
     OnDispose?.Invoke(this, EventArgs.Empty);
     _isRunning = false;
     _disposed  = true;
     if (gameObject != null)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 25
0
        /// <summary>
        /// Free resources
        /// </summary>
        public void Dispose()
        {
            if (_Process != null)
            {
                foreach (var p in _Process)
                {
                    try { p.Dispose(); } catch { }
                }

                _Process = null;
            }

            OnDispose?.Invoke(null, null);
        }
Esempio n. 26
0
        public void Dispose()
        {
            if (_encryptionBuffers != null) // Encryption enabled
            {
                foreach (var buffer in _encryptionBuffers)
                {
                    PlatformSpecific.NativeMemory.Free4KbAlignedMemory(buffer.Pointer, buffer.Size, buffer.AllocatingThread);
                }

                var cryptoPagerTransactionState = ((IPagerLevelTransactionState)this).CryptoPagerTransactionState;

                if (cryptoPagerTransactionState != null && cryptoPagerTransactionState.TryGetValue(_dataPager, out var state))
                {
                    // we need to iterate from the end in order to filter out pages that was overwritten by later transaction
                    var sortedState = state.OrderByDescending(x => x.Key);

                    var overflowDetector = new RecoveryOverflowDetector();

                    foreach (var buffer in sortedState)
                    {
                        if (buffer.Value.SkipOnTxCommit)
                        {
                            continue;
                        }

                        if (buffer.Value.Modified == false)
                        {
                            continue; // No modification
                        }
                        var pageHeader    = (PageHeader *)buffer.Value.Pointer;
                        var numberOfPages = VirtualPagerLegacyExtensions.GetNumberOfPages(pageHeader);

                        long modifiedPage = buffer.Key;

                        if (overflowDetector.IsOverlappingAnotherPage(modifiedPage, numberOfPages))
                        {
                            // if page is overlapping an already seen page it means this one was freed, we must skip it on tx commit
                            state[modifiedPage].SkipOnTxCommit = true;
                            continue;
                        }

                        overflowDetector.SetPageChecked(modifiedPage);
                    }
                }

                BeforeCommitFinalization?.Invoke(this);
            }
            OnDispose?.Invoke(this);
        }
Esempio n. 27
0
        /// <summary>
        ///     Releases unmanaged and - optionally - managed resources.
        /// </summary>
        public virtual void Dispose()
        {
            if (!IsDisposed)
            {
                IsDisposed = true;

                OnDispose?.Invoke(this, EventArgs.Empty);
                ThreadFactory?.Dispose();
                ModuleFactory?.Dispose();
                MemoryFactory?.Dispose();
                WindowFactory?.Dispose();
                Handle?.Close();
                GC.SuppressFinalize(this);
            }
        }
Esempio n. 28
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!Int32.TryParse(inputID.Text, out int id))
            {
                MessageBox.Show("ID has to by integer");
            }
            else
            {
                this.Property.ID          = id;
                this.Property.Address     = this.inputAddress.Text;
                this.Property.Description = this.inputDesc.Text;

                onDispose?.Invoke(this.Property);
                this.Dispose();
            }
        }
Esempio n. 29
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    OnDispose?.Invoke();

                    SavingState();
                }

                OnDispose     = null;
                OnResult      = null;
                disposedValue = true;
            }
        }
Esempio n. 30
0
        public void Dispose()
        {
            if (_disposed.HasFlag(TxState.Disposed))
            {
                return;
            }

            try
            {
                if (!Committed && !RolledBack && Flags == TransactionFlags.ReadWrite)
                {
                    Rollback();
                }

                _disposed |= TxState.Disposed;

                PersistentContext.FreePageLocator(_pageLocator);
            }
            finally
            {
                _env.TransactionCompleted(this);

                foreach (var pagerState in _pagerStates)
                {
                    pagerState.Release();
                }

                if (JournalFiles != null)
                {
                    foreach (var journalFile in JournalFiles)
                    {
                        journalFile.Release();
                    }
                }

                _root?.Dispose();
                _freeSpaceTree?.Dispose();

                _allocator.AllocationFailed -= MarkTransactionAsFailed;
                if (_disposeAllocator)
                {
                    _allocator.Dispose();
                }

                OnDispose?.Invoke(this);
            }
        }