Class Complication
Definition
- Namespace:
- Tizen.Applications.WatchfaceComplication
- Assembly:
- Tizen.Applications.WatchfaceComplication.dll
- API Level:
- 6
Represents the complication for a watch application.
public abstract class Complication : IEditable, IDisposable
- Inheritance
-
Complication
- Implements
Constructors
View SourceComplication(Int32, ComplicationTypes, EventTypes, String, ComplicationTypes)
Initializes the Complication class.
Declaration
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. |
String | defaultProviderId | The complication's default provider ID. |
ComplicationTypes | defaultType | The complication's default type. |
Examples
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 |
---|---|
ArgumentException | Thrown when the invalid parameter is passed. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
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 SourceAllowedList
The information of specific allowed provider id, support types list for complication
Declaration
public IEnumerable<(string allowedProviderId, ComplicationTypes supportTypes)> AllowedList { get; set; }
Property Value
Type | Description |
---|---|
IEnumerable<ValueTuple<String, ComplicationTypes>> |
API Level: 6
View SourceComplicationId
The information of complication ID.
Declaration
public int ComplicationId { get; }
Property Value
Type | Description |
---|---|
Int32 |
API Level: 6
View SourceHighlight
The information of the complication's highlight.
Declaration
public Highlight Highlight { get; set; }
Property Value
Type | Description |
---|---|
Highlight |
API Level: 6
View SourceSupportEvents
Gets the support event types.
Declaration
public EventTypes SupportEvents { get; }
Property Value
Type | Description |
---|---|
EventTypes |
API Level: 6
View SourceSupportTypes
Gets the support types.
Declaration
public ComplicationTypes SupportTypes { get; }
Property Value
Type | Description |
---|---|
ComplicationTypes |
API Level: 6
Methods
View SourceDispose()
Releases all resources used by the Complication class.
Declaration
public void Dispose()
API Level: 3
View SourceDispose(Boolean)
Releases the unmanaged resources used by the Complication class specifying whether to perform a normal dispose operation.
Declaration
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 SourceFinalize()
Destructor of the complication class.
Declaration
protected void Finalize()
GetCurrentProviderId()
Gets the current provider ID.
Declaration
public string GetCurrentProviderId()
Returns
Type | Description |
---|---|
String | The current provider ID |
Examples
MyComplication comp = new MyComplication();
string providerId = comp.GetCurrentProviderId();
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when the method failed due to invalid operation. |
API Level: 6
View SourceGetCurrentType()
Gets the current complication type.
Declaration
public ComplicationTypes GetCurrentType()
Returns
Type | Description |
---|---|
ComplicationTypes | The current complication type |
Examples
MyComplication comp = new MyComplication();
ComplicationTypes type = comp.GetCurrentType();
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when the method failed due to invalid operation. |
API Level: 6
View SourceGetCurrentValueOfRange(Bundle)
Gets the current value of ranged type data.
Declaration
public 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
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetExtraData(Bundle)
Gets the extra data.
Declaration
public 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
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetIconPath(Bundle)
Gets the icon path.
Declaration
public 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
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetImagePath(Bundle)
Gets the image path.
Declaration
public 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
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetLongText(Bundle)
Gets the long text.
Declaration
public 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
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetMaxValueOfRange(Bundle)
Gets the max value of ranged type data.
Declaration
public 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
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetMinValueOfRange(Bundle)
Gets the minimum value of ranged type data.
Declaration
public 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
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetScreenReaderText(Bundle)
Gets the screen reader text.
Declaration
public 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
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetShortText(Bundle)
Gets the short text.
Declaration
public 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
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetTimestamp(Bundle)
Gets the timestamp.
Declaration
public static long GetTimestamp(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
Int64 | The timestamp data in long value |
Examples
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetTitle(Bundle)
Gets the title.
Declaration
public static string GetTitle(Bundle data)
Parameters
Type | Name | Description |
---|---|---|
Bundle | data | The data from OnComplicationUpdate callback. |
Returns
Type | Description |
---|---|
String | The title data |
Examples
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 |
---|---|
ArgumentException | Thrown when data is invalid. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceGetType(Bundle)
Gets the complication data type.
Declaration
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
ComplicationTypes type = Complication.GetType(dupData);
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the invalid argument is passed. |
InvalidOperationException | Thrown when the method failed due to invalid operation. |
NotSupportedException | Thrown when the watchface complication is not supported. |
API Level: 6
View SourceOnComplicationError(String, ComplicationTypes, ComplicationError)
Overrides this method to handle the behavior when the complication error occurs.
Declaration
protected 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. |
API Level: 6
View SourceOnComplicationUpdated(String, ComplicationTypes, Bundle)
Overrides this method to handle the behavior when the complication update event comes.
Declaration
protected 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. |
API Level: 6
View SourceSendUpdateRequest()
Sends the complication update requests.
Declaration
public void SendUpdateRequest()
Examples
MyComplication comp = new MyComplication();
ComplicationError err = comp.SendUpdateRequest();
Exceptions
Type | Condition |
---|---|
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 SourceTransferEvent(EventTypes)
Transfers event to the provider.
Declaration
public void TransferEvent(EventTypes eventType)
Parameters
Type | Name | Description |
---|---|---|
EventTypes | eventType | The complication event type. |
Examples
void OnButtonClicked()
{
comp.TransferEvent(EventTypes.EventTap);
}
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Thrown when the application does not have privilege to access this method. |
ArgumentException | Thrown when the invalid argument is passed. |
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 SourceIEditable.EditableId
The information of editable ID.
Declaration
int IEditable.EditableId { get; set; }
Returns
Type | Description |
---|---|
Int32 |
API Level: 6
View SourceIEditable.GetCurrentData()
Gets the editable's current data.
Declaration
Bundle IEditable.GetCurrentData()
Returns
Type | Description |
---|---|
Bundle | The current data |
Examples
MyComplication comp = new MyComplication();
Bundle curData = comp.GetCurrentData();
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when the method failed due to invalid operation. |
API Level: 6
View SourceIEditable.GetCurrentDataIndex()
Gets the editable's current data index.
Declaration
int IEditable.GetCurrentDataIndex()
Returns
Type | Description |
---|---|
Int32 | The index of current data |
Examples
MyComplication comp = new MyComplication();
Bundle curData = comp.GetCurrentDataIndex();
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when the method failed due to invalid operation. |
API Level: 6
View SourceIEditable.Highlight
The information of the editable's highlight.
Declaration
Highlight IEditable.Highlight { get; set; }
Returns
Type | Description |
---|---|
Highlight |
API Level: 6
View SourceIEditable.Name
The information of editable name.
Declaration
string IEditable.Name { get; set; }
Returns
Type | Description |
---|---|
String |