Ejemplo n.º 1
0
        /// <summary>
        /// Returns all imported ads networks.
        /// </summary>
        private static List <IAdClient> GetAvailableNetworks <T>()
        {
            List <IAdClient> availableNetworks = new List <IAdClient>();

            foreach (T network in Enum.GetValues(typeof(T)))
            {
                AdClientImpl client = GetAdClient((AdNetwork)(Enum.Parse(typeof(T), network.ToString())));
                if (client.IsSdkAvail)
                {
                    var workableClient = GetWorkableAdClient((AdNetwork)(Enum.Parse(typeof(T), network.ToString())));
                    availableNetworks.Add(workableClient);
                }
            }
            return(availableNetworks);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Grabs the singleton ad client for the specified network and performs
        /// necessary setup for it, including initializing it and subscribing to its events.
        /// </summary>
        /// <returns>The ad client.</returns>
        /// <param name="network">Network.</param>
        private static AdClientImpl SetupAdClient(AdNetwork network)
        {
            AdClientImpl client = GetAdClient(network);

            if (client != null && client.Network != AdNetwork.None)
            {
                // Subscribe client's events.
                SubscribeAdClientEvents(client);

                // Initialize ad client.
                if (!client.IsInitialized)
                {
                    client.Init();
                }
            }

            return(client);
        }