Search Results for

Show / Hide Table of Contents

# Class BannerAd

Banner ad. Anchored to some part of the screen. Call Dispose() to remove when done. Or use Show() / Hide() to toggle visibility.

##### Inheritance

object
BannerAd

##### Implements

IBannerAd
IDisposable
IAdUnit
ILoadableAd
IMonoformattedAd
IResizableAd
IConcealableAd
IAnchoredAd
IAutoRefreshableAd
IAdEventSource

##### Inherited Members

object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()

###### Namespace: AppstockSDK.Api

###### Assembly: Appstock.Api.dll

##### Syntax

    public class BannerAd : IBannerAd, IDisposable, IAdUnit, ILoadableAd, IMonoformattedAd, IResizableAd, IConcealableAd, IAnchoredAd, IAutoRefreshableAd, IAdEventSource

### Constructors

#### BannerAd(AdSize)

Initializes a new instance of the BannerAd class.

##### Declaration

    public BannerAd(AdSize adSize)

##### Parameters

Type | Name | Description
--- | --- | ---
AdSize | adSize | Banner view size.

### Properties

#### AdPosition

Gets or sets ad position (for exchange purposes).

##### Declaration

    public AdPosition AdPosition { get; set; }

##### Property Value

Type | Description
--- | ---
AdPosition | Where the ad itself is logically (header/footer etc.).

##### See Also

AdPosition

#### AdSizes

Sets ad sizes for the ad.

##### Declaration

    public IEnumerable<AdSize> AdSizes { set; }

##### Property Value

Type | Description
--- | ---
IEnumerable<AdSize> | Sizes that ad's content may take.

#### AdUnitFormat

Sets format for the ad unit.

##### Declaration

    public AdFormat AdUnitFormat { set; }

##### Property Value

Type | Description
--- | ---
AdFormat | Ad format for the Ad.

#### AnchoredPosition

Gets or sets the position ad is anchored to.

##### Declaration

    public AnchoredAdPosition AnchoredPosition { get; set; }

##### Property Value

Type | Description
--- | ---
AnchoredAdPosition | Where the ad itself should be placed on screen (edge/corner).

##### See Also

AnchoredPosition

#### AutoRefreshDelay

Gets or sets auto refresh delay (interval).

##### Declaration

    public TimeSpan AutoRefreshDelay { get; set; }

##### Property Value

Type | Description
--- | ---
TimeSpan | How often to refresh the ad content.

#### EndpointID

Sets the endpoint ID for the ad.

##### Declaration

    public string? EndpointID { set; }

##### Property Value

Type | Description
--- | ---
string | Unique endpoint identifier generated on the Appstock platform’s UI.

#### PlacementID

Sets the placement ID for the ad.

##### Declaration

    public string? PlacementID { set; }

##### Property Value

Type | Description
--- | ---
string | Unique placement identifier generated on the Appstock platform’s UI.

### Methods

#### Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

##### Declaration

    public void Dispose()

#### Dispose(bool)

Releases the unmanaged resources used by the class and optionally releases the managed resources.

##### Declaration

    protected virtual void Dispose(bool disposing)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | disposing | `true` to release both managed and unmanaged resources; `false` to release only unmanaged resources.

#### Hide()

Set the ad invisible.

##### Declaration

    public void Hide()

#### LoadAd()

Load the content of the ad.

##### Declaration

    public void LoadAd()

#### Show()

Set the ad visible.

##### Declaration

    public void Show()

#### StopAutoRefresh()

Disable auto-refreshing.

##### Declaration

    public void StopAutoRefresh()

### Events

#### OnAdClicked

Fired when ad was clicked on.

##### Declaration

    public event Action? OnAdClicked

##### Event Type

Type | Description
--- | ---
Action |

#### OnAdClosed

Fired when ad was closed (from fullscreen mode).

##### Declaration

    public event Action? OnAdClosed

##### Event Type

Type | Description
--- | ---
Action |

#### OnAdFailed

Fired when ad failed to load.

##### Declaration

    public event Action<AdError?>? OnAdFailed

##### Event Type

Type | Description
--- | ---
Action<AdError?> |

#### OnAdLoaded

Fired when ad finished loading.

##### Declaration

    public event Action<AdInfo?>? OnAdLoaded

##### Event Type

Type | Description
--- | ---
Action<AdInfo?> |

### Implements

IBannerAd
IDisposable
IAdUnit
ILoadableAd
IMonoformattedAd
IResizableAd
IConcealableAd
IAnchoredAd
IAutoRefreshableAd
IAdEventSource