private static void AdLoaderDidReceiveNativeCustomTemplateAdCallback( IntPtr adLoader, IntPtr nativeCustomTemplateAd, string templateID) { AdLoaderClient client = IntPtrToAdLoaderClient(adLoader); Action <CustomNativeTemplateAd, string> clickHandler = client.customNativeTemplateCallbacks.ContainsKey(templateID) ? client.customNativeTemplateCallbacks[templateID] : null; if (client.OnCustomNativeTemplateAdLoaded != null) { CustomNativeEventArgs args = new CustomNativeEventArgs() { nativeAd = new CustomNativeTemplateAd(new CustomNativeTemplateClient( nativeCustomTemplateAd, clickHandler)) }; client.OnCustomNativeTemplateAdLoaded(client, args); } }
private static void AdLoaderDidFailToReceiveAdWithErrorCallback( IntPtr adLoader, string error) { AdLoaderClient client = IntPtrToAdLoaderClient(adLoader); AdFailedToLoadEventArgs args = new AdFailedToLoadEventArgs() { Message = error }; client.OnAdFailedToLoad(client, args); }
private static void AdLoaderDidFailToReceiveAdWithErrorCallback( IntPtr adLoader, IntPtr error) { AdLoaderClient client = IntPtrToAdLoaderClient(adLoader); if (client.OnAdFailedToLoad != null) { LoadAdErrorClientEventArgs args = new LoadAdErrorClientEventArgs() { LoadAdErrorClient = new LoadAdErrorClient(error), Message = Externs.GADUGetAdErrorMessage(error) }; client.OnAdFailedToLoad(client, args); } }
private static void AdLoaderDidReceiveNativeCustomTemplateAdCallback( IntPtr adLoader, IntPtr nativeCustomTemplateAd, string templateID) { AdLoaderClient client = IntPtrToAdLoaderClient(adLoader); CustomNativeTemplateClient adClient = new CustomNativeTemplateClient( nativeCustomTemplateAd); if (client.OnCustomNativeTemplateAdClicked != null && client.TemplateIds[templateID] == true) { WeakReference weakClient = new WeakReference(adClient); adClient.clickHandler = delegate(string assetName) { if (weakClient.IsAlive) { CustomNativeTemplateClient strongClient = weakClient.Target as CustomNativeTemplateClient; CustomNativeClientEventArgs args = new CustomNativeClientEventArgs() { nativeAdClient = strongClient, assetName = assetName }; client.OnCustomNativeTemplateAdClicked(client, args); } }; } if (client.OnCustomNativeTemplateAdLoaded != null) { CustomNativeClientEventArgs args = new CustomNativeClientEventArgs() { nativeAdClient = adClient, assetName = null }; client.OnCustomNativeTemplateAdLoaded(client, args); } }
internal static extern void GADUSetAdLoaderCallbacks( IntPtr adLoader, AdLoaderClient.GADUAdLoaderDidReceiveNativeCustomTemplateAdCallback adReceivedCallback, AdLoaderClient.GADUAdLoaderDidFailToReceiveAdWithErrorCallback adFailedCallback);