Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jp2masa/Movere
Movere is an implementation of managed dialogs for Avalonia.
https://github.com/jp2masa/Movere
avalonia avaloniaui csharp dialogs
Last synced: 27 days ago
JSON representation
Movere is an implementation of managed dialogs for Avalonia.
- Host: GitHub
- URL: https://github.com/jp2masa/Movere
- Owner: jp2masa
- License: mit
- Created: 2019-06-10T01:52:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-20T02:18:07.000Z (3 months ago)
- Last Synced: 2024-10-30T01:02:46.585Z (about 2 months ago)
- Topics: avalonia, avaloniaui, csharp, dialogs
- Language: C#
- Size: 705 KB
- Stars: 36
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
- awesome-avalonia - Movere - Movere is an implementation of managed dialogs for Avalonia. (Libraries & Extensions / Controls)
README
[![Build Status](https://github.com/jp2masa/Movere/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/jp2masa/Movere/actions/workflows/build.yml)
[![NuGet](https://img.shields.io/nuget/v/Movere.svg)](https://www.nuget.org/packages/Movere/)
[![MyGet](https://img.shields.io/myget/jp2masa/vpre/Movere.svg?label=myget)](https://www.myget.org/feed/jp2masa/package/nuget/Movere)# Movere
![Movere](Icon.png)
Movere is an implementation of managed dialogs for Avalonia. Currently there are message dialogs, as well as open and save file dialogs, and a print dialog (based on `System.Drawing.Printing`) is WIP.
## Getting Started
### Registering file dialogs with Avalonia
To use Avalonia system dialog APIs, it's possible to simply register Movere dialogs with `AppBuilder`:
1. Import `Movere` namespace:
```cs
using Movere;
```2. Add `UseMovere` to `AppBuilder` configuration. Example:
```cs
AppBuilder.Configure()
.UsePlatformDetect()
.UseMovere();
```3. Then use Avalonia system dialog APIs. Example:
```cs
var dialog = new OpenFileDialog();
var result = await dialog.ShowAsync(parent);
```### Using dialog services
To simply use the dialogs (this example is for message dialogs, but it's similar for others):
1. Create a dialog service for `Window` (owner):
```cs
var messageDialogService = new MessageDialogService(owner);
```2. Pass the service to View Model:
```cs
window.DataContext = new ViewModel(messageDialogService);
```3. Show dialog from View Model when you need to:
```cs
private Task ShowInfoAsync() =>
_messageDialogService.ShowMessageDialogAsync(
new MessageDialogOptions(
DialogIcon.Info,
"Message Dialog",
"Some info",
DialogResultSet.OK));
```Available icons are:
- `DialogIcon.None`
- `DialogIcon.Info`
- `DialogIcon.Warning`
- `DialogIcon.Error`To add your own icon, just create an instance of `DialogIcon` and pass the resource string, e.g `avares://My.App/Resources/Icons/MyIcon.png`.
Dialog results are extensible as well, and support localization.
## Roadmap
- Maybe separate file explorer view into separate project.
- Improve styles for dialogs.
- Add tests.
- Print dialog.
- Eventually move file explorer logic to a separate project and create a file explorer application.## Credits
### Icons
#### [flaticon.com](https://www.flaticon.com)
- File - [Kiranshastry](https://www.flaticon.com/authors/kiranshastry)
- Folder - [Smashicons](https://www.flaticon.com/authors/smashicons)### _The project logo is from [linea.io](http://linea.io)._