Ejemplo n.º 1
0
 private void CloseThis()
 {
     if (CloseIt?.Invoke(this) == true)
     {
         Content?.Close();
     }
 }
Ejemplo n.º 2
0
 private async void CloseThis()
 {
     if (await CloseIt?.Invoke(this) == true)
     {
         Content?.Close();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 关闭到客户端的连接而不发送响应。
        /// </summary>
        public void Close()
        {
            _closeAction?.Invoke();
            _closeAction = null;
#if net40
            _closeAsycAction?.Invoke();
            _closeAsycAction = null;
#endif
            _isClientConnectedAction = null;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Подпрограмма завершения работы с платой
        /// </summary>
        /// <returns></returns>
        // ReSharper disable once UnusedMethodReturnValue.Global
        public int Close()
        {
            // Synchronously wait to enter the Semaphore.
            SemaphoreSlim.Wait();
            var error = _close?.Invoke(ref _device) ?? int.MaxValue;

            if (_dllhandle != IntPtr.Zero)
            {
                // Free resources.
                // Probably should use SafeHandle or some similar class, but this will do for now.
                NativeMethods.FreeLibrary(_dllhandle);
            }
            // Release the Semaphore.
            SemaphoreSlim.Release();
            return(error);
        }