private void StopClient() { try { _zeroConfig?.Stop(); _zeroConfig = null; NowPlayingUpdater.Stop(); StatusUpdater.Stop(); _mpMessageHandler.UnsubscribeFromMessages(); } catch (Exception ex) { ServiceRegistration.Get <ILogger>().Error("WifiRemote: Failed to stop server", ex); } }
public static void OnMessageReceived(SystemMessage message) { // React to player changes PlayerManagerMessaging.MessageType messageType = (PlayerManagerMessaging.MessageType)message.MessageType; IPlayerSlotController psc; switch (messageType) { case PlayerManagerMessaging.MessageType.PlayerResumeState: Logger.Debug("WifiRemote: Player Resume"); //Resume(); break; case PlayerManagerMessaging.MessageType.PlaybackStateChanged: Logger.Debug("WifiRemote: Playback State Changed"); SendMessageToAllClients.Send(WifiRemotePlugin.MessageStatus, ref SocketServer.Instance.connectedSockets); break; case PlayerManagerMessaging.MessageType.PlayerError: Logger.Error("WifiRemote: Player Error"); break; case PlayerManagerMessaging.MessageType.PlayerEnded: case PlayerManagerMessaging.MessageType.PlayerStopped: Logger.Debug("WifiRemote: Player Stopped or Ended"); SendMessageToAllClients.Send(WifiRemotePlugin.MessageStatus, ref SocketServer.Instance.connectedSockets); NowPlayingUpdater.Stop(); break; case PlayerManagerMessaging.MessageType.PlayerStarted: Logger.Debug("WifiRemote: Player Started"); SendMessageToAllClients.Send(WifiRemotePlugin.MessageStatus, ref SocketServer.Instance.connectedSockets); NowPlayingUpdater.Start(); break; case PlayerManagerMessaging.MessageType.VolumeChanged: Logger.Debug("WifiRemote: Volume changed"); SendMessageToAllClients.Send(new MessageVolume(), ref SocketServer.Instance.connectedSockets); break; } }