Skip to content

Commit a7b81a6

Browse files
Обновлен перевод документации для диалоговых окон файлов (#704)
Co-authored-by: Terentev A. A. <[email protected]>
1 parent 07967a8 commit a7b81a6

File tree

1 file changed

+17
-17
lines changed
  • i18n/ru/docusaurus-plugin-content-docs/current/basics/user-interface

1 file changed

+17
-17
lines changed

i18n/ru/docusaurus-plugin-content-docs/current/basics/user-interface/file-dialogs.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
---
22
id: file-dialogs
3-
title: File Dialogs
3+
title: Диалоговые окна файлов
44
---
55

6-
The file dialog functionality is accessed through the [`StorageProvider`](../../concepts/services/storage-provider) service API, which is available from the `Window` or `TopLevel` classes. This page shows only basic usage and for more information about this API please visit StorageProvider page.
6+
Функциональность диалоговых окон файлов доступна через API сервиса [`StorageProvider`](../../concepts/services/storage-provider), который доступен из классов `Window` или `TopLevel`. Эта страница показывает только базовое использование, а для получения дополнительной информации об этом API, пожалуйста, посетите страницу StorageProvider.
77

88
<GitHubSampleLink title="File Dialogs" link="https://github.com/AvaloniaUI/AvaloniaUI.QuickGuides/tree/main/FileOps"/>
99

1010
## OpenFilePickerAsync
1111

12-
This method opens a file picker dialog, allowing the user to select a file. `FilePickerOpenOptions` defines options that are passed to the OS dialog.
12+
Этот метод открывает диалоговое окно выбора файла, позволяющее пользователю выбрать файл. `FilePickerOpenOptions` определяет параметры, передаваемые в диалоговое окно операционной системы.
1313

1414
```cs
1515
public class MyView : UserControl
1616
{
1717
private async void OpenFileButton_Clicked(object sender, RoutedEventArgs args)
1818
{
19-
// Get top level from the current control. Alternatively, you can use Window reference instead.
19+
// Получаем верхний уровень из текущего элемента управления. Альтернативно можно использовать ссылку на Window.
2020
var topLevel = TopLevel.GetTopLevel(this);
2121

22-
// Start async operation to open the dialog.
22+
// Запускаем асинхронную операцию для открытия диалогового окна.
2323
var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
2424
{
25-
Title = "Open Text File",
25+
Title = "Открыть текстовый файл",
2626
AllowMultiple = false
2727
});
2828

2929
if (files.Count >= 1)
3030
{
31-
// Open reading stream from the first file.
31+
// Открываем поток чтения из первого файла.
3232
await using var stream = await files[0].OpenReadAsync();
3333
using var streamReader = new StreamReader(stream);
34-
// Reads all the content of file as a text.
34+
// Читаем всё содержимое файла как текст.
3535
var fileContent = await streamReader.ReadToEndAsync();
3636
}
3737
}
@@ -42,40 +42,40 @@ public class MyView : UserControl
4242

4343
## SaveFilePickerAsync
4444

45-
This method opens a file save dialog, allowing the user to save a file. `FilePickerSaveOptions` defines options that are passed to the OS dialog.
45+
Этот метод открывает диалоговое окно сохранения файла, позволяющее пользователю сохранить файл. `FilePickerSaveOptions` определяет параметры, передаваемые в диалоговое окно операционной системы.
4646

47-
### Example
47+
### Пример
4848

4949
```cs
5050
public class MyView : UserControl
5151
{
5252
private async void SaveFileButton_Clicked(object sender, RoutedEventArgs args)
5353
{
54-
// Get top level from the current control. Alternatively, you can use Window reference instead.
54+
// Получаем верхний уровень из текущего элемента управления. Альтернативно можно использовать ссылку на Window.
5555
var topLevel = TopLevel.GetTopLevel(this);
5656

57-
// Start async operation to open the dialog.
57+
// Запускаем асинхронную операцию для открытия диалогового окна.
5858
var file = await topLevel.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
5959
{
60-
Title = "Save Text File"
60+
Title = "Сохранить текстовый файл"
6161
});
6262

6363
if (file is not null)
6464
{
65-
// Open writing stream from the file.
65+
// Открываем поток записи в файл.
6666
await using var stream = await file.OpenWriteAsync();
6767
using var streamWriter = new StreamWriter(stream);
68-
// Write some content to the file.
68+
// Записываем некоторое содержимое в файл.
6969
await streamWriter.WriteLineAsync("Hello World!");
7070
}
7171
}
7272
}
7373
```
7474

75-
For more information on StorageProvider service including on how to keep access to the picked files and what possible options are supported, please visit [`StorageProvider`](../../concepts/services/storage-provider) documentation page and subpages.
75+
Для получения дополнительной информации о сервисе StorageProvider, включая информацию о том, как сохранить доступ к выбранным файлам и какие возможные параметры поддерживаются, пожалуйста, посетите страницу документации [`StorageProvider`](../../concepts/services/storage-provider) и подстраницы.
7676

7777
:::note
78-
The provided examples directly access the [`StorageProvider`](../../concepts/services/storage-provider) API inside the ViewModel for learning purposes. In a real-world application, it's recommended to adhere to MVVM principles by creating service classes and locating them with Dependency Injection / Inversion of Control (DI/IoC). Please refer to the [IoCFileOps](https://github.com/AvaloniaUI/AvaloniaUI.QuickGuides/tree/main/IoCFileOps) and DepInject projects for samples of how to achieve this.
78+
Приведенные примеры напрямую обращаются к API [`StorageProvider`](../../concepts/services/storage-provider) внутри ViewModel в учебных целях. В реальном приложении рекомендуется придерживаться принципов MVVM, создавая сервисные классы и размещая их с помощью Dependency Injection / Inversion of Control (DI/IoC). Обратитесь к проектам [IoCFileOps](https://github.com/AvaloniaUI/AvaloniaUI.QuickGuides/tree/main/IoCFileOps) и DepInject для примеров того, как этого достичь.
7979
:::
8080

8181

0 commit comments

Comments
 (0)