Ejemplo n.º 1
0
        public T GetInstance <T>(ObjectPath path, string interfaceName, string serviceName, out IDBusObjectProxy <T> container)
        {
            IClientObjectProvider preferred = null;
            IClientObjectProvider first     = null;

            foreach (var prov in proxyProviders)
            {
                var pref = prov.TypePreference <T>();
                if (preferred == null)
                {
                    if (pref == ProviderPreferences.Preferred)
                    {
                        preferred = prov;
                        break;
                    }
                }
                if (first == null && pref != ProviderPreferences.UnableToGet)
                {
                    first = prov;
                }
            }
            if (preferred == null)
            {
                preferred = first;
            }
            if (preferred == null)
            {
                throw new ArgumentException($"Unable to find proxy provider to create instance for {typeof(T)}");
            }
            return(preferred.GetInstance <T>(path, interfaceName, serviceName, out container));
        }
Ejemplo n.º 2
0
 public static T GetInstance <T>(this IClientObjectProvider provider, ObjectPath path, string interfaceName, string serviceName)
 {
     return(provider.GetInstance(path, interfaceName, serviceName, out IDBusObjectProxy <T> _));
 }