Skip to content

Commit

Permalink
Merge branch 'main' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
zdpcdt committed Aug 3, 2023
2 parents a68d471 + 2157dc7 commit 9d0b2c9
Show file tree
Hide file tree
Showing 78 changed files with 1,771 additions and 1,825 deletions.
24 changes: 12 additions & 12 deletions i18n/zh-Hans/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,27 @@
"description": "The label for category Building Cross Platform Applications in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Implementation Guides": {
"message": "Implementation Guides",
"message": "实现指南",
"description": "The label for category Implementation Guides in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Styles and Resources": {
"message": "Styles and Resources",
"message": "样式和资源",
"description": "The label for category Styles and Resources in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Graphics and Animation": {
"message": "Graphics and Animation",
"message": "图形和动画",
"description": "The label for category Graphics and Animation in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Custom Controls": {
"message": "自定义控件",
"description": "The label for category Custom Controls in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Development Guides": {
"message": "Development Guides",
"message": "开发指南",
"description": "The label for category Development Guides in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Platforms": {
"message": "Platforms",
"message": "平台",
"description": "The label for category Platforms in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Android": {
Expand All @@ -108,39 +108,39 @@
"description": "The label for category iOS in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Raspberry PI": {
"message": "Raspberry PI",
"message": "树莓派",
"description": "The label for category Raspberry PI in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Deep Dives": {
"message": "Deep Dives",
"message": "深潜",
"description": "The label for category Deep Dives in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Data Templates": {
"message": "Data Templates",
"message": "数据模板",
"description": "The label for category Data Templates in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Input": {
"message": "Input",
"message": "输入",
"description": "The label for category Input in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.The MVVM Pattern": {
"message": "The MVVM Pattern",
"message": "MVVM 模式",
"description": "The label for category The MVVM Pattern in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.ReactiveUI": {
"message": "ReactiveUI",
"description": "The label for category ReactiveUI in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Services": {
"message": "Services",
"message": "服务",
"description": "The label for category Services in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Storage Provider": {
"message": "Storage Provider",
"description": "The label for category Storage Provider in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Deployment": {
"message": "Deployment",
"message": "部署",
"description": "The label for category Deployment in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Reference": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
id: index
title: Deep Dives
title: 深潜
---

# Deep Dives
# 深潜

本节包含的页面将帮助您理解_Avalonia UI使用的一些概念。_这是背景和理论信息,通常由您可以完成的代码示例支持。本节按标题的字母顺序排列#x20;
本节包含的页面将帮助您理解_Avalonia UI使用的一些概念。_这是背景和理论信息,通常由您可以完成的代码示例支持。本节按标题的字母顺序排列

:::tip
如果您是新的_Avalonia UI_,我们建议您在阅读这些页面之前完成['开始'](../get-started)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,83 @@ id: clipboard
title: Clipboard
---

The `Clipboard` class enables interacting with the system clipboard, providing functionality for setting and retrieving text, clearing the clipboard, handling data objects and working with different data formats.
`Clipboard` 类允许与系统剪贴板交互,提供设置和获取文本、清空剪贴板、处理数据对象以及使用不同数据格式的功能。

:::info
For a complete, runnable example of these concepts in action, check out [the sample application](https://github.com/AvaloniaUI/AvaloniaUI.QuickGuides/tree/main/ClipboardOps).
有关这些概念实际运用的完整可运行示例,请查看[示例应用](https://github.com/AvaloniaUI/AvaloniaUI.QuickGuides/tree/main/ClipboardOps)
:::

The `Clipboard` can be access through an instance of `TopLevel` or `Window`, for more details on accessing `TopLevel` please visit [TopLevel](../toplevel) page:
可以通过 `TopLevel``Window` 实例来访问 `Clipboard`。有关访问 `TopLevel` 的更多详细信息,请访问[TopLevel](../toplevel)页面:

```cs
var clipboard = window.Clipboard;
```

## Methods
## 方法

### GetTextAsync()

Retrieves text from the clipboard asynchronously. The resulting value of the task is the text from the clipboard. If the clipboard doesn't contain text or is empty, the method returns `null`.
异步从剪贴板检索文本。任务的结果值是剪贴板中的文本。如果剪贴板不包含文本或为空,则该方法返回 `null`

```cs
Task<string?> GetTextAsync()
```

:::note
Avalonia clipboard always operates with Unicode text.
Avalonia 剪贴板始终处理 Unicode 文本。
:::

### SetTextAsync(string? text)
Sets the clipboard text asynchronously and flushes it immediately. This method accepts a `string?` parameter for a text that needs to be copied. If the provided text is `null`, the clipboard will be cleared.

异步设置剪贴板文本,并立即清除剪贴板。该方法接受 `string?` 参数,用于复制需要的文本。如果提供的文本为 `null`,则剪贴板将被清除。

```cs
Task SetTextAsync(string? text)
```

:::note
Unlikely different Win32 clipboard APIs, Avalonia clipboard always flushes data and is never delayed.
与不同的 Win32 剪贴板 API 不同,Avalonia 剪贴板始终刷新数据,永远不会延迟。
:::

### ClearAsync()
Clears the clipboard asynchronously flushes it immediately.

异步清除剪贴板并立即刷新。

```cs
Task ClearAsync()
```

### SetDataObjectAsync(IDataObject data)
Sets the clipboard content to the specified data object asynchronously. This method accepts an `IDataObject` parameter. The data object can contain multiple data formats.

异步将剪贴板内容设置为指定的数据对象。该方法接受 `IDataObject` 参数。数据对象可以包含多种数据格式。

```cs
Task SetDataObjectAsync(IDataObject data)
```

:::note
Unlikely different Win32 clipboard APIs, Avalonia clipboard always flushes data and is never delayed.
与不同的 Win32 剪贴板 API 不同,Avalonia 剪贴板始终刷新数据,永远不会延迟。
:::

### GetFormatsAsync()
Retrieves the list of formats currently stored in the clipboard asynchronously. The resulting value of the task is an array of string format names.

异步检索当前存储在剪贴板中的格式列表。任务的结果值是一个字符串格式名称的数组。

```cs
Task<string[]> GetFormatsAsync()
```

### GetDataAsync(string format)
Retrieves data in the specified format from the clipboard asynchronously. This method returns a `Task<object?>` that represents the operation. The resulting value of the task is the clipboard data in the specified format. If there's no data in the clipboard in the specified format, the method returns `null`.

异步从剪贴板中检索指定格式的数据。该方法返回一个 `Task<object?>`,代表该操作。任务的结果值是指定格式的剪贴板数据。如果剪贴板中没有指定格式的数据,则该方法返回 `null`

```cs
Task<object?> GetDataAsync(string format)
```

## Creating a DataObject to be sent to the clipboard
## 创建要发送到剪贴板的 DataObject

You can store objects on the clipboard on some platforms with different formats.
您可以将对象存储在剪贴板上,并使用不同的格式在某些平台上进行存储。

```csharp title='C#'
private async void CopyButton_OnClick(object? sender, RoutedEventArgs args)
Expand All @@ -85,9 +91,9 @@ private async void CopyButton_OnClick(object? sender, RoutedEventArgs args)
}
```

## Platform compatibility:
## 平台兼容性:

| Feature | Windows | macOS | Linux x11 | Browser | Android | iOS |
| 功能 | Windows | macOS | Linux x11 | 浏览器 | Android | iOS |
|---------------|-------|-------|-------|-------|-------|-------|
| `GetTextAsync` ||||** |||
| `SetTextAsync` |||||||
Expand All @@ -96,6 +102,6 @@ private async void CopyButton_OnClick(object? sender, RoutedEventArgs args)
| `SetDataObjectAsync` ||||* |* |* |
| `GetDataAsync` ||||* |* |* |

\* Technically possible, but wasn't implemented yet. Contributions are welcome!
\* 在技术上可能可行,但尚未实现。欢迎贡献!

** In the Mozilla browser, the GetTextAsync method only functions after the "Paste" gesture has been triggered, typically by using Ctrl+V.
** Mozilla 浏览器中,GetTextAsync 方法仅在触发“粘贴”手势后才起作用,通常是通过使用 Ctrl+V
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,44 @@ id: focus-manager
title: Focus Manager
---

The `FocusManager` service is responsible for managing the keyboard focus for the application. It keeps track of the currently focused element and the current focus scope.
`FocusManager`服务负责管理应用程序的键盘焦点。它会跟踪当前聚焦的元素和当前焦点范围。

The `FocusManager` can be access through an instance of `TopLevel` or `Window`, for more details on accessing `TopLevel` please visit [TopLevel](../toplevel) page:
通过`TopLevel``Window`的实例可以访问`FocusManager`,有关访问`TopLevel`的更多细节,请访问[TopLevel](../toplevel)页面:
```cs
var focusManager = window.FocusManager;
```

## Methods
## 方法

### GetFocusedElement()
Returns the currently focused element.
### GetFocusedElement()

返回当前聚焦的元素。

```cs
IInputElement? GetFocusedElement()
```

### ClearFocus()
Clears the currently focused element.

清除当前聚焦的元素。

```cs
void ClearFocus()
```

## Tips
## 提示

### Focusing a control
### 聚焦控件

Developers usually don't need a `FocusManager` service to focus a control.
It can be achieved with a method call directly on the control:
通常开发人员不需要使用`FocusManager`服务来聚焦控件。
可以直接通过调用控件的方法实现:
```cs
var hasFocused = button.Focus();
```

`Focus` method might return `false` is control is not visible and has `Focusable` property set to false.
如果控件不可见并且`Focusable`属性设置为false,`Focus`方法可能返回`false`

### Listening for global focus changes
### 监听全局焦点变化

While `FocusManager.GetFocusedElement` method allows to get currently focused control, it's not suitable as an event.
Instead, please use `InputElement.GotFocusEvent.Raised.Subscribe(handler)` method. Note, it listens events globally across all top levels.
虽然`FocusManager.GetFocusedElement`方法允许获取当前聚焦的控件,但它不适合作为事件使用。
相反,请使用`InputElement.GotFocusEvent.Raised.Subscribe(handler)`方法。注意,它会在所有顶级窗口中全局监听事件。
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
id: index
title: Services
title: 服务
---

This section will introduce you to the services inlcuded in an application.
这部分将向您介绍应用程序中包含的服务。

```mdx-code-block
import {DocsCardList} from '../../../../../../src/components/DocsCard';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,65 @@ id: insets-manager
title: Insets Manager
---

The `InsetsManager` allows you to interact with the platform's system bars and handle changes to the safe area of the mobile window.
`InsetsManager` 允许您与平台的系统栏进行交互,并处理移动窗口的安全区域变化。

The `InsetsManager` can be access through an instance of `TopLevel` or `Window`, for more details on accessing `TopLevel` please visit [TopLevel](../toplevel) page:
`InsetsManager` 可以通过 `TopLevel` `Window` 的实例来访问,有关访问 `TopLevel` 的更多详细信息,请访问 [TopLevel](../toplevel) 页面:
```cs
var insetsManager = TopLevel.GetTopLevel(control).InsetsManager;
```

:::note
As for now, this service has implementation only on mobile and browser backends. If you need to adjust desktop window decorations, please use `Window.ExtendClientAreaToDecorationsHint`, `Window.ExtendClientAreaChromeHints`, `Window.ExtendClientAreaTitleBarHeightHint` properties.
截至目前,此服务仅在移动和浏览器后端上实现。如果您需要调整桌面窗口装饰,请使用 `Window.ExtendClientAreaToDecorationsHint``Window.ExtendClientAreaChromeHints``Window.ExtendClientAreaTitleBarHeightHint` 属性。
:::

## Properties
## 属性

### IsSystemBarVisible
Gets or sets a value indicating whether the system bars are visible. Returns null if the platform doesn't support showing or hiding system bars.
获取或设置一个值,指示系统栏是否可见。如果平台不支持显示或隐藏系统栏,则返回 null

```cs
bool? IsSystemBarVisible { get; set; }
```

### DisplayEdgeToEdge
Gets or sets a value indicating whether the window should be drawn edge-to-edge behind any visible system bars.
获取或设置一个值,指示窗口是否应在任何可见的系统栏后绘制到边缘。

```cs
bool DisplayEdgeToEdge { get; set; }
```

### SafeAreaPadding
Gets the current safe area padding. The safe area represents the portion of the window that is not obscured by system bars.
获取当前的安全区域填充。安全区域代表窗口不被系统栏遮挡的部分。

```cs
Thickness SafeAreaPadding { get; }
```

### SystemBarColor
Gets or sets the color of the platform's system bars. Returns null if the platform doesn't support setting the system bar color.
获取或设置平台系统栏的颜色。如果平台不支持设置系统栏颜色,则返回 null

```cs
Color? SystemBarColor { get; set; }
```

## Events
## 事件

### SafeAreaChanged
Occurs when the safe area for the current window changes. This can happen when system bars are shown or hidden, or when the window's size or orientation changes.
当前窗口的安全区域发生变化时触发此事件。这可能发生在系统栏显示或隐藏时,或者窗口的大小或方向发生变化时。

```cs
event EventHandler<SafeAreaChangedArgs>? SafeAreaChanged;
```

---

# SafeAreaChangedArgs
SafeAreaChangedArgs is a class that provides data for the SafeAreaChanged event.
# SafeAreaChangedArgs
SafeAreaChangedArgs 是一个类,提供 SafeAreaChanged 事件的数据。

## Properties
## 属性

### SafeAreaPadding
Gets the new safe area padding.
获取新的安全区域填充。

```
public Thickness SafeAreaPadding { get; }
Expand All @@ -70,15 +70,15 @@ public Thickness SafeAreaPadding { get; }
---

# SystemBarTheme
SystemBarTheme is an enumeration with values that represent light and dark themes for the system bar.
SystemBarTheme 是一个枚举,其值代表系统栏的浅色和深色主题。

## Values
##

### Light
The system bar has a light background and a dark foreground.
系统栏具有浅色背景和深色前景。

### Dark
The system bar has a dark background and a light foreground.
系统栏具有深色背景和浅色前景。



Expand Down
Loading

0 comments on commit 9d0b2c9

Please sign in to comment.