Пример #1
0
        protected internal virtual IMap <string, string> Invoke(ServiceAction action,
                                                                IDictionary <string, string> arguments,
                                                                int retryAttempts)
        {
            // TODO try dispose on timeout
            if (control_client == null)
            {
                throw new InvalidOperationException(
                          "The service controller was created to describe a local service and cannot be invoked " +
                          "across the network. Use the constructor which takes a Deserializer.");
            }

            while (true)
            {
                try {
                    return(control_client.Invoke(action.Name, arguments));
                } catch (UpnpControlException) {
                    if (retryAttempts > 0)
                    {
                        retryAttempts--;
                        System.Threading.Thread.Sleep(5000);
                    }
                    else
                    {
                        throw;
                    }
                }
            }
        }
Пример #2
0
        protected internal virtual IMap <string, string> Invoke(ServiceAction action,
                                                                IDictionary <string, string> arguments,
                                                                int retryAttempts)
        {
            // TODO try dispose on timeout
            // TODO retry attempts
            if (control_client == null)
            {
                throw new InvalidOperationException(
                          "The service controller was created to describe a local service and cannot be invoked " +
                          "across the network. Use the constructor which takes a Deserializer.");
            }

            return(control_client.Invoke(action.Name, arguments));
        }