Class Complication
Definition
- Namespace:
- Tizen.Applications.WatchfaceComplication
- Assembly:
- Tizen.Applications.WatchfaceComplication.dll
- API Level:
- 6
Represents the complication for a watch application.
C#Copypublic abstract class Complication : IEditable, IDisposable
- Inheritance
-
System.ObjectComplication
- Implements
-
System.IDisposable
Constructors
Complication(Int32, ComplicationTypes, EventTypes, String, ComplicationTypes)
Initializes the Complication class.
Declaration
C#Copyprotected Complication(int complicationId, ComplicationTypes supportTypes, EventTypes supportEvents, string defaultProviderId, ComplicationTypes defaultType)
Parameters
Type | Name | Description |
---|---|---|
System.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
Copypublic 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
AllowedList
The information of specific allowed provider id, support types list for complication
Declaration
C#Copypublic IEnumerable<(string allowedProviderId, ComplicationTypes supportTypes)> AllowedList { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ValueTuple<System.String, ComplicationTypes>> |
API Level: 6
Declaration
C#Copypublic int ComplicationId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
API Level: 6
Declaration
C#Copypublic Highlight Highlight { get; set; }
Property Value
Type | Description |
---|---|
Highlight |
API Level: 6
Declaration
C#Copypublic EventTypes SupportEvents { get; }
Property Value
Type | Description |
---|---|
EventTypes |
API Level: 6
Declaration
C#Copypublic ComplicationTypes SupportTypes { get; }
Property Value
Type | Description |
---|---|
ComplicationTypes |
API Level: 6
Methods
Declaration
C#Copypublic void Dispose()
API Level: 3
Dispose(Boolean)
Releases the unmanaged resources used by the Complication class specifying whether to perform a normal dispose operation.
Declaration
C#Copyprotected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | true for a normal dispose operation; false to finalize the handle. |
API Level: 3
Declaration
C#Copyprotected void Finalize()
Declaration
C#Copypublic string GetCurrentProviderId()
Returns
Type | Description |
---|---|
System.String | The current provider ID |
Examples
CopyMyComplication comp = new MyComplication(); string providerId = comp.GetCurrentProviderId();
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
API Level: 6
Declaration
C#Copypublic ComplicationTypes GetCurrentType()
Returns
Type | Description |
---|---|
ComplicationTypes | The current complication type |
Examples
CopyMyComplication comp = new MyComplication(); ComplicationTypes type = comp.GetCurrentType();
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
API Level: 6
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
Copypublic 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
Declaration
C#Copypublic 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
CopyComplicationTypes 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
OnComplicationError(String, ComplicationTypes, ComplicationError)
Overrides this method to handle the behavior when the complication error occurs.
Declaration
C#Copyprotected 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
OnComplicationUpdated(String, ComplicationTypes, Bundle)
Overrides this method to handle the behavior when the complication update event comes.
Declaration
C#Copyprotected 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
Declaration
C#Copypublic void SendUpdateRequest()
Examples
CopyMyComplication 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
Declaration
C#Copypublic void TransferEvent(EventTypes eventType)
Parameters
Type | Name | Description |
---|---|---|
EventTypes | eventType | The complication event type. |
Examples
Copyvoid 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
Declaration
C#Copyint IEditable.EditableId { get; set; }
Returns
Type | Description |
---|---|
System.Int32 |
API Level: 6
Declaration
C#CopyBundle IEditable.GetCurrentData()
Returns
Type | Description |
---|---|
Bundle | The current data |
Examples
CopyMyComplication comp = new MyComplication(); Bundle curData = comp.GetCurrentData();
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
API Level: 6
Declaration
C#Copyint IEditable.GetCurrentDataIndex()
Returns
Type | Description |
---|---|
System.Int32 | The index of current data |
Examples
CopyMyComplication comp = new MyComplication(); Bundle curData = comp.GetCurrentDataIndex();
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
API Level: 6
Declaration
C#CopyHighlight IEditable.Highlight { get; set; }
Returns
Type | Description |
---|---|
Highlight |
API Level: 6
Declaration
C#Copystring IEditable.Name { get; set; }
Returns
Type | Description |
---|---|
System.String |