Class NUIGadgetManager
Definition
- Assembly:
- Tizen.NUI.Gadget.dll
The NUIGadgetManager provides methods and events related to managing gadgets in the NUI.
public static class NUIGadgetManager
- Inheritance
-
objectNUIGadgetManager
Methods
View SourceAdd(string, string, bool)
Adds a NUIGadget to the NUIGadgetManager.
Declaration
public static NUIGadget Add(string resourceType, string className, bool useDefaultContext)
Parameters
| Type | Name | Description |
|---|---|---|
| string | resourceType | The resource type of the NUIGadget package. |
| string | className | The class name of the NUIGadget. |
| bool | useDefaultContext | The flag it true, use a default context. Otherwise, use a new load context. |
Returns
| Type | Description |
|---|---|
| NUIGadget | The NUIGadget object. |
Remarks
To use Unload() method, the useDefaultContext must be'false'.
Add(string, string)
Adds a NUIGadget to the NUIGadgetManager.
Declaration
public static NUIGadget Add(string resourceType, string className)
Parameters
| Type | Name | Description |
|---|---|---|
| string | resourceType | The resource type of the NUIGadget package. |
| string | className | The class name of the NUIGadget. |
Returns
| Type | Description |
|---|---|
| NUIGadget | The NUIGadget object. |
GetGadgetInfos()
Retrieves information about available NUIGadgets.
Declaration
public static IEnumerable<NUIGadgetInfo> GetGadgetInfos()
Returns
| Type | Description |
|---|---|
| IEnumerable<><NUIGadgetInfo> | An enumerable list of NUIGadgetInfo objects. |
Remarks
This method provides details on gadgets that are currently accessible rather than listing all installed gadgets. A NUIGadget's resource package may specify which applications have access through the "allowed-packages" setting. During execution, the platform mounts the resource package in the application's resources directory.
GetGadgets()
Retrieves the instances of currently running NUIGadgets.
Declaration
public static IEnumerable<NUIGadget> GetGadgets()
Returns
| Type | Description |
|---|---|
| IEnumerable<><NUIGadget> | An enumerable list containing all the active NUIGadgets. |
Load(string, bool)
Loads an assembly of the NUIGadget.
Declaration
public static void Load(string resourceType, bool useDefaultContext)
Parameters
| Type | Name | Description |
|---|---|---|
| string | resourceType | The resource type of the NUIGadget package. |
| bool | useDefaultContext | Indicates whether to use a default load context or not. |
Load(string)
Loads an assembly of the NUIGadget.
Declaration
public static void Load(string resourceType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | resourceType | The resource type of the NUIGadget package. |
Remarks
This method loads an assembly of the NUIGadget based on the specified resource type. It throws an ArgumentException if the argument is invalid, or an InvalidOperationException if the operation fails due to any reason.
Pause(NUIGadget)
Pauses the execution of the specified NUIGadget.
Declaration
public static void Pause(NUIGadget gadget)
Parameters
| Type | Name | Description |
|---|---|---|
| NUIGadget | gadget | The NUIGadget object whose execution needs to be paused. |
Remarks
Calling this method pauses the currently executing NUIGadget. It does not affect any other gadgets that may be running simultaneously.
Remove(NUIGadget)
Removes the specified NUIGadget from the NUIGadgetManager.
Declaration
public static void Remove(NUIGadget gadget)
Parameters
| Type | Name | Description |
|---|---|---|
| NUIGadget | gadget | The NUIGadget object that needs to be removed. |
Remarks
This method allows you to remove a specific NUIGadget from the NUIGadgetManager. By passing the NUIGadget object as an argument, you can ensure that only the desired gadget is removed. It is important to note that once a gadget is removed, any references to it become invalid. Therefore, it is crucial to handle the removal process carefully to avoid any potential issues.
RemoveAll()
Removes all NUIGadgets from the NUIGadgetManager.
Declaration
public static void RemoveAll()
Remarks
This method is called to remove all NUIGadgets that are currently registered in the NUIGadgetManager. It ensures that no more NUIGadgets exist after calling this method.
Resume(NUIGadget)
Resumes the execution of the specified NUIGadget.
Declaration
public static void Resume(NUIGadget gadget)
Parameters
| Type | Name | Description |
|---|---|---|
| NUIGadget | gadget | The NUIGadget object whose execution needs to be resumed. |
Remarks
By calling this method, you can resume the execution of the currently suspended NUIGadget. It takes the NUIGadget object as an argument which represents the target gadget that needs to be resumed.
Examples
To resume the execution of a specific NUIGadget named 'MyGadget', you can call the following code snippet:
// Get the reference to the NUIGadget object
NUIGadget MyGadget = ...;
// Resume its execution
GadgetResume(MyGadget);
View Source
SendAppControl(NUIGadget, AppControl)
Sends the specified application control to the currently running NUIGadget.
Declaration
public static void SendAppControl(NUIGadget gadget, AppControl appControl)
Parameters
| Type | Name | Description |
|---|---|---|
| NUIGadget | gadget | The NUIGadget object that will receive the app control. |
| AppControl | appControl | The app control object containing the desired arguments and actions. |
Unload(string)
Unloads the specified NUIGadget assembly from memory.
Declaration
public static void Unload(string resourceType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | resourceType | The resource type of the NUIGadget package to unload. |
Remarks
To use this method properly, the assembly of the gadget must be loaded using Load() with the custom context.
Examples
/// Load an assembly of the NUIGadget.
NUIGadgetManager.Load("org.tizen.appfw.gadget.NetworkSetting", false);
/// NUIGadgetManager.Add("org.tizen.appfw.gadget.NetworkSetting", "NetworkSettingGadget", false);
/// Unload the loaded assembly
NUIGadgetManager.Unload("org.tizen.appfw.gadget.NetworkSetting");
Events
View SourceNUIGadgetLifecycleChanged
Occurs when the lifecycle of the NUIGadget is changed.
Declaration
public static event EventHandler<NUIGadgetLifecycleChangedEventArgs> NUIGadgetLifecycleChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><NUIGadgetLifecycleChangedEventArgs> |
Remarks
This event is raised when the state of the NUIGadget changes. It provides information about the current state through the NUIGadgetLifecycleChangedEventArgs argument.