Skip to content

Commit 0343264

Browse files
Обновление переводов на русский язык в разделе о жизненных циклах приложения (#705)
Co-authored-by: Terentev A. A. <[email protected]>
1 parent a7b81a6 commit 0343264

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

i18n/ru/docusaurus-plugin-content-docs/current/concepts/application-lifetimes.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
---
2-
description: CONCEPTS
2+
description: КОНЦЕПЦИИ
33
---
44

5-
# Application Lifetimes
5+
# Жизненные циклы приложения
66

7-
Not all platforms are created equal! For example, the lifetime management that you may be used to developing with in Windows Forms or WPF can operate only on desktop-style platforms. _Avalonia UI_ is a cross-platform framework; so to make your application portable, it provides several different lifetime models for your application, and also allows you to control everything manually if the target platform permits.
7+
Не все платформы созданы одинаковыми! Например, управление жизненным циклом, с которым вы, возможно, привыкли работать в Windows Forms или WPF, может функционировать только на платформах в стиле настольных приложений. _Avalonia UI_ - это кроссплатформенный фреймворк; поэтому, чтобы сделать ваше приложение переносимым, он предоставляет несколько различных моделей жизненного цикла для вашего приложения, а также позволяет управлять всем вручную, если целевая платформа это позволяет.
88

9-
## How do lifetimes work?
9+
## Как работают жизненные циклы?
1010

11-
For a desktop application, you initialise like this:
11+
Для настольного приложения вы инициализируете его следующим образом:
1212

1313
```csharp
1414
class Program
1515
{
16-
// This method is needed for IDE previewer infrastructure
16+
// Этот метод необходим для инфраструктуры предпросмотра IDE
1717
public static AppBuilder BuildAvaloniaApp()
1818
=> AppBuilder.Configure<App>().UsePlatformDetect();
1919

20-
// The entry point. Things aren't ready yet, so at this point
21-
// you shouldn't use any Avalonia types or anything that expects
22-
// a SynchronizationContext to be ready
20+
// Точка входа. На этом этапе всё ещё не готово,
21+
// поэтому не следует использовать какие-либо типы Avalonia или что-либо,
22+
// что ожидает готовности SynchronizationContext
2323
public static int Main(string[] args)
2424
=> BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
2525
}
2626
```
2727

28-
Then the main window is created in the `Application` class:
28+
Затем главное окно создается в классе `Application`:
2929

3030
```csharp
3131
public override void OnFrameworkInitializationCompleted()
@@ -40,80 +40,80 @@ public override void OnFrameworkInitializationCompleted()
4040
}
4141
```
4242

43-
This method is called when the framework has initialized and the `ApplicationLifetime` property contains the chosen lifetime if any.
43+
Этот метод вызывается, когда фреймворк инициализирован, и свойство `ApplicationLifetime` содержит выбранный жизненный цикл, если таковой имеется.
4444

4545
:::info
46-
If you run the application in design mode (this uses the IDE previewer process), then `ApplicationLifetime` is null.
46+
Если вы запускаете приложение в режиме дизайна (это использует процесс предпросмотра IDE), то `ApplicationLifetime` будет равен null.
4747
:::
4848

49-
## Lifetime Interfaces
49+
## Интерфейсы жизненного цикла
5050

51-
_Avalonia UI_ provides a range of interfaces to allow you to choose a level of control that is suitable for your application. These are provided by the `BuildAvaloniaApp().Start[Something]` family of methods.
51+
_Avalonia UI_ предоставляет набор интерфейсов, позволяющих выбрать уровень контроля, подходящий для вашего приложения. Они предоставляются семейством методов `BuildAvaloniaApp().Start[Something]`.
5252

5353
### IControlledApplicationLifetime
5454

55-
Provided by:
55+
Предоставляется:
5656

5757
* `StartWithClassicDesktopLifetime`
5858
* `StartLinuxFramebuffer`
5959

60-
Allows you to subscribe to `Startup` and `Exit` events and permits explicitly shutting down of the application by calling the `Shutdown` method. This interface gives you control of the application's exit procedures.
60+
Позволяет подписаться на события `Startup` и `Exit` и дает возможность явно завершить работу приложения, вызывая метод `Shutdown`. Этот интерфейс дает вам контроль над процедурами завершения приложения.
6161

6262
### IClassicDesktopStyleApplicationLifetime
6363

64-
Inherits: `IControlledApplicationLifetime`
64+
Наследует: `IControlledApplicationLifetime`
6565

66-
Provided by:
66+
Предоставляется:
6767

6868
* `StartWithClassicDesktopLifetime`
6969

70-
Allows you to control your application lifetime in the manner of a Windows Forms or WPF application. This interface provides a way to access the list of the currently opened windows, to set a main window, and has three shutdown modes:
70+
Позволяет управлять жизненным циклом вашего приложения по образцу приложения Windows Forms или WPF. Этот интерфейс предоставляет способ доступа к списку открытых в данный момент окон, установки главного окна и имеет три режима завершения работы:
7171

72-
* `OnLastWindowClose` - shuts down the application when the last window is closed
73-
* `OnMainWindowClose` - shuts down the application when the main window is closed (if it has been set).
74-
* `OnExplicitShutdown` - disables automatic shutdown of the application, you need to call the `Shutdown` method in your code.
72+
* `OnLastWindowClose` - завершает работу приложения при закрытии последнего окна
73+
* `OnMainWindowClose` - завершает работу приложения при закрытии главного окна (если оно было установлено).
74+
* `OnExplicitShutdown` - отключает автоматическое завершение работы приложения, вам нужно вызвать метод `Shutdown` в вашем коде.
7575

7676
### ISingleViewApplicationLifetime
7777

78-
Provided by:
78+
Предоставляется:
7979

8080
* `StartLinuxFramebuffer`
81-
* mobile platforms
81+
* мобильные платформы
8282

83-
Some platforms do not have a concept of a desktop main window and only allow one view on the device's screen at a time. For these platforms the lifetime allows you to set and change the main view class (`MainView`) instead.
83+
Некоторые платформы не имеют концепции главного окна рабочего стола и позволяют отображать только один вид на экране устройства одновременно. Для этих платформ жизненный цикл позволяет вместо этого установить и изменить класс главного представления (`MainView`).
8484

8585
:::info
86-
To implement the navigation stack on platforms like this (with a single main view), you can use [_ReactiveUI_ routing](https://www.reactiveui.net/docs/handbook/routing/) or another routing control.
86+
Для реализации стека навигации на таких платформах (с одним главным представлением) вы можете использовать [маршрутизацию _ReactiveUI_](https://www.reactiveui.net/docs/handbook/routing/) или другой элемент управления маршрутизацией.
8787
:::
8888

89-
## Manual Lifetime Management
89+
## Ручное управление жизненным циклом
9090

91-
If you need to, you can take full control of your application's lifetime management. For example on a desktop platform you can pass a delegate to `AppMain` to the `BuildAvaloniaApp.Start` method, and then manage things manually from there:
91+
При необходимости вы можете взять полный контроль над управлением жизненным циклом вашего приложения. Например, на настольной платформе вы можете передать делегат в `AppMain` методу `BuildAvaloniaApp.Start`, а затем управлять всем вручную оттуда:
9292

9393
```csharp
9494
class Program
9595
{
96-
// This method is needed for IDE previewer infrastructure
96+
// Этот метод необходим для инфраструктуры предпросмотра IDE
9797
public static AppBuilder BuildAvaloniaApp()
9898
=> AppBuilder.Configure<App>().UsePlatformDetect();
9999

100-
// The entry point. Things aren't ready yet, so at this point
101-
// you shouldn't use any Avalonia types or anything that expects
102-
// a SynchronizationContext to be ready
100+
// Точка входа. На этом этапе всё ещё не готово,
101+
// поэтому не следует использовать какие-либо типы Avalonia или что-либо,
102+
// что ожидает готовности SynchronizationContext
103103
public static int Main(string[] args)
104104
=> BuildAvaloniaApp().Start(AppMain, args);
105105

106-
// Application entry point. Avalonia is completely initialized.
106+
// Точка входа приложения. Avalonia полностью инициализирована.
107107
static void AppMain(Application app, string[] args)
108108
{
109-
// A cancellation token source that will be
110-
// used to stop the main loop
109+
// Источник токена отмены, который будет
110+
// использоваться для остановки основного цикла
111111
var cts = new CancellationTokenSource();
112-
113-
// Do you startup code here
112+
113+
// Здесь ваш код запуска
114114
new Window().Show();
115115

116-
// Start the main loop
116+
// Запуск основного цикла
117117
app.Run(cts.Token);
118118
}
119119
}

0 commit comments

Comments
 (0)