示例#1
0
 public void StopNamedPipe()
 {
     if (notifyThreadContext != null)
     {
         notifyThreadContext.Cancel().Wait();
     }
 }
 public void Close()
 {
     foreach (var inputDevice in device.GetInputDevices())
     {
         inputDevice.InputChanged -= InputChanged;
     }
     threadContext.Cancel().Wait();
 }
示例#3
0
 /// <summary>
 /// Disposes all resources.
 /// </summary>
 public void Dispose()
 {
     if (!disposed)
     {
         disposed = true;
         inputRefresher?.Cancel().Wait();
         Disconnected?.Invoke(this, new DeviceDisconnectedEventArgs());
     }
 }
示例#4
0
        public async Task CloseAsync(CancellationToken token = default)
        {
            if (!started)
            {
                return;
            }
            await client.CloseAsync(WebSocketCloseStatus.NormalClosure, null, token);

            threadContext.Cancel().Wait();
            started = false;
        }
示例#5
0
 public void Stop()
 {
     if (Running)
     {
         readThreadContext.Cancel().Wait();
         if (InputConfiguration.Autostart)
         {
             InputConfiguration.Autostart = false;
             inputConfigManager.SaveConfig(this);
         }
     }
 }
示例#6
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposed)
     {
         return;
     }
     if (disposing)
     {
         readThreadContext?.Cancel()?.Wait();
     }
     disposed = true;
 }
示例#7
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposed)
     {
         return;
     }
     if (disposing)
     {
         forceFeedbackThreadContext.Cancel().Wait();
         readThreadContext.Cancel().Wait();
         joystick.Dispose();
     }
     disposed = true;
 }
示例#8
0
 public void Stop()
 {
     if (running)
     {
         running              = false;
         XInput.InputChanged -= XInputInputChanged;
         client.Feedback     -= FeedbackReceived;
         logger.Info($"Force feedback mapping is disconnected on {ToString()}.");
         xOutputManager.Stop(client);
         logger.Info($"Emulation stopped on {ToString()}.");
         if (threadContext != null)
         {
             threadContext.Cancel().Wait();
         }
     }
 }
示例#9
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposed)
     {
         return;
     }
     if (disposing)
     {
         foreach (var inputDeviceProvider in inputDeviceProviders)
         {
             inputDeviceProvider.Connected    -= Connected;
             inputDeviceProvider.Disconnected -= Disconnected;
         }
         readThreadContext?.Cancel()?.Wait();
     }
     disposed = true;
 }
示例#10
0
 /// <summary>
 /// Stops the emulation of the device
 /// </summary>
 public void Stop()
 {
     if (running)
     {
         running              = false;
         XInput.InputChanged -= XInputInputChanged;
         if (ForceFeedbackSupported)
         {
             controller.FeedbackReceived -= ControllerFeedbackReceived;
             logger.Info($"Force feedback mapping is disconnected on {ToString()}.");
         }
         xOutputManager.Stop(controllerCount);
         controllerCount = 0;
         logger.Info($"Emulation stopped on {ToString()}.");
         if (threadContext != null)
         {
             threadContext.Cancel().Wait();
         }
     }
 }
示例#11
0
 public void Dispose()
 {
     inputRefresher?.Cancel().Wait();
 }
示例#12
0
 public virtual void Close()
 {
     pingThreadContext.Cancel();
 }
 public override void Close()
 {
     base.Close();
     threadContext.Cancel();
 }
示例#14
0
 public void Close()
 {
     device.InputChanged -= InputChanged;
     threadContext.Cancel().Wait();
 }