示例#1
0
        public void Run(string name, TcpClient client)
        {
            IOutputSystem outputSystem = new ConsoleOutput();
            ISystemInput  systemInput  = new SystemInput();

            //IMenuBuilder launcRocket = new TextMenuBuilder("Launch Menu : ", outputSystem, systemInput);

            ServerHandler serverHandler      = new ServerHandler(name, client);
            IMenuBuilder  managerMenuBuilder = new NumberMenuBuilder("Manager options : ", outputSystem, systemInput)
                                               .AddOptions("Add user from group", new AddUserToChatOption(name, serverHandler))
                                               .AddOptions("Remove user from group", new RemoveUserFromChatOption(name, serverHandler))
                                               .AddOptions("Add user as admin", new AddManagerPermissionOption(name, serverHandler))
                                               .AddOptions("Remove user as admin", new RemoveManagerPermissionOption(name, serverHandler));



            IMenu numberMenuBuilder = new NumberMenuBuilder("Chat options : ", outputSystem, systemInput).
                                      AddOptions("Get All Chats", new GetAllChatOption(serverHandler)).
                                      AddOptions("Create Private Chat", new PrivateChatCreatorOption(name, serverHandler)).
                                      AddOptions("Create Group Chat", new GroupChatCreatorOption(name, serverHandler)).
                                      AddOptions("Manager Options", new NavigateMenuOption(managerMenuBuilder.Build())).
                                      AddOptions("Go into chat", new InsertToChatOption(serverHandler)).
                                      AddOptions("Exit from Group", new ExitChatOption(name, serverHandler)).
                                      AddOptions("Exit from chat", new MenuExitOption())
                                      .Build();

            managerMenuBuilder.AddOptions("MoveBack", new NavigateMenuOption(numberMenuBuilder));


            //launcRocket.AddOptions("MoveBack", new NavigateMenu(numberMenuBuilder))


            numberMenuBuilder.Run();
        }
示例#2
0
        public void Run()
        {
            ServerHandler serverHandler      = new ServerHandler(_containerInterfaces, _user);
            IMenuBuilder  managerMenuBuilder = new NumberMenuBuilder("Manager options : ", _containerInterfaces.SystemOutput, _containerInterfaces.SystemInput)
                                               .AddOptions("Add user from group", new AddUserToChatOption(_containerInterfaces, _user, serverHandler))
                                               .AddOptions("Remove user from group", new RemoveUserFromChatOption(_containerInterfaces, _user, serverHandler))
                                               .AddOptions("Add user as admin", new AddManagerPermissionOption(_containerInterfaces, _user, serverHandler))
                                               .AddOptions("Remove user as admin", new RemoveManagerPermissionOption(_containerInterfaces, _user, serverHandler));

            IMenu numberMenuBuilder = new NumberMenuBuilder("Chat options : ", _containerInterfaces.SystemOutput, _containerInterfaces.SystemInput).
                                      AddOptions("Get All Chats", new GetAllChatOption(_containerInterfaces, serverHandler)).
                                      AddOptions("Create Private Chat", new PrivateChatCreatorOption(_containerInterfaces, _user, serverHandler)).
                                      AddOptions("Create Group Chat", new GroupChatCreatorOption(_containerInterfaces, _user, serverHandler)).
                                      AddOptions("Manager Options", new NavigateMenuOption(managerMenuBuilder.Build())).
                                      AddOptions("Go into chat", new InsertToChatOption(_containerInterfaces, serverHandler)).
                                      AddOptions("Execute commands", new CommandRequestOption(_containerInterfaces, serverHandler)).
                                      AddOptions("Exit from Group", new ExitChatOption(_containerInterfaces, _user, serverHandler)).
                                      AddOptions("Exit from chat", new MenuExitOption())
                                      .Build();

            managerMenuBuilder.AddOptions("MoveBack", new NavigateMenuOption(numberMenuBuilder));

            numberMenuBuilder.Run();
        }