Example #1
0
        static void Main(string[] args)
        {
            Tuple<string, string, int> parsedArgs = ValidateEventArgs(args);
            if (parsedArgs == null)
                return;

            string host = parsedArgs.Item1;
            string userName = parsedArgs.Item2;
            int port = parsedArgs.Item3;

            try
            {

                Console.WriteLine("Type user name and than text message. Press \"q\" for exit...");

                SimpleClient client = new SimpleClient(host, port);
                client.Login(userName);

                string remoteUserName = null;
                string message = null;
                while (true)
                {
                    string tmp = Console.ReadLine();
                    if (tmp == "q")
                        break;
                    if (remoteUserName == null)
                        remoteUserName = tmp;
                    else
                    {
                        message = tmp;
                        client.SendTextMessage(remoteUserName, message);

                        remoteUserName = null;
                        message = null;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error! {0}", e);
            }
            Console.ReadLine();
        }