예제 #1
0
        private static void joinChatroom(int port, string username)
        {
            DuplexChannelFactory <Chatroom> dupFactory = null;
            Chatroom    clientProxy = null;
            TextChatter _chatter    = new TextChatter();

            dupFactory = new DuplexChannelFactory <Chatroom>(
                _chatter, new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:" + port + "/Chat"));
            dupFactory.Open();
            clientProxy = dupFactory.CreateChannel();

            Console.WriteLine("Bienvenue dans la room {0}", username);
            clientProxy.join(username);
            string input = null;

            while (input != "exit")
            {
                input = Console.ReadLine();
                clientProxy.send(input, username);
                Console.SetCursorPosition(0, Console.CursorTop - 2);
                ClearCurrentConsoleLine();
                Console.SetCursorPosition(0, Console.CursorTop + 2);
            }

            dupFactory.Close();
        }
예제 #2
0
        static void Main(string[] args)
        {
            ChannelFactory <AuthentificationManager> dupFactory = null;
            AuthentificationManager clientProxy = null;
            TextChatter             _chatter    = new TextChatter();

            dupFactory = new ChannelFactory <AuthentificationManager>(
                new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8999/AuthManager"));
            dupFactory.Open();
            clientProxy = dupFactory.CreateChannel();
            int    menu = 0;
            string username;

            while (menu == 0)
            {
                Console.WriteLine("Entrez votre username:"******" Entrez votre password:"******"1.Se connecter \n 2.s'inscrire");
                switch (Console.ReadLine())
                {
                case "1":

                    if (clientProxy.login(username, password))
                    {
                        joinTopicsManager(username);
                    }

                    break;

                case "2":
                    clientProxy.addUser(username, password);
                    break;
                }
            }
        }
예제 #3
0
파일: Program.cs 프로젝트: HelloItsDev/Chat
        private static void joinChatroom(int port, string username)
        {
            DuplexChannelFactory<Chatroom> dupFactory = null;
            Chatroom clientProxy = null;
            TextChatter _chatter = new TextChatter();
            dupFactory = new DuplexChannelFactory<Chatroom>(
                _chatter, new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:"+ port +"/Chat"));
            dupFactory.Open();
            clientProxy = dupFactory.CreateChannel();

            Console.WriteLine("Bienvenue dans la room {0}",username);
            clientProxy.join(username);
            string input = null;
            while (input != "exit")
            {
                input = Console.ReadLine();
                clientProxy.send(input, username);
                Console.SetCursorPosition(0, Console.CursorTop - 2);
                ClearCurrentConsoleLine();
                Console.SetCursorPosition(0, Console.CursorTop + 2);
            }

            dupFactory.Close();
        }
예제 #4
0
파일: Program.cs 프로젝트: HelloItsDev/Chat
        static void Main(string[] args)
        {
            ChannelFactory<AuthentificationManager> dupFactory = null;
            AuthentificationManager clientProxy = null;
            TextChatter _chatter = new TextChatter();
            dupFactory = new ChannelFactory<AuthentificationManager>(
                new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8999/AuthManager"));
            dupFactory.Open();
            clientProxy = dupFactory.CreateChannel();
            int menu = 0;
            string username;
            while(menu == 0)
            {
                Console.WriteLine("Entrez votre username:"******" Entrez votre password:"******"1.Se connecter \n 2.s'inscrire");
                switch (Console.ReadLine())
                {

                    case "1":

                        if (clientProxy.login(username, password))
                        {
                            joinTopicsManager(username);
                        }

                        break;
                    case "2":
                        clientProxy.addUser(username, password);
                        break;

                }
            }
        }