Class ComponentBasedApplication
Definition
- Namespace:
- Tizen.Applications.ComponentBased.Common
- Assembly:
- Tizen.Applications.ComponentBased.dll
Represents the base class for a multi-component based application. This class allows the creation and management of multiple application components, such as Frame, Service, and Widget components.
C#Copypublic abstract class ComponentBasedApplication : Application, IDisposable
- Inheritance
- Derived
- Implements
-
System.IDisposable
Remarks
This abstract class provides the core structure for applications that consist of multiple components. Each component has its own lifecycle, and the framework handles these lifecycles independently.
Constructors
ComponentBasedApplication(IDictionary<Type, string>)
Initializes a new instance of the ComponentBasedApplication class with the specified component type information.
Declaration
C#Copypublic ComponentBasedApplication(IDictionary<Type, string> typeInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TKey, TValue><System.Type, string> | typeInfo | A dictionary where the key is the component class type (FrameComponent, ServiceComponent or WidgetComponent subclass), and the value is the component ID defined in the tizen-manifest.xml file. |
Remarks
This constructor sets up the necessary callbacks for the application lifecycle and registers the provided components.
Examples
CopyIDictionary<Type, string> components = new Dictionary<Type, string>() { { typeof(MyFrameComponent), "frameComponentId" }, { typeof(MyServiceComponent), "serviceComponentId" } }; ComponentBasedApplication app = new MyApplication(components); app.Run(args);
Methods
Declaration
C#Copypublic override void Exit()
Overrides
Remarks
This abstract class provides the core structure for applications that consist of multiple components. Each component has its own lifecycle, and the framework handles these lifecycles independently.
Declaration
C#Copyprotected virtual void OnExit()
Remarks
Override this method to handle any logic needed before the application exits.
Declaration
C#Copyprotected virtual void OnFinished()
Remarks
Override this method to handle any cleanup logic after the application has finished running.
Declaration
C#Copyprotected virtual void OnInit(string[] args)
Parameters
Type | Name | Description |
---|---|---|
string[] | args | The arguments passed from the command line. |
Remarks
Override this method to handle any initialization logic before the application enters the main event loop.
Declaration
C#Copyprotected abstract void OnRun()
Remarks
This is an abstract method that must be implemented by derived classes to define the behavior when the application starts.
Declaration
C#Copypublic void RegisterComponent(Type compType, string compId)
Parameters
Type | Name | Description |
---|---|---|
System.Type | compType | The type of the component to register. Must be a subclass of FrameComponent, ServiceComponent, or WidgetComponent. |
string | compId | The ID of the component, defined in the tizen-manifest.xml file. |
Remarks
This method ensures that only valid component types are registered. The component ID must be unique.
Examples
Copyapp.RegisterComponent(typeof(MyFrameComponent), "frameComponentId");
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the component type is already registered or not sub-class of FrameComponent, ServiceComponent or WidgetComponent. |
Declaration
C#Copypublic override void Run(string[] args)
Parameters
Type | Name | Description |
---|---|---|
string[] | args | The arguments passed from the command line. |
Overrides
Remarks
This abstract class provides the core structure for applications that consist of multiple components. Each component has its own lifecycle, and the framework handles these lifecycles independently.
Examples
Copyapp.Run(args);
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when component type is already added to the component. |