示例#1
0
        static void Main(string[] args)
        {
            CmdArguments parsedArgs = new CmdArguments();

            if (!Parser.ParseArgumentsWithUsage(args, parsedArgs))
            {
                return;
            }

            try
            {
                DoAction(parsedArgs).Wait();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception raised: {ex}");
            }
        }
示例#2
0
        static async Task DoAction(CmdArguments args)
        {
            switch (args.Action)
            {
            case Action.AddDevices:
                await AddDeviceAction.Do(args);

                break;

            case Action.DeleteDevices:
                await DeleteDeviceAction.Do(args);

                break;

            case Action.QueryDevices:
                await QueryDevicesAction.Do(args);

                break;

            case Action.UpdateTwin:
                await UpdateTwinAction.Do(args);

                break;

            case Action.ScheduleTwinUpdate:
                await ScheduleTwinUpdateAction.Do(args);

                break;

            case Action.InvokeMethod:
                await InvokeMethodAction.Do(args);

                break;

            case Action.ScheduleDeviceMethod:
                await ScheduleDeviceMethodAction.Do(args);

                break;

            case Action.QueryJobs:
                await QueryJobsAction.Do(args);

                break;

            case Action.QueryJobSummary:
                await QueryJobSummaryAction.Do(args);

                break;

            case Action.CancelJobs:
                await CancelJobsAction.Do(args);

                break;

            case Action.SendMessage:
                await SendMessageAction.Do(args);

                break;

            default:
                throw new ApplicationException($"Unexpected action: {args.Action}");
            }
        }