Пример #1
0
        private static void Main(string[] args)
        {
            Console.Title = @"Fleet Client Console";

            IFleetManagerClient client = null;

            Parser.Default.ParseArguments <ConfigureClientOptions>(args)
            .WithParsed <ConfigureClientOptions>(o =>
            {
                client = o.CreateTcpFleetManagerClient();
            }
                                                 )
            .WithNotParsed <ConfigureClientOptions>(o =>
            {
                Environment.Exit(-1);
            });

            while (true)
            {
                Console.Write("fc>");
                args = Console.ReadLine().Split();

                Parser.Default.ParseArguments
                <CreateVirtualVehicleOptions,
                 GetKingpinDescriptionOptions,
                 RemoveOptions,
                 FreezeOption,
                 UnfreezeOption,
                 SetFleetStateOption,
                 SetKingpinStateOption,
                 SetPoseOptions,
                 GetSemVerOptions
                >
                    (args)
                .MapResult(
                    (CreateVirtualVehicleOptions opts) => opts.ExecuteOption(client),
                    (GetKingpinDescriptionOptions opts) => opts.ExecuteOption(client),
                    (RemoveOptions opts) => opts.ExecuteOption(client),
                    (FreezeOption opts) => opts.ExecuteOption(client),
                    (UnfreezeOption opts) => opts.ExecuteOption(client),
                    (SetFleetStateOption opts) => opts.ExecuteOption(client),
                    (SetKingpinStateOption opts) => opts.ExecuteOption(client),
                    (SetPoseOptions opts) => opts.ExecuteOption(client),
                    (GetSemVerOptions opts) => opts.ExecuteOption(client),
                    errs => ServiceCallResultFactory.FromClientException(new Exception("Operation failed"))
                    );
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.Title = @"Scheduling Clients Console";

            EndpointSettings endpointSettings = null;

            Parser.Default.ParseArguments <ConfigureEndpointSettingsOptions>(args)
            .WithParsed <ConfigureEndpointSettingsOptions>(o =>
            {
                endpointSettings = o.CreateTcpEndpointSettings();
            }
                                                           )
            .WithNotParsed <ConfigureEndpointSettingsOptions>(o =>
            {
                Environment.Exit(-1);
            });

            IAgentClient    agentClient    = ClientFactory.CreateTcpAgentClient(endpointSettings);
            IJobStateClient jobStateClient = ClientFactory.CreateTcpJobStateClient(endpointSettings);

            while (true)
            {
                Console.Write("sc>");
                args = Console.ReadLine().Split();

                Parser.Default.ParseArguments
                <Agent_GetAllAgentsInService,
                 JobState_GetCurrentJobSummaryForAgentId>
                    (args)
                .MapResult(
                    (Agent_GetAllAgentsInService opts) => opts.ExecuteOption(agentClient),
                    (JobState_GetCurrentJobSummaryForAgentId opts) => opts.ExecuteOption(jobStateClient),
                    errs => ServiceCallResultFactory.FromClientException(new Exception("Operation failed"))
                    );
            }
        }