示例#1
0
        private static void Main()
        {
            var mc           = CreateAgentContainer();
            var agentBuilder = new AgentBuilder(mc);

            var serviceProvider = agentBuilder.Create <ServiceFinderAgent>().Build();

            serviceProvider.start();

            Thread.Sleep(1000);

            var hotelAgent = agentBuilder.Create <HotelProviderAgent>().Build();

            hotelAgent.start();

            var transportAgent = agentBuilder.Create <TransportProviderAgent>().Build();

            transportAgent.start();

            var attractionAgent = agentBuilder.Create <TouristAttractionsAgent>().Build();

            attractionAgent.start();

            Thread.Sleep(1000);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var client = agentBuilder.Create <ClientSearchVacantionPackageAgent>().Build();

            client.start();
        }
示例#2
0
        private static void Main(string[] args)
        {
            var mc           = CreateAgentContainer();
            var agentBuilder = new AgentBuilder(mc);

            var serviceProvider = agentBuilder.Create <ServiceFinderAgent>().Build();

            serviceProvider.start();

            Thread.Sleep(2000);
            Console.WriteLine();

            var hotelAgent = agentBuilder.Create <HotelProviderAgent>().Build();

            hotelAgent.start();

            var transportAgent = agentBuilder.Create <TransportProviderAgent>().Build();

            transportAgent.start();

            Thread.Sleep(2000);
            Console.WriteLine();

            var client = agentBuilder.Create <ClientSearchVacantionPackageAgent>().Build();

            client.start();
        }
示例#3
0
        public IAgent Execute(ConnectionArgument argument)
        {
            var agent = AgentBuilder.GetAgent(argument);

            agent.OnLogMessage = OnLogMessageReceived;
            agent.OnConnectionStatusChanged = OnConnectionStatusChangedReceived;
            InitProgressBar(argument.Connections);
            agent.StartAgent();
            return(agent);
        }
示例#4
0
        public static void AddInbox(this AgentBuilder builder)
        {
            var collection = builder.Services;

            collection.TryAddSingleton <IInboxService, MemoryInboxService>();

            collection.TryAddSingleton <ForwardMessageHandler>();
            collection.TryAddSingleton <AddInboxDeviceHandler>();
            collection.TryAddSingleton <AddInboxDeviceHandler>();
            collection.TryAddSingleton <CreateInboxHandler>();
            collection.TryAddSingleton <GetMessagesHandler>();
            collection.TryAddSingleton <DeleteMessagesHandler>();
        }
示例#5
0
        public static void AddInbox <T>(this AgentBuilder builder)
            where T : class, IInboxService
        {
            var collection = builder.Services;

            collection.TryAddSingleton <IInboxService, T>();

            collection.TryAddSingleton <ForwardMessageHandler>();
            collection.TryAddSingleton <AddInboxDeviceHandler>();
            collection.TryAddSingleton <AddInboxDeviceHandler>();
            collection.TryAddSingleton <CreateInboxHandler>();
            collection.TryAddSingleton <GetMessagesHandler>();
            collection.TryAddSingleton <DeleteMessagesHandler>();
        }
        public List <ConsoleFlowResult> Run()
        {
            var consoleFlow = new ConsoleWizard
            {
                IsStepCountVisible = true
            };

            var basicConfigurationPage = new ConsoleReadItemsPage(new List <ConsoleReadItem> {
                new ConsoleReadItem {
                    Question = "What is the target URL of Hub? :", Validator = TargetUrlValidator, ValidationErrorMessage = "Please enter a valid url"
                },
                new ConsoleReadItem {
                    Question = "what is the name of Hub? :"
                },
                new ConsoleReadItem {
                    Question = "How many connections you want to ramp up? :", ItemType = typeof(int), ValidationErrorMessage = "Please enter a numeric value"
                }
            }, ConsoleColor.Cyan);

            var agentSelectionPage = new ConsoleOptionsPage("Which of the below Agents should run the test?", ConsoleColor.Cyan);
            var agentList          = AgentBuilder.GetAgentList();

            agentList.ForEach(agent => agentSelectionPage.AddOption(agent));
            agentSelectionPage.AddExitOption();

            var transportSelectionPage = new ConsoleOptionsPage("Choose the transport mechanism?", ConsoleColor.Cyan);

            transportSelectionPage.AddOption("Websockets");
            transportSelectionPage.AddOption("Long Polling");
            transportSelectionPage.AddOption("Server Sent Events");
            transportSelectionPage.AddOption("Auto");

            var clientTypeSelectionPage = new ConsoleOptionsPage("Choose the client type?", ConsoleColor.Cyan);

            clientTypeSelectionPage.AddOption("SignalR");
            clientTypeSelectionPage.AddOption("SignalR Core");

            consoleFlow.AddPage(basicConfigurationPage);
            consoleFlow.AddPage(agentSelectionPage);
            consoleFlow.AddPage(transportSelectionPage);
            consoleFlow.AddPage(clientTypeSelectionPage);

            return(consoleFlow.Run());
        }