Class ComplicationProvider
Definition
- Namespace:
- Tizen.Applications.WatchfaceComplication
- Assembly:
- Tizen.Applications.WatchfaceComplication.dll
Represents the complication provider for a service application.
public abstract class ComplicationProvider : IDisposable
- Inheritance
-
objectComplicationProvider
- Implements
-
System.IDisposable
Constructors
View SourceComplicationProvider(string)
Initializes a new instance of the ComplicationProvider class.
Declaration
protected ComplicationProvider(string providerId)
Parameters
Type | Name | Description |
---|---|---|
string | providerId | The id of the complication provider. |
Examples
public class MyComplicationProvider : ComplicationProvider
{
public MyComplicationProvider(string providerId)
: base(providerId)
{
}
protected override void OnDataUpdateRequested(string reqestAppId, ComplicationTypes type, Bundle contextData)
{
}
}
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when providerId is invalid. |
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
System.NotSupportedException | Thrown when the watchface complication is not supported. |
System.UnauthorizedAccessException | Thrown when the application does not have privilege to access this method. |
Properties
View SourceId
Gets the provider ID.
Declaration
public string Id { get; }
Property Value
Type | Description |
---|---|
string |
Methods
View SourceDispose()
Releases all resources used by the ComplicationProvider class.
Declaration
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the ComplicationProvider instance specifying whether to perform a normal dispose operation.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true for a normal dispose operation; false to finalize the handle. |
~ComplicationProvider()
Destructor of the provider class.
Declaration
protected ~ComplicationProvider()
GetEventComplicationType(ReceivedAppControl)
Gets the complication type of the received appcontrol.
Declaration
public static ComplicationTypes GetEventComplicationType(ReceivedAppControl recvAppCtrl)
Parameters
Type | Name | Description |
---|---|---|
ReceivedAppControl | recvAppCtrl | The received appcontrol. |
Returns
Type | Description |
---|---|
ComplicationTypes | The target complication type of received event |
Examples
protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
{
ComplicationTypes type = ComplicationProvider.GetEventComplicationType(e.ReceivedAppControl);
base.OnAppControlReceived(e);
}
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when e is invalid. |
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
System.NotSupportedException | Thrown when the watchface complication is not supported. |
GetEventContext(ReceivedAppControl)
Gets the complication context of appcontrol that raises the event.
Declaration
public static Bundle GetEventContext(ReceivedAppControl recvAppCtrl)
Parameters
Type | Name | Description |
---|---|---|
ReceivedAppControl | recvAppCtrl | The received appcontrol. |
Returns
Type | Description |
---|---|
Bundle | The context of received event |
Examples
protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
{
Bundle context = ComplicationProvider.GetEventContext(e.ReceivedAppControl);
base.OnAppControlReceived(e);
}
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when e is invalid. |
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
System.NotSupportedException | Thrown when the watchface complication is not supported. |
GetEventProviderId(ReceivedAppControl)
Gets the provider ID of appcontrol that raises the event.
Declaration
public static string GetEventProviderId(ReceivedAppControl recvAppCtrl)
Parameters
Type | Name | Description |
---|---|---|
ReceivedAppControl | recvAppCtrl | The received appcontrol. |
Returns
Type | Description |
---|---|
string | The target provider ID of received event |
Examples
protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
{
string providerId = ComplicationProvider.GetEventProviderId(e.ReceivedAppControl);
base.OnAppControlReceived(e);
}
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when e is invalid. |
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
System.NotSupportedException | Thrown when the watchface complication is not supported. |
GetEventType(ReceivedAppControl)
Gets the received event type.
Declaration
public static EventTypes GetEventType(ReceivedAppControl recvAppCtrl)
Parameters
Type | Name | Description |
---|---|---|
ReceivedAppControl | recvAppCtrl | The received appcontrol. |
Returns
Type | Description |
---|---|
EventTypes | The type of received event |
Examples
protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
{
EventTypes type = ComplicationProvider.GetEventType(e.ReceivedAppControl);
if (type == EventTypes.EventDoubleTap)
{
// do something
}
base.OnAppControlReceived(e);
}
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the invalid parameter is passed. |
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
System.NotSupportedException | Thrown when the watchface complication is not supported. |
NotifyUpdate()
Emits the update event for complications.
Declaration
public void NotifyUpdate()
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown when the application does not have privilege to access this method. |
System.NotSupportedException | Thrown when the watchface complication is not supported. |
OnDataUpdateRequested(string, ComplicationTypes, Bundle)
Overrides this method to handle the behavior when the event for requesting the update of complication data comes from watchface complication.
Declaration
protected abstract ComplicationData OnDataUpdateRequested(string reqestAppId, ComplicationTypes type, Bundle contextData)
Parameters
Type | Name | Description |
---|---|---|
string | reqestAppId | The ID of application which sent update request. |
ComplicationTypes | type | The requested type. |
Bundle | contextData | The complication's context which is set by complication setup application. |
Returns
Type | Description |
---|---|
ComplicationData | The requested ComplicationData |