-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b556be6
commit 8542833
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Psynapsis | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
# StaX.Domain | ||
|
||
**[`StaX.Domain`](https://www.nuget.org/packages/StaX.Domain)** is a core library built on [Avalonia](https://github.com/AvaloniaUI) and [Fluent Avalonia](https://github.com/amwx/FluentAvalonia), designed for plugin development and integration within the StaX application. It provides essential abstractions and a flexible architecture that allows developers to create custom plugins for the StaX platform. | ||
|
||
## Features | ||
|
||
- **Plugin Development Support**: [`StaX.Domain`](https://www.nuget.org/packages/StaX.Domain) provides a base class [`UiState`](https://github.com/Psynapsis/StaX.Domain/blob/main/Source/StaX.Domain/UiState.cs), allowing developers to build plugins that can be easily integrated into the main StaX application. | ||
- **Modular Architecture**: Each plugin is developed independently and can be placed in the `Plugins` folder of the StaX application for dynamic loading. | ||
- **Flexible UI Design**: Plugins can fully control their UI, making them adaptable to various use cases. | ||
|
||
## Installation | ||
|
||
You can install the **[`StaX.Domain`](https://www.nuget.org/packages/StaX.Domain)** NuGet package using the .NET CLI or the NuGet Package Manager in Visual Studio. | ||
|
||
### .NET CLI | ||
|
||
```bash | ||
dotnet add package StaX.Domain | ||
``` | ||
|
||
### Package Manager Console | ||
|
||
```bash | ||
Install-Package StaX.Domain | ||
``` | ||
|
||
## Usage | ||
|
||
### Creating a Plugin | ||
|
||
To create a plugin for the StaX application, follow these steps: | ||
|
||
1. Install the **[`StaX.Domain`](https://www.nuget.org/packages/StaX.Domain)** package in your project. | ||
2. Create a class that inherits from [`UiState`](https://github.com/Psynapsis/StaX.Domain/blob/main/Source/StaX.Domain/UiState.cs), which defines the UI and behavior of your plugin. | ||
|
||
Here is a simple example: | ||
|
||
```csharp | ||
using Avalonia.Markup.Xaml; | ||
using FluentAvalonia.UI.Controls; | ||
using MyStaxPlugin.ViewModels; | ||
using MyStaxPlugin.Views; | ||
using StaX.Domain; | ||
|
||
namespace MyStaxPlugin; | ||
|
||
public partial class MyState : UiState | ||
{ | ||
public override string StateName { get; protected set; } = "MyStaxPlugin"; | ||
public override string ToolTip { get; protected set; } = "MyStaxPlugin"; | ||
public override Symbol? Icon { get; protected set; } = Symbol.ShareAndroid; | ||
|
||
public MyState() | ||
{ | ||
StateView = new MyView(); | ||
StateViewModel = new MyViewModel(); | ||
} | ||
|
||
public override void Initialize() => AvaloniaXamlLoader.Load(this); | ||
} | ||
``` | ||
|
||
3. Assemble your project to create a `.dll` file. | ||
4. Copy the created `.dll` file in the folder with the name of your plugin to the `Plugins` folder of the StaX application. The plugin will be loaded automatically when you start StaX. | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! If you'd like to help improve **[`StaX.Domain`](https://www.nuget.org/packages/StaX.Domain)** or add features, feel free to fork the repository and submit a pull request. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details. |