Class Complication
Definition
- Namespace:
- Tizen.Applications.WatchfaceComplication
- Assembly:
- Tizen.Applications.WatchfaceComplication.dll
Represents the complication for a watch application.
public abstract class Complication : IEditable, IDisposable
- Inheritance
-
objectComplication
- Implements
-
System.IDisposable
Constructors
View SourceComplication(int, 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 |
---|---|---|
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
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. |
System.UnauthorizedAccessException | Thrown when the application does not have privilege to access this method. |
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 |
---|---|
System.Collections.Generic.IEnumerable<T><(string allowedProviderId, ComplicationTypes supportTypes)> |
ComplicationId
The information of complication ID.
Declaration
public int ComplicationId { get; }
Property Value
Type | Description |
---|---|
int |
Highlight
The information of the complication's highlight.
Declaration
public Highlight Highlight { get; set; }
Property Value
Type | Description |
---|---|
Highlight |
SupportEvents
Gets the support event types.
Declaration
public EventTypes SupportEvents { get; }
Property Value
Type | Description |
---|---|
EventTypes |
SupportTypes
Gets the support types.
Declaration
public ComplicationTypes SupportTypes { get; }
Property Value
Type | Description |
---|---|
ComplicationTypes |
Methods
View SourceDispose()
Releases all resources used by the Complication class.
Declaration
public void Dispose()
Dispose(bool)
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 |
---|---|---|
bool | disposing | true for a normal dispose operation; false to finalize the handle. |
~Complication()
Destructor of the complication class.
Declaration
protected ~Complication()
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 |
---|---|
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
GetCurrentType()
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 |
---|---|
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
GetCurrentValueOfRange(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 |
---|---|
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. |
GetExtraData(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 |
---|---|
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. |
GetIconPath(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 |
---|---|
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. |
GetImagePath(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 |
---|---|
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. |
GetLongText(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 |
---|---|
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. |
GetMaxValueOfRange(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 |
---|---|
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. |
GetMinValueOfRange(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 |
---|---|
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. |
GetScreenReaderText(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 |
---|---|
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. |
GetShortText(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 |
---|---|
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. |
GetTimestamp(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 |
---|---|
long | 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 |
---|---|
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. |
GetTitle(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 |
---|---|
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. |
GetType(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 |
---|---|
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
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. |
OnComplicationUpdated(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. |
SendUpdateRequest()
Sends the complication update requests.
Declaration
public void SendUpdateRequest()
Examples
MyComplication 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. |
TransferEvent(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 |
---|---|
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
View SourceIEditable.EditableId
The information of editable ID.
Declaration
int IEditable.EditableId { get; set; }
Returns
Type | Description |
---|---|
int |
IEditable.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 |
---|---|
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
IEditable.GetCurrentDataIndex()
Gets the editable's current data index.
Declaration
int IEditable.GetCurrentDataIndex()
Returns
Type | Description |
---|---|
int | The index of current data |
Examples
MyComplication comp = new MyComplication();
Bundle curData = comp.GetCurrentDataIndex();
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the method failed due to invalid operation. |
IEditable.Highlight
The information of the editable's highlight.
Declaration
Highlight IEditable.Highlight { get; set; }
Returns
Type | Description |
---|---|
Highlight |
IEditable.Name
The information of editable name.
Declaration
string IEditable.Name { get; set; }
Returns
Type | Description |
---|---|
string |