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#
Copy
public abstract class ComponentBasedApplication : Application, IDisposable
Inheritance
object
ComponentBasedApplication
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

View Source

ComponentBasedApplication(IDictionary<Type, string>)

Initializes a new instance of the ComponentBasedApplication class with the specified component type information.

Declaration
C#
Copy
public 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
Copy
IDictionary<Type, string> components = new Dictionary<Type, string>() { { typeof(MyFrameComponent), "frameComponentId" }, { typeof(MyServiceComponent), "serviceComponentId" } }; ComponentBasedApplication app = new MyApplication(components); app.Run(args);

Methods

View Source

Exit()

Exits the application's main loop.

Declaration
C#
Copy
public 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.

View Source

OnExit()

Called to exit the main loop of the application.

Declaration
C#
Copy
protected virtual void OnExit()
Remarks

Override this method to handle any logic needed before the application exits.

View Source

OnFinished()

Called after the main loop exits.

Declaration
C#
Copy
protected virtual void OnFinished()
Remarks

Override this method to handle any cleanup logic after the application has finished running.

View Source

OnInit(string[])

Called before the main loop starts.

Declaration
C#
Copy
protected 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.

View Source

OnRun()

Called to start the main loop of the application.

Declaration
C#
Copy
protected abstract void OnRun()
Remarks

This is an abstract method that must be implemented by derived classes to define the behavior when the application starts.

View Source

RegisterComponent(Type, string)

Registers a component with the specified type and ID.

Declaration
C#
Copy
public 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
Copy
app.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.

View Source

Run(string[])

Runs the application's main loop.

Declaration
C#
Copy
public 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
Copy
app.Run(args);
Exceptions
Type Condition
System.InvalidOperationException

Thrown when component type is already added to the component.

Implements

System.IDisposable