Class Complication
Definition
- Namespace:
- Tizen.Applications.WatchfaceComplication
- Assembly:
- Tizen.Applications.WatchfaceComplication.dll
Represents the complication for a watch application.
C#Copypublic abstract class Complication : IEditable, IDisposable
- Inheritance
-
objectComplication
- Implements
-
System.IDisposable
Constructors
Complication(int, 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 |
---|---|---|
int | complicationId | The id of the complication. |
ComplicationTypes | supportTypes | The complication support types. |
EventTypes | supportEvents | The complication's support events. |
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. |
System.UnauthorizedAccessException | Thrown when the application does not have privilege to access this method. |
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<T><(string allowedProviderId, ComplicationTypes supportTypes)> |
Declaration
C#Copypublic int ComplicationId { get; }
Property Value
Type | Description |
---|---|
int |
Declaration
C#Copypublic Highlight Highlight { get; set; }
Property Value
Type | Description |
---|---|
Highlight |
Declaration
C#Copypublic EventTypes SupportEvents { get; }
Property Value
Type | Description |
---|---|
EventTypes |
Declaration
C#Copypublic ComplicationTypes SupportTypes { get; }
Property Value
Type | Description |
---|---|
ComplicationTypes |
Methods
Declaration
C#Copypublic void Dispose()
Dispose(bool)
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 |
---|---|---|
bool | disposing | true for a normal dispose operation; false to finalize the handle. |
Declaration
C#Copyprotected ~Complication()
Declaration
C#Copypublic string GetCurrentProviderId()
Returns
Type | Description |
---|---|
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. |
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. |
Declaration
C#Copypublic static double GetCurrentValueOfRange(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
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. |
Declaration
C#Copypublic static string GetExtraData(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
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. |
Declaration
C#Copypublic static string GetIconPath(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
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. |
Declaration
C#Copypublic static string GetImagePath(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
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. |
Declaration
C#Copypublic static string GetLongText(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
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. |
Declaration
C#Copypublic static double GetMaxValueOfRange(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
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. |
Declaration
C#Copypublic static double GetMinValueOfRange(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
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. |
Declaration
C#Copypublic static string GetScreenReaderText(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
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. |
Declaration
C#Copypublic static string GetShortText(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
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. |
Declaration
C#Copypublic static long GetTimestamp(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
long | 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. |
Declaration
C#Copypublic static string GetTitle(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
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. |
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. |
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 |
---|---|---|
string | providerId | The updated provider's ID. |
ComplicationTypes | type | The updated type. |
ComplicationError | errorReason | The occured error. |
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 |
---|---|---|
string | providerId | The updated provider's ID. |
ComplicationTypes | type | The updated type. |
Bundle | data | The updated data. |
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. |
System.UnauthorizedAccessException | Thrown when the application does not have privilege to access this method. |
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 |
---|---|
System.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. |
Explicit Interface Implementations
Declaration
C#Copyint IEditable.EditableId { get; set; }
Returns
Type | Description |
---|---|
int |
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. |
Declaration
C#Copyint IEditable.GetCurrentDataIndex()
Returns
Type | Description |
---|---|
int | 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. |
Declaration
C#CopyHighlight IEditable.Highlight { get; set; }
Returns
Type | Description |
---|---|
Highlight |
Declaration
C#Copystring IEditable.Name { get; set; }
Returns
Type | Description |
---|---|
string |