Beispiel #1
0
        static async Task RunLoop(IEndpointInstance endpointInstance)
        {
            while (true)
            {
                log.Info("Press 'P' to performCommand, or 'Q' to quit.");
                var key = Console.ReadKey();
                Console.WriteLine();

                switch (key.Key)
                {
                case ConsoleKey.P:
                    var plugin = PluginsHandler.Instance.GetPluginByPluginName("BasicMathPlugin");
                    foreach (var command in PluginsHandler.Instance.GetCommandNamesByPluginName("BasicMathPlugin"))
                    {
                        await TransportLogic.SendCommand(endpointInstance,
                                                         new Plugin { PluginGuid = plugin.PluginGuid, PluginName = plugin.PluginName, PluginReadableName = plugin.PluginReadableName },
                                                         command,
                                                         JsonConvert.SerializeObject(new object[] { 3, 5 }));
                    }
                    break;

                case ConsoleKey.Q:
                    return;

                default:
                    log.Info("Unknown input. Please try again.");
                    break;
                }
            }
        }