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.
public 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
View SourceComponentBasedApplication(IDictionary<Type, string>)
Initializes a new instance of the ComponentBasedApplication class with the specified component type information.
Declaration
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
IDictionary<Type, string> components = new Dictionary<Type, string>()
{
{ typeof(MyFrameComponent), "frameComponentId" },
{ typeof(MyServiceComponent), "serviceComponentId" }
};
ComponentBasedApplication app = new MyApplication(components);
app.Run(args);
Methods
View SourceExit()
Exits the application's main loop.
Declaration
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.
OnExit()
Called to exit the main loop of the application.
Declaration
protected virtual void OnExit()
Remarks
Override this method to handle any logic needed before the application exits.
OnFinished()
Called after the main loop exits.
Declaration
protected virtual void OnFinished()
Remarks
Override this method to handle any cleanup logic after the application has finished running.
OnInit(string[])
Called before the main loop starts.
Declaration
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.
OnRun()
Called to start the main loop of the application.
Declaration
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.
RegisterComponent(Type, string)
Registers a component with the specified type and ID.
Declaration
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
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. |
Run(string[])
Runs the application's main loop.
Declaration
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
app.Run(args);
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when component type is already added to the component. |