2using System.Diagnostics;
3using YandexMobileAds.Base;
16 public abstract partial class YandexAdUnit<TAd>
21 public DateTime?
LoadTime {
get;
protected set; }
23 private long? loadingStartTimestamp;
53 private void SetLoadingTime()
56 ? (long)((Stopwatch.GetTimestamp() - startTimestamp) * 1000d / Stopwatch.Frequency)
58 loadingStartTimestamp =
null;
62 protected override void OnAdPaid(
object adValue) =>
throw new NotSupportedException();
72 base.OnAdImpressionRecorded();
92 protected virtual void OnAdLoadFailed(
object sender, AdFailedToLoadEventArgs args)
96 base.OnAdLoadFailed(args.Message);
99#if !LEGACY_YANDEX_MOBILE_ADS
113 base.OnAdLoadFailed(args.Message);
133 protected virtual void OnAdShown(
object sender, EventArgs e)
144 protected virtual void OnAdClosed(
object sender, EventArgs e)
158 base.OnAdContentFailed(e.Message);
169 base.OnUserEarnedReward(reward);
int Amount
The numeric amount of the reward.
string Name
The semantic type or name of the reward.
Represents a backend-agnostic description of an ad reward.
string GetId()
Determines and returns the appropriate ad ID based on the current platform and ad mode....
virtual LogOptions LogOptions
virtual void PrepareAdObject()
Optional overridable method for setting up the AdObject. This can be used for initializing or customi...
virtual void OnAdContentFailed(object sender, AdFailureEventArgs e)
Handles the ad content failed event, logging the error encountered while displaying the ad content.
long? LoadingTimeMs
Gets the duration of the latest successful ad-loading request in milliseconds. Divide the value by 10...
override void OnAdPaid(object adValue)
Raised when the AdObject is estimated to have earned money.
virtual void OnAdLoadFailed(object sender, AdLoadingException args)
Handles the ad load failure event, logging the failure reason and the ad unit ID, and reporting the f...
virtual void OnAdClosed(object sender, EventArgs e)
Handles the ad closed event, logging that the ad was closed by the user.
virtual void OnAdClicked(object sender, EventArgs e)
Handles the ad click event, logging that the ad was clicked by the user.
virtual void OnAdLoadFailed(object sender, AdFailedToLoadEventArgs args)
Handles the ad load failure event, logging the failure reason and the ad unit ID, and reporting the f...
void ResetLoadingStartTime()
Clears the saved start time when an ad-loading request cannot be started.
void OnAdLoadFailed(object sender, AdFailureEventArgs e)
DateTime? LoadTime
Date and time when the ad was loaded.
void SetLoadingStartTime()
Saves the start time of an ad-loading request.
virtual void OnAdShown(object sender, EventArgs e)
Handles the event when an ad is shown to the user, logging the occurrence.
virtual void OnUserEarnedReward(object sender, AdRewardBase reward)
Handles the event where a user earns a reward from interacting with an ad, logging the reward type an...
override void OnAdLoaded()
Handles the ad loaded event, setting the load time, preparing the ad object for display,...
virtual void OnAdImpression(object sender, ImpressionData e)
Handles the impression event for an ad, logging the impression data and marking the impression as rec...