mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Meta - Replace WPF projects with Avalonia projects
This commit is contained in:
1 parent
fcf0376a9a
commit
d7f3ee1190
1110 files changed
+10872
-52240
No files matched your search
@@ -0,0 +1,67 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:builders="clr-namespace:Artemis.UI.Shared.Services.Builders;assembly=Artemis.UI.Shared"
|
||||
xmlns:controls="clr-namespace:Artemis.UI.Shared.Controls;assembly=Artemis.UI.Shared"
|
||||
xmlns:controls1="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:attachedProperties="clr-namespace:Artemis.UI.Shared.AttachedProperties;assembly=Artemis.UI.Shared"
|
||||
xmlns:workshop="clr-namespace:Artemis.UI.Screens.Workshop"
|
||||
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker;assembly=Artemis.UI.Shared"
|
||||
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.Controls.DataModelPicker;assembly=Artemis.UI.Shared"
|
||||
mc:Ignorable="d" d:DesignWidth="800"
|
||||
x:Class="Artemis.UI.Screens.Workshop.WorkshopView"
|
||||
x:DataType="workshop:WorkshopViewModel">
|
||||
<Border Classes="router-container">
|
||||
<StackPanel Margin="12" Spacing="5">
|
||||
<Border Classes="card">
|
||||
<StackPanel Spacing="5">
|
||||
<TextBlock Classes="h4">Nodes tests</TextBlock>
|
||||
<!-- <dataModelPicker:DataModelPickerButton Placement="BottomEdgeAlignedLeft"/> -->
|
||||
<ContentControl Content="{CompiledBinding VisualEditorViewModel}" HorizontalAlignment="Stretch" Height="800"></ContentControl>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Classes="card">
|
||||
<StackPanel Spacing="5">
|
||||
<TextBlock Classes="h4">Notification tests</TextBlock>
|
||||
<Button Command="{CompiledBinding ShowNotification}" CommandParameter="{x:Static builders:NotificationSeverity.Informational}">
|
||||
Notification test (default)
|
||||
</Button>
|
||||
<Button Command="{CompiledBinding ShowNotification}" CommandParameter="{x:Static builders:NotificationSeverity.Warning}">
|
||||
Notification test (warning)
|
||||
</Button>
|
||||
<Button Command="{CompiledBinding ShowNotification}" CommandParameter="{x:Static builders:NotificationSeverity.Error}">
|
||||
Notification test (error)
|
||||
</Button>
|
||||
<Button Command="{CompiledBinding ShowNotification}" CommandParameter="{x:Static builders:NotificationSeverity.Success}">
|
||||
Notification test (success)
|
||||
</Button>
|
||||
|
||||
<controls:HotkeyBox Watermark="Some hotkey" Width="250" HorizontalAlignment="Left" />
|
||||
|
||||
<controls1:NumberBox
|
||||
attachedProperties:NumberBoxAssist.PrefixText="$"
|
||||
attachedProperties:NumberBoxAssist.SuffixText="%"></controls1:NumberBox>
|
||||
|
||||
<TextBox
|
||||
attachedProperties:TextBoxAssist.PrefixText="$"
|
||||
attachedProperties:TextBoxAssist.SuffixText="%"></TextBox>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||
<Border Classes="card" Cursor="{CompiledBinding Cursor}">
|
||||
<TextBlock Text="{CompiledBinding SelectedCursor}"></TextBlock>
|
||||
</Border>
|
||||
<controls:EnumComboBox Value="{CompiledBinding SelectedCursor}"></controls:EnumComboBox>
|
||||
</StackPanel>
|
||||
|
||||
<Button Command="{Binding CreateRandomGradient}">
|
||||
Create random gradient
|
||||
</Button>
|
||||
|
||||
|
||||
<gradientPicker:GradientPickerButton ColorGradient="{CompiledBinding ColorGradient}" IsCompact="True"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,18 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop
|
||||
{
|
||||
public class WorkshopView : ReactiveUserControl<WorkshopViewModel>
|
||||
{
|
||||
public WorkshopView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<UserControl x:Class="Artemis.UI.Screens.Workshop.WorkshopView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="16">
|
||||
<materialDesign:PackIcon Kind="Crane" Width="250" Height="250" HorizontalAlignment="Center" />
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline4TextBlock}" TextWrapping="Wrap" HorizontalAlignment="Center" Margin="0 25">
|
||||
Workshop is not yet implemented
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap" HorizontalAlignment="Center" Margin="0 25">
|
||||
The workshop is one of the long-term goals of Artemis 2. It will be a hub where you can share your <LineBreak />
|
||||
creations with others and easily look for awesome new profiles and plugins.<LineBreak /><LineBreak />
|
||||
These are some of the planned features that will be part of the workshop in the future:<LineBreak /><LineBreak />
|
||||
- Profiles<LineBreak />
|
||||
- Custom brushes <LineBreak />
|
||||
- Support for extra devices<LineBreak />
|
||||
- Support for extra games and other modules <LineBreak />
|
||||
- All of the features mentioned above will be able to receive upvotes/downvotes and comments <LineBreak />
|
||||
- A web-based interface for the workshop so you can browse/manage uploads outside Artemis as well <LineBreak />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -1,34 +1,95 @@
|
||||
using System.Windows.Media;
|
||||
using Stylet;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Artemis.UI.Screens.VisualScripting;
|
||||
using Artemis.UI.Shared.Services.Builders;
|
||||
using Artemis.UI.Shared.Services.Interfaces;
|
||||
using Artemis.VisualScripting.Nodes;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop
|
||||
{
|
||||
public class WorkshopViewModel : MainScreenViewModel
|
||||
{
|
||||
private Color _testColor;
|
||||
private bool _testPopupOpen;
|
||||
private static NodeScript<bool>? _testScript = null;
|
||||
|
||||
public WorkshopViewModel()
|
||||
private readonly INotificationService _notificationService;
|
||||
private StandardCursorType _selectedCursor;
|
||||
private readonly ObservableAsPropertyHelper<Cursor> _cursor;
|
||||
|
||||
private ColorGradient _colorGradient = new()
|
||||
{
|
||||
new ColorGradientStop(new SKColor(0xFFFF6D00), 0f),
|
||||
new ColorGradientStop(new SKColor(0xFFFE6806), 0.2f),
|
||||
new ColorGradientStop(new SKColor(0xFFEF1788), 0.4f),
|
||||
new ColorGradientStop(new SKColor(0xFFEF1788), 0.6f),
|
||||
new ColorGradientStop(new SKColor(0xFF00FCCC), 0.8f),
|
||||
new ColorGradientStop(new SKColor(0xFF00FCCC), 1f),
|
||||
};
|
||||
|
||||
public WorkshopViewModel(IScreen hostScreen, INotificationService notificationService, INodeVmFactory nodeVmFactory) : base(hostScreen, "workshop")
|
||||
{
|
||||
_notificationService = notificationService;
|
||||
_cursor = this.WhenAnyValue(vm => vm.SelectedCursor).Select(c => new Cursor(c)).ToProperty(this, vm => vm.Cursor);
|
||||
|
||||
DisplayName = "Workshop";
|
||||
ShowNotification = ReactiveCommand.Create<NotificationSeverity>(ExecuteShowNotification);
|
||||
|
||||
if (_testScript == null)
|
||||
{
|
||||
_testScript = new NodeScript<bool>("Test script", "A test script");
|
||||
INode exitNode = _testScript.Nodes.Last();
|
||||
exitNode.X = 300;
|
||||
exitNode.Y = 150;
|
||||
|
||||
OrNode orNode = new() {X = 100, Y = 100};
|
||||
_testScript.AddNode(orNode);
|
||||
orNode.Result.ConnectTo(exitNode.Pins.First());
|
||||
}
|
||||
|
||||
VisualEditorViewModel = nodeVmFactory.NodeScriptViewModel(_testScript);
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(20), DispatcherPriority.Normal, (_, _) => _testScript?.Run());
|
||||
updateTimer.Start();
|
||||
Disposable.Create(() => updateTimer.Stop()).DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
public Color TestColor
|
||||
public NodeScriptViewModel VisualEditorViewModel { get; }
|
||||
|
||||
public ReactiveCommand<NotificationSeverity, Unit> ShowNotification { get; set; }
|
||||
|
||||
public StandardCursorType SelectedCursor
|
||||
{
|
||||
get => _testColor;
|
||||
set => SetAndNotify(ref _testColor, value);
|
||||
get => _selectedCursor;
|
||||
set => RaiseAndSetIfChanged(ref _selectedCursor, value);
|
||||
}
|
||||
|
||||
public bool TestPopupOpen
|
||||
public Cursor Cursor => _cursor.Value;
|
||||
|
||||
public ColorGradient ColorGradient
|
||||
{
|
||||
get => _testPopupOpen;
|
||||
set => SetAndNotify(ref _testPopupOpen, value);
|
||||
get => _colorGradient;
|
||||
set => RaiseAndSetIfChanged(ref _colorGradient, value);
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
public void CreateRandomGradient()
|
||||
{
|
||||
TestPopupOpen = !TestPopupOpen;
|
||||
TestColor = Color.FromRgb(5, 174, 255);
|
||||
ColorGradient = ColorGradient.GetRandom(6);
|
||||
}
|
||||
|
||||
private void ExecuteShowNotification(NotificationSeverity severity)
|
||||
{
|
||||
_notificationService.CreateNotification().WithTitle("Test title").WithMessage("Test message").WithSeverity(severity).Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user