Beispiel #1
0
        /**public bool ConnectToServer()
         * {
         *  IPEndPoint ep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8000);
         *  client = new TcpClient();
         *  try
         *  {
         *      client.Connect(ep);
         *      isConnected = true;
         *      Console.WriteLine("You are connected");
         *      return true;
         *  }
         *  catch
         *  {
         *      Console.WriteLine("Unable to connect to server. Please check your connection.");
         *      isConnected = false;
         *      return false;
         *  }
         * }*/

        /// <summary>
        /// Sends the message to server.
        /// </summary>
        /// <param name="commandID">The command identifier.</param>
        /// <param name="args">The arguments.</param>
        public void SendMessageToServer(CommandEnum commandID, string[] args)
        {
            Task.Run(() => clientChannel.SendMessageToServer(new CommandEventArgs()
            {
                CommandID = commandID, CommandArgs = args
            }));
        }
Beispiel #2
0
 public void SendCommand(CommandEnum commandID, string[] args)
 {
     client.SendMessageToServer(new CommandEventArgs()
     {
         CommandID = commandID, CommandArgs = args
     });
 }