# IControlledApplicationLifetime

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/application_lifetimes/trait-icontrolledapplicationlifetime/

**trait** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
trait IControlledApplicationLifetime: IApplicationLifetime
```

A lifetime whose end is controlled by the application.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/application_lifetimes/i_controlled_application_lifetime.rs#L8)

## Members

- [`startup`](#function-startup)
- [`exit`](#function-exit)
- [`shutdown`](#function-shutdown)

<a id="function-startup"></a>

### startup

```rust
fn startup(self: &Self, handler: Rc<dyn Fn(&ControlledApplicationLifetimeStartupEventArgs) -> ()>) -> Rc<dyn IDisposable>
```

Raised when the application is starting. Disposing the returned
handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/application_lifetimes/i_controlled_application_lifetime.rs#L11)

<a id="function-exit"></a>

### exit

```rust
fn exit(self: &Self, handler: Rc<dyn Fn(&ControlledApplicationLifetimeExitEventArgs) -> ()>) -> Rc<dyn IDisposable>
```

Raised when the application is exiting. Disposing the returned handle
unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/application_lifetimes/i_controlled_application_lifetime.rs#L15)

<a id="function-shutdown"></a>

### shutdown

```rust
fn shutdown(self: &Self, exit_code: i32)
```

Shuts down the application and sets the exit code that is returned to
the operating system.

`exit_code` is an integer exit code for an application; the default
exit code is 0.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/application_lifetimes/i_controlled_application_lifetime.rs#L22)

## Trait implementations

- [`IControlledApplicationLifetime`](/docs/0.5.0/api/ferroui-controls/application_lifetimes/trait-icontrolledapplicationlifetime/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
