Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
kikipoulet committed Oct 3, 2024
2 parents 71fef32 + 81df0dd commit 8b3d110
Show file tree
Hide file tree
Showing 7 changed files with 274 additions and 18 deletions.
4 changes: 0 additions & 4 deletions docs/docs/documentation/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,9 @@ Visit [SukiUI on Nuget](https://www.nuget.org/packages/SukiUI) for more informat

5. Select `SukiUI.dll` you downloaded

6. Add a Nuget package `System.Reactive`

::: tip
The package list should be:

![](/getting-started/introduction-final-package-list.webp "package list")

If installed by referencing `.dll`, there should be a `System.Reactive` here.
:::
</details>
6 changes: 1 addition & 5 deletions docs/docs/documentation/getting-started/launch.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public partial class MainWindow : Window

Modified `MainWindow.axaml.cs`:


```csharp
using SukiUI.Controls; // [!code highlight]
Expand All @@ -85,9 +84,6 @@ public partial class MainWindow : SukiWindow // [!code highlight]

You're now ready to use SukiUI ! We advise you to theme your app now. Please check the [Theming Page](https://kikipoulet.github.io/SukiUI/documentation/theming/basic.html) and the [SukiWindow Page](https://kikipoulet.github.io/SukiUI/documentation/controls/layout/sukiwindow.html)




::: warning
If you encounter the following exception:
- `SukiWindow` not found [Issue#265](https://github.com/kikipoulet/SukiUI/issues/265)
Expand All @@ -98,4 +94,4 @@ If you encounter the following exception:
There are two possible solutions to try:
- Upgrade or downgrade the version of `Avalonia` and `SukiUI` until the exception is resolved
- While ensuring that `Avalonia` is up to date (beta), reference the build `.dll` from [Github Action](https://github.com/kikipoulet/SukiUI/actions/workflows/build.yml) and proceed with the [following steps](/documentation/getting-started/installation#via-github-action)
:::
:::
18 changes: 16 additions & 2 deletions docs/docs/documentation/hosts/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The host is designed in such a way as to be MVVM friendly and as long as you hav
Here is a simple example setup using MVVM:

### View

```xml
<!-- XMLNS definitions omitted for brevity -->
<suki:SukiWindow>
Expand All @@ -17,6 +18,7 @@ Here is a simple example setup using MVVM:
```

### ViewModel

```cs
public class ExampleViewModel
{
Expand All @@ -28,6 +30,7 @@ public class ExampleViewModel
If you do not wish to use MVVM, or would rather a simpler solution that "just works", then you can choose to implement it like this:

### AXAML

```xml
<!-- XMLNS definitions omitted for brevity -->
<suki:SukiWindow>
Expand All @@ -36,7 +39,9 @@ If you do not wish to use MVVM, or would rather a simpler solution that "just wo
</suki:SukiWindow.Hosts>
<suki:SukiWindow>
```

### Code-Behind

```cs
public class MainWindow : SukiWindow
{
Expand Down Expand Up @@ -77,6 +82,9 @@ public void DisplayDialog()
}
```

![dialog](https://github.com/user-attachments/assets/efd34873-b4c1-45bf-a14b-d7a7b11a77c1)


## Dismissing Dialogs

By default, dialogs have no mechanism to be dismissed. In order to add dismissal mechanisms to a dialog it's necessary to use the `.Dismiss()` method, at which point you can provide a method by which the dialogs can be dismissed. Currently the only standalone dismissal is `.ByClickingBackground()` which will dismiss the dialog when the user clicks outside of it.
Expand Down Expand Up @@ -105,11 +113,17 @@ public void DisplayDialog()
{
dialogManager.CreateDialog()
.WithActionButton("Don't Close", _ => { })
.WithActionButton("Close ", _ => { }, true) // last parameter optional
.WithActionButton("Close ", _ => { }, true) // last parameter optional
.TryShow();
}
```

![dialogclose](https://github.com/user-attachments/assets/3d07344f-c302-400a-b2cf-88865e7713ba)


## MessageBox Style

It is possible to use the `.OfType()` method to cause the dialog to use an included MessageBox style, the styles included are: Information, Success, Warning and Error.
It is possible to use the `.OfType()` method to cause the dialog to use an included MessageBox style, the styles included are: `Information`, `Success`, `Warning` and `Error`.

![dialogtypes](https://github.com/user-attachments/assets/1c596315-5e9a-4f4c-b577-e27d0d6b0a1d)

138 changes: 137 additions & 1 deletion docs/docs/documentation/hosts/toast.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ MainWindow.ToastManager.CreateToast()
.Queue();
```

<br/>

## Displaying Toasts

In order to construct and therefore display toasts, a fluent style builder is provided that makes constructing toasts simple. To begin constructing a toast, it's recommended to call the extension method `.CreateToast()` on the `ISukiToastManager` instance you want it to be displayed in.
Expand All @@ -80,6 +82,12 @@ public void DisplayToast()
}
```


![toastsimple](https://github.com/user-attachments/assets/841b13a3-7983-4f39-9c15-3ce97510ba0d)


<br/>

## Dismissing Toasts

By default, toasts have no mechanism to be dismissed other than the capacity of the `SukiToastHost` being exceeded, at which point older toasts are dismissed to make room. In order to add dismissal mechanisms to a toast it's necessary to use the `.Dismiss()` method, at which point you can provide a method by which the toast can be dismissed. It is possible to have more than 1 dismissal method for a toast.
Expand All @@ -95,6 +103,7 @@ public void DisplayToast()
.Queue();
}
```
<br/>

## Interactions

Expand All @@ -112,4 +121,131 @@ public void DisplayToast()
.WithActionButton("Dismiss", _ => { }, true)
.Queue();
}
```
```

<br/>

## Toast Types

### Information

![toastsimple](https://github.com/user-attachments/assets/6a9f14b6-64a9-4a7b-a6b6-e15d8ad80ebc)


```cs
public void DisplayToast()
{
ToastManager.CreateToast()
.OfType(NotificationType.Information)
.Queue();
}
```

### Success


![success](https://github.com/user-attachments/assets/71ea5077-21b6-4f8b-bbe8-7ef2760041ef)


```cs
public void DisplayToast()
{
ToastManager.CreateToast()
.OfType(NotificationType.Success)
.Queue();
}
```

### Warning

![warning](https://github.com/user-attachments/assets/303999ab-44ba-4819-82ad-a8869c7ca5f3)


```cs
public void DisplayToast()
{
ToastManager.CreateToast()
.OfType(NotificationType.Warning)
.Queue();
}
```

### Error

![error](https://github.com/user-attachments/assets/686da808-e594-41cf-b44a-ae586eadedc7)


```cs
public void DisplayToast()
{
ToastManager.CreateToast()
.OfType(NotificationType.Error)
.Queue();
}
```





<br/>

## Loading Toast

![loading](https://github.com/user-attachments/assets/7857721a-e7a0-4bf5-beff-31363c606ce4)


```cs
public void DisplayToast()
{
ToastManager.CreateToast()
.WithLoadingState(true)
.Queue();
}
```




<br/>

## Complex Interaction

Here is an example of an "Update" toast.


![loading](https://github.com/user-attachments/assets/479d7e09-a37b-4595-85a5-02c669b8592a)


```cs
private void ShowActionToast()
{
toastManager.CreateToast()
.WithTitle("Update Available")
.WithContent("Information, Update v1.0.0.0 is Now Available.")
.WithActionButtonNormal("Later", _ => { }, true)
.WithActionButton("Update", _ => ShowUpdatingToast(), true)
.Queue();
}

private void ShowUpdatingToast()
{
var progress = new ProgressBar() { Value = 0, ShowProgressText = true };
var toast = toastManager.CreateToast()
.WithTitle("Updating...")
.WithContent(progress)
.Queue();
var timer = new Timer(20);
timer.Elapsed += (_, _) =>
{
Dispatcher.UIThread.Invoke(() =>
{
progress.Value += 1;
if (progress.Value < 100) return;
timer.Dispose();
toastManager.Dismiss(toast);
});
};
timer.Start();
}
```
4 changes: 0 additions & 4 deletions docs/docs/zh/documentation/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,8 @@ dotnet add package SukiUI --version 6.0.0

5. 选择刚刚下载的 `SukiUI.dll` 并添加

6. 添加 Nuget 包 `System.Reactive`

::: tip
最终,你的包列表应为:

![](/getting-started/introduction-final-package-list.webp "package list")

如果你是以引用`dll`的方式安装的,此处应有 `System.Reactive`
:::
5 changes: 4 additions & 1 deletion docs/docs/zh/documentation/getting-started/launch.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
</Application>
```

::: warning
如果没有设置主题颜色 `ThemeColor`,创建的窗口和许多控件都将完全透明
:::

## 将 MainWindow 更改为 SukiWindow

原来的 `MainWindow.axaml`:
Expand Down Expand Up @@ -60,7 +64,6 @@ public partial class MainWindow : Window

修改后的 `MainWindow.axaml.cs`:


```csharp
using SukiUI.Controls; // [!code highlight]
Expand Down
Loading

0 comments on commit 8b3d110

Please sign in to comment.