Exemplo n.º 1
0
        /// <summary>
        /// The run command async.
        /// </summary>
        /// <param name="url">
        /// The url.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public static void RunAsync(string url)
        {
            Task.Run(() =>
            {
                try
                {
                    var commandPath = GetPathFromUrl(url);
                    var command     = ServiceRouteProvider.GetCommand(commandPath);

                    if (command == null)
                    {
                        Log.Error($"Command for path = {commandPath} is null or invalid.");
                        return;
                    }

                    var queryParameters = GetQueryParameters(url);
                    command.Invoke(queryParameters);
                }
                catch (Exception exception)
                {
                    Log.Error(exception);
                }
            });
        }