public void MessageReceived(Message msg)
 {
     if (msg.MessageType == MessageTypes.NetworkWarning)
     {
         HasNetworkConnectionWarning = true;
     }
 }
Ejemplo n.º 2
0
 public static void SendMessage(Message message)
 {
     foreach (var listener in Listeners.Where(t => t.Value.Contains(message.MessageType)))
     {
         listener.Key.MessageReceived(message);
     }
 }
Ejemplo n.º 3
0
        public static bool CheckNetworkAvailability()
        {
            var hasConn = Task.Run(() => PingGoogle()).Result;

            if (!hasConn)
            {
                var msg = new Message(MessageTypes.NetworkWarning, "No internet connection. Check your wifi or cable connection.");
                MessageManager.SendMessage(msg);
            }

            return hasConn;
        }
Ejemplo n.º 4
0
        public Server()
        {
            this.IsMulticastConnected = false;
            this._receiver = new UdpSocketMulticastClient();
            this._receiver.MessageReceived += MessageReceived;
            this._listener = new TcpSocketListener();
            this._listener.ConnectionReceived += ListenerConnectionReceived;
            IsMulticastConnected = JoinMultiUdp();

            if (!IsMulticastConnected)
            {
                var msg = new Message(MessageTypes.NetworkWarning, "Cannot connect to multicast UDP.");
                MessageManager.SendMessage(msg);
            }
        }