public void Operation()
        {
            Console.WriteLine("All connected users");
            string allConnectedUser = _serverHandler.GetAllUserConnected();

            Console.WriteLine(allConnectedUser);

            Console.WriteLine("Please enter the name you want to open chat with him");
            string name = Console.ReadLine();

            if (name == _clientname)
            {
                Console.WriteLine($"You cannot create private chat with yourself");
                return;
            }

            if (!allConnectedUser.Contains(name))
            {
                Console.WriteLine($"The user {name} is not in user list");
                return;
            }

            var body = new PrivateChatMessageModel
            {
                RequestType = "PrivateCreationChat",
                lsUsers     = new List <string>()
                {
                    name
                }
            };

            _serverHandler.CreateChat(body);
        }
        public void Operation()
        {
            _containerInterfaces.SystemOutput.Print("All connected users");
            string allConnectedUser = _serverHandler.GetAllUserConnected();

            _containerInterfaces.SystemOutput.Print(allConnectedUser);

            _containerInterfaces.SystemOutput.Print("Please enter the name you want to open chat with him");
            string name = _containerInterfaces.SystemInput.StringInput();

            if (name == _clientname)
            {
                _containerInterfaces.SystemOutput.Print($"You cannot create private chat with yourself");
                return;
            }

            if (!allConnectedUser.Contains(name))
            {
                _containerInterfaces.SystemOutput.Print($"The user {name} is not in user list");
                return;
            }

            var body = new PrivateChatMessageModel
            {
                RequestType = MessageType.PrivateCreationChat,
                lsUsers     = new List <string>()
                {
                    name
                }
            };

            _serverHandler.CreateChat(body);
        }
예제 #3
0
        public void Operation()
        {
            _containerInterfaces.SystemOutput.Print("All connected users");
            string allConnectedUser = _serverHandler.GetAllUserConnected();

            _containerInterfaces.SystemOutput.Print(allConnectedUser);

            _containerInterfaces.SystemOutput.Print("Please enter the name Of the group you want to open");
            string groupName = _containerInterfaces.SystemInput.StringInput();


            _containerInterfaces.SystemOutput.Print("Please enter the name you want to open chat with him | CLICK --stop-- EXIT");
            string name = _containerInterfaces.SystemInput.StringInput();


            List <string> userNames = new List <string>();

            while (name != "stop")
            {
                bool IsNameValidate = ValidateName(allConnectedUser, name, userNames);
                if (IsNameValidate)
                {
                    userNames.Add(name);
                }
                _containerInterfaces.SystemOutput.Print("Please enter the name you want to open chat with him | CLICK --stop-- EXIT");
                name = _containerInterfaces.SystemInput.StringInput();
            }


            var body = new GroupChatMessageModel
            {
                RequestType = MessageType.GroupCreationChat,
                lsUsers     = userNames,
                GroupName   = groupName
            };

            _serverHandler.CreateChat(body);
        }
        public void Operation()
        {
            Console.WriteLine("All connected users");
            string allConnectedUser = _serverHandler.GetAllUserConnected();

            Console.WriteLine(allConnectedUser);

            Console.WriteLine("Please enter the name Of the group you want to open");
            string groupName = Console.ReadLine();


            Console.WriteLine("Please enter the name you want to open chat with him | CLICK --stop-- EXIT");
            string name = Console.ReadLine();


            List <string> userNames = new List <string>();

            while (name != "stop")
            {
                bool IsNameValidate = ValidateName(allConnectedUser, name, userNames);
                if (IsNameValidate)
                {
                    userNames.Add(name);
                }
                Console.WriteLine("Please enter the name you want to open chat with him | CLICK --stop-- EXIT");
                name = Console.ReadLine();
            }


            var body = new GroupChatMessageModel
            {
                RequestType = "GroupCreationChat",
                lsUsers     = userNames,
                GroupName   = groupName
            };

            _serverHandler.CreateChat(body);
        }