Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            User user = new User();

            user.FirstName = "Md";
            user.LastName  = "Rahman";
            user.Email     = "*****@*****.**";

            Console.WriteLine("Please Enter your FirstName");
            user.FirstName = Console.In.ReadLine();

            Console.WriteLine("Please Enter your LastName");
            user.LastName = Console.In.ReadLine();

            Console.WriteLine("Please Enter your Email");
            user.Email = Console.In.ReadLine();

            UserNameBuilder.GenerateUserName(user);
            Console.WriteLine("Hello " + user.UserName + "!");
        }
        public static InlineKeyboardMarkup CreateUserSelectionKeyboardMarkup(string command, IList <User> users, ISet <int> selectedUser)
        {
            FillCallbackStringData fillCallbackStringData = data => new InlineKeyboardCallback(command, data).ToString();
            FillCallbackButtonData fillCallbackButtonData = data => new InlineKeyboardCallback(command, data).ToString();
            UserNameBuilder        userNameBuilder        = (user) =>
            {
                var userName = "";
                if (selectedUser.Contains(user.Id))
                {
                    userName += "\u2705";
                }
                userName += user.FirstName + " " + user.LastName;
                return(userName);
            };
            var buttons   = new List <InlineKeyboardButton[]>();
            var rowButton = new List <InlineKeyboardButton>();

            foreach (var user in users)
            {
                rowButton.Add(new InlineKeyboardButton(userNameBuilder(user), fillCallbackStringData(user.Id.ToString())));
                if (rowButton.Count != 3)
                {
                    continue;
                }
                buttons.Add(rowButton.ToArray());
                rowButton = new List <InlineKeyboardButton>();
            }
            if (rowButton.Count > 0)
            {
                buttons.Add(rowButton.ToArray());
            }
            buttons.Add(new []
            {
                new InlineKeyboardButton("OK", fillCallbackButtonData(Button.Ok))
            });
            return(new InlineKeyboardMarkup(buttons.ToArray()));
        }