# IClassicDesktopStyleApplicationLifetime

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

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

```rust
trait IClassicDesktopStyleApplicationLifetime: IControlledApplicationLifetime
```

Controls application lifetime in classic desktop style.

This contract is not meant to be implemented by applications.

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

## Members

- [`try_shutdown`](#function-try_shutdown)
- [`args`](#function-args)
- [`shutdown_mode`](#function-shutdown_mode)
- [`set_shutdown_mode`](#function-set_shutdown_mode)
- [`main_window`](#function-main_window)
- [`set_main_window`](#function-set_main_window)
- [`windows`](#function-windows)
- [`shutdown_requested`](#function-shutdown_requested)

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

### try_shutdown

```rust
fn try_shutdown(self: &Self, exit_code: i32) -> bool
```

Tries to shut down the application. The
`shutdown_requested` event can be used to
cancel the shutdown.

`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_classic_desktop_style_application_lifetime.rs#L17)

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

### args

```rust
fn args(self: &Self) -> Option<Vec<String>>
```

The arguments passed to the builder's
`start_with_classic_desktop_lifetime` method.

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

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

### shutdown_mode

```rust
fn shutdown_mode(self: &Self) -> ShutdownMode
```

The shutdown mode. This property indicates whether the application
is shut down explicitly or implicitly. If it is set to
`ShutdownMode::OnExplicitShutdown` the application only closes if
shutdown is called. The default is
`ShutdownMode::OnLastWindowClose`.

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

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

### set_shutdown_mode

```rust
fn set_shutdown_mode(self: &Self, value: ShutdownMode)
```

Sets the shutdown mode.

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

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

### main_window

```rust
fn main_window(self: &Self) -> Option<Ref<Window>>
```

The main window of the application.

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

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

### set_main_window

```rust
fn set_main_window(self: &Self, value: Option<Ref<Window>>)
```

Sets the main window of the application.

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

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

### windows

```rust
fn windows(self: &Self) -> Vec<Ref<Window>>
```

The list of all open windows in the application.

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

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

### shutdown_requested

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

Raised by the platform when an application shutdown is requested.
Disposing the returned handle unsubscribes.

Application shutdown can be requested for various reasons like an
operating system shutdown: the end of the session (logout or
shutdown), the quit menu of the application, or the quit command of
the application icon. Cancelling the event args blocks the shutdown
of the operating system where the platform allows it.

This event provides a first chance to cancel application shutdown;
if shutdown is not canceled at this point the application will try
to close each non-owned open window, invoking the
`Window::closing` event on each and allowing each window to cancel
the shutdown of the application. Windows cannot however prevent the
shutdown of the operating system.

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

## Trait implementations

- [`IClassicDesktopStyleApplicationLifetime`](/docs/0.5.0/api/ferroui-controls/application_lifetimes/trait-iclassicdesktopstyleapplicationlifetime/)

## Availability

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