Class Complication

Definition

Namespace:
Tizen.Applications.WatchfaceComplication
Assembly:
Tizen.Applications.WatchfaceComplication.dll
API Level:
6

Represents the complication for a watch application.

C#
Copy
public abstract class Complication : IEditable, IDisposable
Inheritance
System.Object
Complication
Implements
System.IDisposable

Constructors

View Source

Complication(Int32, ComplicationTypes, EventTypes, String, ComplicationTypes)

Initializes the Complication class.

Declaration
C#
Copy
protected Complication(int complicationId, ComplicationTypes supportTypes, EventTypes supportEvents, string defaultProviderId, ComplicationTypes defaultType)
Parameters
Type Name Description
Int32 complicationId

The id of the complication.

ComplicationTypes supportTypes

The complication support types.

EventTypes supportEvents

The complication's support events.

System.String defaultProviderId

The complication's default provider ID.

ComplicationTypes defaultType

The complication's default type.

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { } } _complication = new MyComplication(_complicationId, (int)(ComplicationTypes.ShortText | ComplicationTypes.Image), (int) EventTypes.EventNone, _complicationProviderId, ComplicationTypes.ShortText, _complicationBtn);
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.

UnauthorizedAccessException

Thrown when the application does not have privilege to access this method.

API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/datasharinghttp://tizen.org/privilege/packagemanager.info

Properties

View Source

AllowedList

The information of specific allowed provider id, support types list for complication

Declaration
C#
Copy
public IEnumerable<(string allowedProviderId, ComplicationTypes supportTypes)> AllowedList { get; set; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ValueTuple<System.String, ComplicationTypes>>
API Level: 6
View Source

ComplicationId

The information of complication ID.

Declaration
C#
Copy
public int ComplicationId { get; }
Property Value
Type Description
Int32
API Level: 6
View Source

Highlight

The information of the complication's highlight.

Declaration
C#
Copy
public Highlight Highlight { get; set; }
Property Value
Type Description
Highlight
API Level: 6
View Source

SupportEvents

Gets the support event types.

Declaration
C#
Copy
public EventTypes SupportEvents { get; }
Property Value
Type Description
EventTypes
API Level: 6
View Source

SupportTypes

Gets the support types.

Declaration
C#
Copy
public ComplicationTypes SupportTypes { get; }
Property Value
Type Description
ComplicationTypes
API Level: 6

Methods

View Source

Dispose()

Releases all resources used by the Complication class.

Declaration
C#
Copy
public void Dispose()
API Level: 3
View Source

Dispose(Boolean)

Releases the unmanaged resources used by the Complication class specifying whether to perform a normal dispose operation.

Declaration
C#
Copy
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing

true for a normal dispose operation; false to finalize the handle.

API Level: 3
View Source

Finalize()

Destructor of the complication class.

Declaration
C#
Copy
protected void Finalize()
View Source

GetCurrentProviderId()

Gets the current provider ID.

Declaration
C#
Copy
public string GetCurrentProviderId()
Returns
Type Description
System.String

The current provider ID

Examples
Copy
MyComplication comp = new MyComplication(); string providerId = comp.GetCurrentProviderId();
Exceptions
Type Condition
System.InvalidOperationException

Thrown when the method failed due to invalid operation.

API Level: 6
View Source

GetCurrentType()

Gets the current complication type.

Declaration
C#
Copy
public ComplicationTypes GetCurrentType()
Returns
Type Description
ComplicationTypes

The current complication type

Examples
Copy
MyComplication comp = new MyComplication(); ComplicationTypes type = comp.GetCurrentType();
Exceptions
Type Condition
System.InvalidOperationException

Thrown when the method failed due to invalid operation.

API Level: 6
View Source

GetCurrentValueOfRange(Bundle)

Gets the current value of ranged type data.

Declaration
C#
Copy
public static double GetCurrentValueOfRange(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.Double

The current value of range type data

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.RangedValue) { double currentValue = Complication.GetCurrentValueOfRange(data); layout.Text = currentValue; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetExtraData(Bundle)

Gets the extra data.

Declaration
C#
Copy
public static string GetExtraData(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.String

The extra string data

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.Icon) { string extraData = Complication.GetExtraData(data); layout.Text = extraData; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetIconPath(Bundle)

Gets the icon path.

Declaration
C#
Copy
public static string GetIconPath(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.String

The icon path data

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.Icon) { string iconPath = Complication.GetIconPath(data); layout.Text = iconPath; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetImagePath(Bundle)

Gets the image path.

Declaration
C#
Copy
public static string GetImagePath(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.String

The image path data

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.Image) { string imagePath = Complication.GetImagePath(data); layout.Text = imagePath; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetLongText(Bundle)

Gets the long text.

Declaration
C#
Copy
public static string GetLongText(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.String

The long text data

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.LongText) { string longText = Complication.GetLongText(data); layout.Text = longText; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetMaxValueOfRange(Bundle)

Gets the max value of ranged type data.

Declaration
C#
Copy
public static double GetMaxValueOfRange(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.Double

The maximum value of range type data

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.RangedValue) { double maxValue = Complication.GetMaxValueOfRange(data); layout.Text = maxValue; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetMinValueOfRange(Bundle)

Gets the minimum value of ranged type data.

Declaration
C#
Copy
public static double GetMinValueOfRange(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.Double

The minimum value of range type data

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.RangedValue) { double currentValue = Complication.GetMinValueOfRange(data); layout.Text = currentValue; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetScreenReaderText(Bundle)

Gets the screen reader text.

Declaration
C#
Copy
public static string GetScreenReaderText(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.String

The screen reader text data

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.LongText) { string screenReaderText = Complication.GetScreenReaderText(data); layout.Text = screenReaderText; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetShortText(Bundle)

Gets the short text.

Declaration
C#
Copy
public static string GetShortText(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.String

The short text data

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.ShortText) { string shortText = Complication.GetShortText(data); layout.Text = shortText; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetTimestamp(Bundle)

Gets the timestamp.

Declaration
C#
Copy
public static long GetTimestamp(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.Int64

The timestamp data in long value

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.Time) { long time = Complication.GetTimestamp(data); layout.Text = time; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetTitle(Bundle)

Gets the title.

Declaration
C#
Copy
public static string GetTitle(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
System.String

The title data

Examples
Copy
public class MyComplication : Complication { public MyComplication(int complicationId, int supportTypes, int supportEvents, string defaultProviderId, ComplicationTypes defaultType) : base(complicationId, supportTypes, supportEvents, defaultProviderId, defaultType) { } protected override void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data) { if (type == ComplicationTypes.ShortText) { string title = Complication.GetTitle(data); layout.Text = title; } } }
Exceptions
Type Condition
System.ArgumentException

Thrown when data is invalid.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

GetType(Bundle)

Gets the complication data type.

Declaration
C#
Copy
public static ComplicationTypes GetType(Bundle data)
Parameters
Type Name Description
Bundle data

The data from OnComplicationUpdate callback.

Returns
Type Description
ComplicationTypes

The complication type of data

Examples
Copy
ComplicationTypes type = Complication.GetType(dupData);
Exceptions
Type Condition
System.ArgumentException

Thrown when the invalid argument is passed.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

System.NotSupportedException

Thrown when the watchface complication is not supported.

API Level: 6
View Source

OnComplicationError(String, ComplicationTypes, ComplicationError)

Overrides this method to handle the behavior when the complication error occurs.

Declaration
C#
Copy
protected virtual void OnComplicationError(string providerId, ComplicationTypes type, ComplicationError errorReason)
Parameters
Type Name Description
System.String providerId

The updated provider's ID.

ComplicationTypes type

The updated type.

ComplicationError errorReason

The occured error.

API Level: 6
View Source

OnComplicationUpdated(String, ComplicationTypes, Bundle)

Overrides this method to handle the behavior when the complication update event comes.

Declaration
C#
Copy
protected abstract void OnComplicationUpdated(string providerId, ComplicationTypes type, Bundle data)
Parameters
Type Name Description
System.String providerId

The updated provider's ID.

ComplicationTypes type

The updated type.

Bundle data

The updated data.

API Level: 6
View Source

SendUpdateRequest()

Sends the complication update requests.

Declaration
C#
Copy
public void SendUpdateRequest()
Examples
Copy
MyComplication comp = new MyComplication(); ComplicationError err = comp.SendUpdateRequest();
Exceptions
Type Condition
System.InvalidOperationException

Thrown when the method failed due to invalid operation.

UnauthorizedAccessException

Thrown when the application does not have privilege to access this method.

API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/appmanager.launchhttp://tizen.org/privilege/datasharing
View Source

TransferEvent(EventTypes)

Transfers event to the provider.

Declaration
C#
Copy
public void TransferEvent(EventTypes eventType)
Parameters
Type Name Description
EventTypes eventType

The complication event type.

Examples
Copy
void OnButtonClicked() { comp.TransferEvent(EventTypes.EventTap); }
Exceptions
Type Condition
UnauthorizedAccessException

Thrown when the application does not have privilege to access this method.

System.ArgumentException

Thrown when the invalid argument is passed.

System.InvalidOperationException

Thrown when the method failed due to invalid operation.

API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/appmanager.launchhttp://tizen.org/privilege/datasharing

Explicit Interface Implementations

View Source

IEditable.EditableId

The information of editable ID.

Declaration
C#
Copy
int IEditable.EditableId { get; set; }
Returns
Type Description
Int32
API Level: 6
View Source

IEditable.GetCurrentData()

Gets the editable's current data.

Declaration
C#
Copy
Bundle IEditable.GetCurrentData()
Returns
Type Description
Bundle

The current data

Examples
Copy
MyComplication comp = new MyComplication(); Bundle curData = comp.GetCurrentData();
Exceptions
Type Condition
System.InvalidOperationException

Thrown when the method failed due to invalid operation.

API Level: 6
View Source

IEditable.GetCurrentDataIndex()

Gets the editable's current data index.

Declaration
C#
Copy
int IEditable.GetCurrentDataIndex()
Returns
Type Description
Int32

The index of current data

Examples
Copy
MyComplication comp = new MyComplication(); Bundle curData = comp.GetCurrentDataIndex();
Exceptions
Type Condition
System.InvalidOperationException

Thrown when the method failed due to invalid operation.

API Level: 6
View Source

IEditable.Highlight

The information of the editable's highlight.

Declaration
C#
Copy
Highlight IEditable.Highlight { get; set; }
Returns
Type Description
Highlight
API Level: 6
View Source

IEditable.Name

The information of editable name.

Declaration
C#
Copy
string IEditable.Name { get; set; }
Returns
Type Description
System.String
API Level: 6

Implements

System.IDisposable