1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 21:38:38 +00:00

UI - Update Avalonia to preview7

UI - Update FluentAvalonia to preview7
This commit is contained in:
Robert 2023-04-26 21:38:15 +02:00
parent b1e39dbd39
commit c50a572363
82 changed files with 214 additions and 208 deletions

View File

@ -16,11 +16,11 @@
<None Remove=".gitignore" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview7" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview6" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview7" />
<PackageReference Include="ReactiveUI" Version="18.4.26" />
</ItemGroup>
<ItemGroup>

View File

@ -15,11 +15,11 @@
<None Remove=".gitignore" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview7" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview6" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview7" />
<PackageReference Include="ReactiveUI" Version="18.4.26" />
</ItemGroup>
<ItemGroup>

View File

@ -10,13 +10,13 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia" Version="11.0.0-preview7" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0-preview6" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0-preview7" />
<PackageReference Include="DynamicData" Version="7.13.1" />
<PackageReference Include="FluentAvaloniaUI" Version="2.0.0-preview6" />
<PackageReference Include="FluentAvaloniaUI" Version="2.0.0-preview7" />
<PackageReference Include="Material.Icons.Avalonia" Version="2.0.0-preview3" />
<PackageReference Include="ReactiveUI" Version="18.4.26" />
<PackageReference Include="ReactiveUI.Validation" Version="3.1.7" />

View File

@ -308,7 +308,7 @@ public class DataModelPicker : TemplatedControl
{
GetDataModel();
UpdateCurrentPath(true);
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(200), DispatcherPriority.Normal, Update);
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(200), DispatcherPriority.Background, Update);
_updateTimer.Start();
}

View File

@ -91,7 +91,7 @@ public partial class EnumComboBox : UserControl
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{
_enumComboBox = this.Get<ComboBox>("ChildEnumComboBox");
_enumComboBox.Items = _currentValues;
_enumComboBox.ItemsSource = _currentValues;
UpdateValues();
UpdateSelection();

View File

@ -37,8 +37,8 @@ public abstract class DataModelVisualizationViewModel : ReactiveObject, IDisposa
CopyPath = ReactiveCommand.CreateFromTask(async () =>
{
if (Application.Current?.Clipboard != null && Path != null)
await Application.Current.Clipboard.SetTextAsync(Path);
if (Path != null)
await UI.Clipboard.SetTextAsync(Path);
});
if (parent == null)

View File

@ -16,7 +16,7 @@ public static class ContainerExtensions
public static void RegisterSharedUI(this IContainer container)
{
Assembly artemisShared = typeof(IArtemisSharedUIService).GetAssembly();
container.RegisterMany(new[] { artemisShared }, type => type.IsAssignableTo<IArtemisSharedUIService>(), Reuse.Singleton);
container.RegisterMany(new[] {artemisShared}, type => type.IsAssignableTo<IArtemisSharedUIService>(), Reuse.Singleton);
UI.Locator = container;
}

View File

@ -26,7 +26,8 @@ public class NotificationBuilder
public NotificationBuilder(Window parent)
{
_parent = parent;
_infoBar = new InfoBar {Classes = Classes.Parse("notification-info-bar")};
_infoBar = new InfoBar();
_infoBar.Classes.Add("notification-info-bar");
}
/// <summary>
@ -204,11 +205,18 @@ public class NotificationButtonBuilder
internal Control Build()
{
Button button = new() {Content = _text};
button.Classes.Add("AppBarButton");
if (_action != null)
return new Button {Content = _text, Command = ReactiveCommand.Create(() => _action()), Classes = new Classes("AppBarButton")};
if (_command != null)
return new Button {Content = _text, Command = _command, CommandParameter = _commandParameter, Classes = new Classes("AppBarButton")};
return new Button {Content = _text, Classes = new Classes("AppBarButton")};
button.Command = ReactiveCommand.Create(() => _action());
else if (_command != null)
{
button.Command = _command;
button.CommandParameter = _commandParameter;
}
return button;
}
}

View File

@ -23,10 +23,7 @@ internal class ExceptionDialogViewModel : DialogViewModelBase<object>
public async Task CopyException()
{
if (Application.Current?.Clipboard == null)
return;
await Application.Current.Clipboard.SetTextAsync(Exception.ToString());
await UI.Clipboard.SetTextAsync(Exception.ToString());
_notificationService.CreateNotification()
.WithMessage("Copied stack trace to clipboard.")
.WithSeverity(NotificationSeverity.Success)

View File

@ -53,7 +53,7 @@
<TreeView Grid.Row="2"
Name="DataModelTreeView"
Items="{Binding DataModelViewModel.Children, RelativeSource={RelativeSource TemplatedParent}}">
ItemsSource="{Binding DataModelViewModel.Children, RelativeSource={RelativeSource TemplatedParent}}">
<TreeView.Styles>
<Style Selector="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />

View File

@ -88,7 +88,7 @@
Background="{DynamicResource LightCheckerboardBrush}"
Margin="5 0">
<Border Background="{TemplateBinding LinearGradientBrush}">
<ItemsControl Name="GradientStops" Items="{TemplateBinding EditingColorGradient}" ClipToBounds="False">
<ItemsControl Name="GradientStops" ItemsSource="{TemplateBinding EditingColorGradient}" ClipToBounds="False">
<ItemsControl.Styles>
<Style Selector="ItemsControl#GradientStops > ContentPresenter">
<Setter Property="Canvas.Left">
@ -134,7 +134,7 @@
Grid.Column="0"
Grid.ColumnSpan="2"
VerticalAlignment="Center"
Items="{TemplateBinding EditingColorGradient}"
ItemsSource="{TemplateBinding EditingColorGradient}"
ClipToBounds="False"
Margin="5 0">
<ItemsControl.Styles>
@ -182,7 +182,7 @@
<ListBox Name="GradientColors"
Grid.Row="0"
MaxHeight="280"
Items="{TemplateBinding EditingColorGradient}"
ItemsSource="{TemplateBinding EditingColorGradient}"
SelectedItem="{TemplateBinding SelectedColorStop, Mode=TwoWay}"
Padding="10 0 15 0">
<ListBox.ItemTemplate>

View File

@ -4,6 +4,7 @@ using System.Reactive.Linq;
using System.Reactive.Subjects;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Input.Platform;
using IContainer = DryIoc.IContainer;
namespace Artemis.UI.Shared;
@ -26,6 +27,11 @@ public static class UI
/// </summary>
public static IContainer Locator { get; set; } = null!;
/// <summary>
/// Gets the clipboard.
/// </summary>
public static IClipboard Clipboard { get; set; } = null!;
/// <summary>
/// Gets a boolean indicating whether hotkeys are to be disabled.
/// </summary>

View File

@ -21,12 +21,12 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview7" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Win32" Version="11.0.0-preview6" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Win32" Version="11.0.0-preview7" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageReference Include="Microsoft.Win32" Version="2.0.1" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0" />

View File

@ -0,0 +1,18 @@
using System.Linq;
using Artemis.UI.Exceptions;
using Avalonia.Platform;
namespace Artemis.UI.Windows.Extensions;
public static class IWindowImplExtensions
{
public static IPlatformHandle GetHandle(this IWindowImpl window)
{
// This is unfortunate
IPlatformHandle? handle = (IPlatformHandle?) window.GetType().GetProperties().FirstOrDefault(p => p.Name == "Handle")?.GetValue(window);
if (handle == null)
throw new ArtemisUIException("Could not get IWindowImpl internal platform handle, Avalonia API change?");
return handle;
}
}

View File

@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
using System.Timers;
using Artemis.Core;
using Artemis.Core.Services;
using Artemis.UI.Windows.Extensions;
using Artemis.UI.Windows.Utilities;
using Avalonia.Controls.Platform;
using Avalonia.Platform;
@ -45,13 +46,14 @@ public class WindowsInputProvider : InputProvider
_window = PlatformManager.CreateWindow();
_hWndProcHook = GetWindowLongPtr(_window.Handle.Handle, GWL_WNDPROC);
IPlatformHandle handle = _window.GetHandle();
_hWndProcHook = GetWindowLongPtr(handle.Handle, GWL_WNDPROC);
_fnWndProcHook = CustomWndProc;
nint newLong = Marshal.GetFunctionPointerForDelegate(_fnWndProcHook);
SetWindowLongPtr(_window.Handle.Handle, GWL_WNDPROC, newLong);
SetWindowLongPtr(handle.Handle, GWL_WNDPROC, newLong);
RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, _window.Handle.Handle);
RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, _window.Handle.Handle);
RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, handle.Handle);
RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, handle.Handle);
}
public static Guid Id { get; } = new("6737b204-ffb1-4cd9-8776-9fb851db303a");

View File

@ -1,5 +1,6 @@
using System;
using System.Linq;
using Artemis.UI.Windows.Extensions;
using Avalonia.Controls.Platform;
using Avalonia.Platform;
using SharpVk;
@ -14,7 +15,7 @@ internal sealed class Win32VkContext : VkContext
Window = PlatformManager.CreateWindow();
Instance = Instance.Create(null, new[] {"VK_KHR_surface", "VK_KHR_win32_surface"});
PhysicalDevice = Instance.EnumeratePhysicalDevices().First();
Surface = Instance.CreateWin32Surface(Kernel32.CurrentModuleHandle, Window.Handle.Handle);
Surface = Instance.CreateWin32Surface(Kernel32.CurrentModuleHandle, Window.GetHandle().Handle);
(GraphicsFamily, PresentFamily) = FindQueueFamilies();

View File

@ -15,17 +15,17 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Controls.PanAndZoom" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Controls.Skia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Controls.Skia" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview7" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0-preview6" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0-preview7" />
<PackageReference Include="DryIoc.dll" Version="5.3.4" />
<PackageReference Include="DynamicData" Version="7.13.1" />
<PackageReference Include="FluentAvaloniaUI" Version="2.0.0-preview6" />
<PackageReference Include="FluentAvaloniaUI" Version="2.0.0-preview7" />
<PackageReference Include="Flurl.Http" Version="3.2.4" />
<PackageReference Include="Live.Avalonia" Version="1.3.1" />
<PackageReference Include="Markdown.Avalonia.Tight" Version="11.0.0-b1" />

View File

@ -26,7 +26,7 @@
<ComboBox Classes="brush condensed"
Width="200"
VerticalAlignment="Center"
Items="{CompiledBinding Descriptors}"
ItemsSource="{CompiledBinding Descriptors}"
SelectedItem="{CompiledBinding SelectedDescriptor}"
PlaceholderText="Please select a brush">
<ComboBox.ItemTemplate>

View File

@ -18,33 +18,24 @@ public static class ProfileElementExtensions
public static async Task CopyToClipboard(this Folder folder)
{
if (Application.Current?.Clipboard == null)
return;
DataObject dataObject = new();
string copy = CoreJson.SerializeObject(new FolderClipboardModel(folder), true);
dataObject.Set(ClipboardDataFormat, copy);
await Application.Current.Clipboard.SetDataObjectAsync(dataObject);
await Shared.UI.Clipboard.SetDataObjectAsync(dataObject);
}
public static async Task CopyToClipboard(this Layer layer)
{
if (Application.Current?.Clipboard == null)
return;
DataObject dataObject = new();
string copy = CoreJson.SerializeObject(layer.LayerEntity, true);
dataObject.Set(ClipboardDataFormat, copy);
await Application.Current.Clipboard.SetDataObjectAsync(dataObject);
await Shared.UI.Clipboard.SetDataObjectAsync(dataObject);
}
public static async Task<RenderProfileElement?> PasteChildFromClipboard(this Folder parent)
{
if (Application.Current?.Clipboard == null)
return null;
byte[]? bytes = (byte[]?) await Application.Current.Clipboard.GetDataAsync(ClipboardDataFormat);
byte[]? bytes = (byte[]?) await Shared.UI.Clipboard.GetDataAsync(ClipboardDataFormat);
if (bytes == null!)
return null;

View File

@ -25,6 +25,7 @@ public partial class MainWindow : ReactiveAppWindow<RootViewModel>
InitializeComponent();
ApplyWindowSize();
Shared.UI.Clipboard = GetTopLevel(this)!.Clipboard!;
RootPanel.LayoutUpdated += OnLayoutUpdated;
#if DEBUG

View File

@ -25,7 +25,7 @@
</Window.Styles>
<Grid ColumnDefinitions="240,*">
<ListBox Items="{CompiledBinding Items}" SelectedItem="{CompiledBinding SelectedItem}" Grid.Column="0" Margin="10">
<ListBox ItemsSource="{CompiledBinding Items}" SelectedItem="{CompiledBinding SelectedItem}" Grid.Column="0" Margin="10">
<ListBox.ItemTemplate>
<DataTemplate x:DataType="shared:ViewModelBase">
<TextBlock Text="{CompiledBinding DisplayName}" VerticalAlignment="Center" />

View File

@ -21,7 +21,7 @@
</TextBlock>
</StackPanel>
<TreeView Grid.Row="1" Items="{Binding MainDataModel.Children}">
<TreeView Grid.Row="1" ItemsSource="{Binding MainDataModel.Children}">
<TreeView.Styles>
<Style Selector="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />

View File

@ -12,7 +12,7 @@
<TextBlock Grid.Column="1" VerticalAlignment="Center" Classes="h5" Text="{Binding Plugin.Info.Name}" />
</Grid>
<ItemsControl Items="{Binding Profilers}" />
<ItemsControl ItemsSource="{Binding Profilers}" />
</StackPanel>
</Border>
</UserControl>

View File

@ -8,7 +8,7 @@
<StackPanel>
<TextBlock Classes="subtitle" Text="{Binding Profiler.Name}" Margin="10 10 0 0" />
<DataGrid Items="{Binding Measurements}"
<DataGrid ItemsSource="{Binding Measurements}"
CanUserSortColumns="True"
IsReadOnly="True"
AutoGenerateColumns="False"

View File

@ -34,7 +34,7 @@
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto">
<ItemsControl Items="{Binding Items}" Margin="0 0 10 0" />
<ItemsControl ItemsSource="{Binding Items}" Margin="0 0 10 0" />
</ScrollViewer>
</Grid>

View File

@ -26,7 +26,7 @@ public class PerformanceDebugViewModel : ActivatableViewModelBase
{
_coreService = coreService;
_pluginManagementService = pluginManagementService;
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Normal, (_, _) => Update());
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Background, (_, _) => Update());
DisplayName = "Performance";

View File

@ -54,9 +54,9 @@
<Border Grid.Column="2" Classes="card-condensed" CornerRadius="10 0 0 0" Margin="0 10 0 0" Background="#ff323232">
<Panel>
<TabControl Items="{CompiledBinding Tabs}" IsVisible="{CompiledBinding Tabs.Count}" Padding="12">
<TabControl ItemsSource="{CompiledBinding Tabs}" IsVisible="{CompiledBinding Tabs.Count}" Padding="12">
<TabControl.ItemTemplate>
<DataTemplate>
<DataTemplate x:DataType="shared:ActivatableViewModelBase">
<TextBlock Text="{CompiledBinding DisplayName}" />
</DataTemplate>
</TabControl.ItemTemplate>

View File

@ -3,29 +3,31 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:device="clr-namespace:Artemis.UI.Screens.Device"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Device.DeviceInfoTabView">
x:Class="Artemis.UI.Screens.Device.DeviceInfoTabView"
x:DataType="device:DeviceInfoTabViewModel">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<Grid RowDefinitions="Auto,*" ColumnDefinitions="*,*" Margin="-5">
<!-- First row -->
<Border Classes="card" Grid.Column="0" Grid.Row="0" Margin="5">
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Top">
<TextBlock FontWeight="Bold">Device name</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{Binding Device.RgbDevice.DeviceInfo.DeviceName}" />
<TextBlock TextWrapping="Wrap" Text="{CompiledBinding Device.RgbDevice.DeviceInfo.DeviceName}" />
<Border Classes="card-separator" />
<TextBlock FontWeight="Bold">Manufacturer</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{Binding Device.RgbDevice.DeviceInfo.Manufacturer}" />
<TextBlock TextWrapping="Wrap" Text="{CompiledBinding Device.RgbDevice.DeviceInfo.Manufacturer}" />
<Border Classes="card-separator" />
<TextBlock FontWeight="Bold">Device type</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{Binding Device.DeviceType}" />
<Border Classes="card-separator" IsVisible="{Binding IsKeyboard}" />
<TextBlock TextWrapping="Wrap" Text="{CompiledBinding Device.DeviceType}" />
<Border Classes="card-separator" IsVisible="{CompiledBinding IsKeyboard}" />
<StackPanel IsVisible="{Binding IsKeyboard}">
<StackPanel IsVisible="{CompiledBinding IsKeyboard}">
<TextBlock FontWeight="Bold">Physical layout</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{Binding Device.PhysicalLayout}" />
<TextBlock TextWrapping="Wrap" Text="{CompiledBinding Device.PhysicalLayout}" />
</StackPanel>
</StackPanel>
</Border>
@ -33,20 +35,20 @@
<Border Classes="card" Grid.Row="0" Grid.Column="1" Margin="5">
<StackPanel VerticalAlignment="Top">
<TextBlock FontWeight="Bold">Size (1px = 1mm)</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{Binding Device.RgbDevice.Size}" />
<TextBlock TextWrapping="Wrap" Text="{CompiledBinding Device.RgbDevice.Size}" />
<Border Classes="card-separator" />
<TextBlock FontWeight="Bold">Location (1px = 1mm)</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{Binding Device.RgbDevice.Location}" />
<TextBlock TextWrapping="Wrap" Text="{CompiledBinding Device.RgbDevice.Location}" />
<Border Classes="card-separator" />
<TextBlock FontWeight="Bold">Rotation (degrees)</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{Binding Device.RgbDevice.Rotation.Degrees}" />
<Border Classes="card-separator" IsVisible="{Binding IsKeyboard}" />
<TextBlock TextWrapping="Wrap" Text="{CompiledBinding Device.RgbDevice.Rotation.Degrees}" />
<Border Classes="card-separator" IsVisible="{CompiledBinding IsKeyboard}" />
<StackPanel IsVisible="{Binding IsKeyboard}">
<StackPanel IsVisible="{CompiledBinding IsKeyboard}">
<TextBlock FontWeight="Bold">Logical layout</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{Binding Device.LogicalLayout}" />
<TextBlock TextWrapping="Wrap" Text="{CompiledBinding Device.LogicalLayout}" />
</StackPanel>
</StackPanel>
</Border>
@ -59,14 +61,13 @@
<Button Grid.Column="1"
Classes="icon-button"
ToolTip.Tip="Copy path to clipboard"
Command="{Binding CopyToClipboard}"
CommandParameter="{Binding DefaultLayoutPath}">
Click="LayoutPathButton_OnClick">
<avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
</Button>
</Grid>
<TextBlock
TextWrapping="Wrap"
Text="{Binding DefaultLayoutPath}" />
Text="{CompiledBinding DefaultLayoutPath}" />
<Border Classes="card-separator" />
<Grid ColumnDefinitions="*,Auto">
@ -74,12 +75,11 @@
<Button Grid.Column="1"
Classes="icon-button"
ToolTip.Tip="Copy path to clipboard"
Command="{Binding CopyToClipboard}"
CommandParameter="{Binding Device.Layout.Image.LocalPath}">
Click="ImagePathButton_OnClick">
<avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
</Button>
</Grid>
<TextBlock TextWrapping="Wrap" Text="{Binding Device.Layout.Image.LocalPath}" />
<TextBlock TextWrapping="Wrap" Text="{CompiledBinding Device.Layout.Image.LocalPath}" />
</StackPanel>
</Border>
</Grid>

View File

@ -1,3 +1,5 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
@ -10,4 +12,13 @@ public partial class DeviceInfoTabView : ReactiveUserControl<DeviceInfoTabViewMo
InitializeComponent();
}
private void LayoutPathButton_OnClick(object? sender, RoutedEventArgs e)
{
TopLevel.GetTopLevel(this).Clipboard.SetTextAsync(ViewModel.DefaultLayoutPath);
}
private void ImagePathButton_OnClick(object? sender, RoutedEventArgs e)
{
TopLevel.GetTopLevel(this).Clipboard.SetTextAsync(ViewModel.Device.Layout.Image.LocalPath);
}
}

View File

@ -3,6 +3,7 @@ using Artemis.Core;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Services;
using Avalonia;
using Avalonia.Controls;
using RGB.NET.Core;
namespace Artemis.UI.Screens.Device;
@ -25,13 +26,4 @@ public class DeviceInfoTabViewModel : ActivatableViewModelBase
public ArtemisDevice Device { get; }
public string DefaultLayoutPath { get; }
public async Task CopyToClipboard(string content)
{
if (Application.Current?.Clipboard == null)
return;
await Application.Current.Clipboard.SetTextAsync(content);
_notificationService.CreateNotification().WithMessage("Copied path to clipboard.").Show();
}
}

View File

@ -13,7 +13,7 @@
<converters:LedIdToStringConverter x:Key="LedIdToStringConverter" />
<shared:ToStringConverter x:Key="ToStringConverter" />
</UserControl.Resources>
<DataGrid Items="{CompiledBinding LedViewModels}" CanUserSortColumns="True" AutoGenerateColumns="False">
<DataGrid ItemsSource="{CompiledBinding LedViewModels}" CanUserSortColumns="True" AutoGenerateColumns="False">
<DataGrid.Columns >
<DataGridTemplateColumn CanUserSort="False" CanUserReorder="False" Header="Highlight">
<DataGridTemplateColumn.CellTemplate>

View File

@ -16,7 +16,7 @@
</TextBlock>
<AutoCompleteBox HorizontalAlignment="Stretch"
Items="{CompiledBinding Regions}"
ItemsSource="{CompiledBinding Regions}"
SelectedItem="{CompiledBinding SelectedRegion}"
ValueMemberBinding="{Binding EnglishName}"
Watermark="Enter keyboard country name"

View File

@ -42,7 +42,7 @@
</StackPanel>
<DataGrid Grid.Row="2"
Items="{CompiledBinding InputMappings}"
ItemsSource="{CompiledBinding InputMappings}"
CanUserSortColumns="True"
IsReadOnly="True"
AutoGenerateColumns="False"

View File

@ -31,7 +31,7 @@
<ListBox Grid.Row="0"
Grid.Column="0"
Items="{CompiledBinding Prerequisites}"
ItemsSource="{CompiledBinding Prerequisites}"
SelectedItem="{CompiledBinding ActivePrerequisite, Mode=OneWay}"
IsHitTestVisible="False">
<ListBox.ItemTemplate>

View File

@ -31,7 +31,7 @@
<ListBox Grid.Row="0"
Grid.Column="0"
Items="{CompiledBinding Prerequisites}"
ItemsSource="{CompiledBinding Prerequisites}"
SelectedItem="{CompiledBinding ActivePrerequisite, Mode=OneWay}"
IsHitTestVisible="False">
<ListBox.ItemTemplate>

View File

@ -13,7 +13,7 @@
<Border Grid.Column="1" BorderBrush="{DynamicResource ButtonBorderBrush}" BorderThickness="1 0 0 0" Margin="10 0 0 0" Padding="10 0 0 0">
<Grid RowDefinitions="Auto,*">
<TextBlock Classes="h5">Plugin features</TextBlock>
<ListBox Grid.Row="1" MaxHeight="135" Items="{CompiledBinding PluginFeatures}" />
<ListBox Grid.Row="1" MaxHeight="135" ItemsSource="{CompiledBinding PluginFeatures}" />
</Grid>
</Border>
</Grid>

View File

@ -22,7 +22,7 @@
<TextBlock Grid.Column="1" Grid.Row="0" Classes="h5 no-margin" Text="{CompiledBinding Plugin.Info.Name}" />
<ItemsControl Grid.Column="2" Grid.Row="0" IsVisible="{CompiledBinding Platforms.Count}" Items="{CompiledBinding Platforms}" HorizontalAlignment="Right">
<ItemsControl Grid.Column="2" Grid.Row="0" IsVisible="{CompiledBinding Platforms.Count}" ItemsSource="{CompiledBinding Platforms}" HorizontalAlignment="Right">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Spacing="5" Orientation="Horizontal" />

View File

@ -24,7 +24,7 @@
Grid.Row="1"
Classes="condition-type"
PlaceholderText="Select an activation type"
Items="{CompiledBinding ConditionTypeViewModels}"
ItemsSource="{CompiledBinding ConditionTypeViewModels}"
IsEnabled="{CompiledBinding ProfileElement, Converter={x:Static ObjectConverters.IsNotNull}}"
SelectedItem="{CompiledBinding SelectedConditionTypeViewModel}"
HorizontalAlignment="Stretch">

View File

@ -55,11 +55,11 @@ public class PlaybackViewModel : ActivatableViewModelBase
_keyBindingsEnabled = Shared.UI.KeyBindingsEnabled.ToProperty(this, vm => vm.KeyBindingsEnabled).DisposeWith(d);
_lastUpdate = DateTime.MinValue;
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(60.0 / 1000), DispatcherPriority.Render, Update);
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(60.0 / 1000), DispatcherPriority.Background, Update);
updateTimer.Start();
Disposable.Create(() =>
{
updateTimer.Stop();
// updateTimer.Stop();
_settingsService.GetSetting("ProfileEditor.RepeatTimeline", true).Value = _repeating && _repeatTimeline;
_settingsService.GetSetting("ProfileEditor.RepeatSegment", false).Value = _repeating && _repeatSegment;
}).DisposeWith(d);

View File

@ -37,7 +37,7 @@
<Border Grid.Row="1" Classes="card" Margin="0 15">
<Panel>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" IsVisible="{CompiledBinding AdaptionHints.Count}">
<ItemsControl Items="{CompiledBinding AdaptionHints}" Classes="adaption-hints">
<ItemsControl ItemsSource="{CompiledBinding AdaptionHints}" Classes="adaption-hints">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Spacing="10" />

View File

@ -91,7 +91,7 @@
</UserControl.Styles>
<Grid RowDefinitions="*,Auto">
<TreeView Name="Profile" Classes="no-right-margin draggable"
Items="{CompiledBinding Children}"
ItemsSource="{CompiledBinding Children}"
SelectedItem="{CompiledBinding SelectedChild}"
SelectionChanged="ProfileTreeView_OnSelectionChanged">
<TreeView.Styles>

View File

@ -256,15 +256,9 @@ public abstract class TreeItemViewModel : ActivatableViewModelBase
private async void UpdateCanPaste(bool isFlyoutOpen)
{
if (Application.Current?.Clipboard == null)
{
CanPaste = false;
return;
}
string[] formats = await Application.Current.Clipboard.GetFormatsAsync();
string[] formats = await Shared.UI.Clipboard.GetFormatsAsync();
//diogotr7: This can be null on Linux sometimes. I'm not sure why.
if (formats == null)
if (formats == null!)
{
CanPaste = false;
return;

View File

@ -14,7 +14,7 @@
<TextBox Name="SearchBox" Text="{CompiledBinding SearchText}" Margin="0 0 0 15" Watermark="Search" />
<ListBox Name="EffectDescriptorsList"
Grid.Row="1"
Items="{CompiledBinding LayerEffectDescriptors}"
ItemsSource="{CompiledBinding LayerEffectDescriptors}"
IsVisible="{CompiledBinding LayerEffectDescriptors.Count}"
Height="300">

View File

@ -28,7 +28,7 @@
Name="TreeScrollViewer"
Offset="{CompiledBinding #TimelineScrollViewer.Offset, Mode=OneWay}">
<Grid RowDefinitions="*,Auto">
<ItemsControl Items="{CompiledBinding PropertyGroupViewModels}" Padding="0 0 8 0">
<ItemsControl ItemsSource="{CompiledBinding PropertyGroupViewModels}" Padding="0 0 8 0">
<ItemsControl.ItemTemplate>
<TreeDataTemplate DataType="{x:Type local:PropertyGroupViewModel}" ItemsSource="{CompiledBinding Children}">
<ContentControl Content="{CompiledBinding TreeGroupViewModel}" />

View File

@ -32,7 +32,7 @@
</Ellipse.Transitions>
<Ellipse.ContextFlyout>
<MenuFlyout Opening="FlyoutBase_OnOpening">
<MenuItem Header="Easing" Items="{Binding EasingViewModels}">
<MenuItem Header="Easing" ItemsSource="{Binding EasingViewModels}">
<MenuItem.Styles>
<Style Selector="MenuItem > MenuItem">
<Setter Property="Icon">

View File

@ -150,9 +150,6 @@ public class TimelineKeyframeViewModel<T> : ActivatableViewModelBase, ITimelineK
private async Task ExecuteCopy()
{
if (Application.Current?.Clipboard == null)
return;
List<KeyframeClipboardModel> keyframes = new();
if (!IsSelected)
keyframes.Add(new KeyframeClipboardModel(Keyframe));
@ -162,15 +159,12 @@ public class TimelineKeyframeViewModel<T> : ActivatableViewModelBase, ITimelineK
string copy = CoreJson.SerializeObject(keyframes, true);
DataObject dataObject = new();
dataObject.Set(KeyframeClipboardModel.ClipboardDataFormat, copy);
await Application.Current.Clipboard.SetDataObjectAsync(dataObject);
await Shared.UI.Clipboard.SetDataObjectAsync(dataObject);
}
private async Task ExecutePaste()
{
if (Application.Current?.Clipboard == null)
return;
List<KeyframeClipboardModel>? keyframes = await Application.Current.Clipboard.GetJsonAsync<List<KeyframeClipboardModel>>(KeyframeClipboardModel.ClipboardDataFormat);
List<KeyframeClipboardModel>? keyframes = await Shared.UI.Clipboard.GetJsonAsync<List<KeyframeClipboardModel>>(KeyframeClipboardModel.ClipboardDataFormat);
if (keyframes == null)
return;
@ -201,13 +195,7 @@ public class TimelineKeyframeViewModel<T> : ActivatableViewModelBase, ITimelineK
private async void UpdateCanPaste(bool isFlyoutOpen)
{
if (Application.Current?.Clipboard == null)
{
CanPaste = false;
return;
}
string[] formats = await Application.Current.Clipboard.GetFormatsAsync();
string[] formats = await Shared.UI.Clipboard.GetFormatsAsync();
CanPaste = formats.Contains("Artemis.Keyframes");
}

View File

@ -11,7 +11,7 @@
<ItemsControl Grid.Row="0"
Height="28"
IsVisible="{CompiledBinding !PropertyGroupViewModel.IsExpanded}"
Items="{CompiledBinding KeyframePositions}"
ItemsSource="{CompiledBinding KeyframePositions}"
HorizontalAlignment="Stretch">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@ -39,7 +39,7 @@
<Rectangle Grid.Row="1" HorizontalAlignment="Stretch" Fill="{DynamicResource ButtonBorderBrush}" Height="1" />
<ItemsControl Grid.Row="2"
Items="{CompiledBinding Children}"
ItemsSource="{CompiledBinding Children}"
IsVisible="{CompiledBinding PropertyGroupViewModel.IsExpanded}"
HorizontalAlignment="Stretch">
<ItemsControl.DataTemplates>

View File

@ -5,7 +5,7 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.ProfileEditor.Properties.Timeline.TimelinePropertyView">
<Border Height="29" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource ButtonBorderBrush}">
<ItemsControl Items="{Binding KeyframeViewModels}">
<ItemsControl ItemsSource="{Binding KeyframeViewModels}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />

View File

@ -17,7 +17,7 @@
<KeyBinding Command="{CompiledBinding PasteKeyframes}" Gesture="Ctrl+V" />
<KeyBinding Command="{CompiledBinding DeleteSelectedKeyframes}" Gesture="Delete" />
</Grid.KeyBindings>
<ItemsControl Items="{CompiledBinding PropertyGroupViewModels}">
<ItemsControl ItemsSource="{CompiledBinding PropertyGroupViewModels}">
<ItemsControl.ItemTemplate>
<TreeDataTemplate DataType="{x:Type local:PropertyGroupViewModel}" ItemsSource="{CompiledBinding Children}">
<ContentControl Content="{CompiledBinding TimelineGroupViewModel}" />

View File

@ -169,10 +169,10 @@ public class TimelineViewModel : ActivatableViewModelBase
private async Task ExecutePasteKeyframes()
{
if (_profileElement == null || Application.Current?.Clipboard == null)
if (_profileElement == null)
return;
List<KeyframeClipboardModel>? keyframes = await Application.Current.Clipboard.GetJsonAsync<List<KeyframeClipboardModel>>(KeyframeClipboardModel.ClipboardDataFormat);
List<KeyframeClipboardModel>? keyframes = await Shared.UI.Clipboard.GetJsonAsync<List<KeyframeClipboardModel>>(KeyframeClipboardModel.ClipboardDataFormat);
if (keyframes == null)
return;

View File

@ -14,7 +14,7 @@
<TextBox Name="SearchBox" Text="{CompiledBinding SearchText}" Margin="0 0 0 15" Watermark="Search" />
<ListBox Name="EffectDescriptorsList"
Grid.Row="1"
Items="{CompiledBinding Presets}"
ItemsSource="{CompiledBinding Presets}"
IsVisible="{CompiledBinding Presets.Count}"
Height="300">

View File

@ -171,7 +171,7 @@
Do not bind directly to the PropertyGroupViewModel.Children collection
Instead use a reference provided by the VM that is null when collapsed, virtualization for noobs
-->
<ItemsControl Items="{CompiledBinding Children}"
<ItemsControl ItemsSource="{CompiledBinding Children}"
IsVisible="{CompiledBinding PropertyGroupViewModel.IsExpanded}"
HorizontalAlignment="Stretch">
<ItemsControl.DataTemplates>

View File

@ -38,7 +38,7 @@
</Grid.Transitions>
<!-- The bottom layer consists of devices -->
<ItemsControl Name="DevicesContainer" Items="{CompiledBinding Devices}" ClipToBounds="False">
<ItemsControl Name="DevicesContainer" ItemsSource="{CompiledBinding Devices}" ClipToBounds="False">
<ItemsControl.Styles>
<Style Selector="ContentPresenter">
<Setter Property="Canvas.Left" Value="{Binding X}" />
@ -58,7 +58,7 @@
</ItemsControl>
<!-- The middle layer contains visualizers -->
<ItemsControl Items="{CompiledBinding Visualizers}" ClipToBounds="False" IsVisible="{CompiledBinding !SuspendedEditing}">
<ItemsControl ItemsSource="{CompiledBinding Visualizers}" ClipToBounds="False" IsVisible="{CompiledBinding !SuspendedEditing}">
<ItemsControl.Styles>
<Style Selector="ContentPresenter">
<Setter Property="Canvas.Left" Value="{Binding X}" />
@ -73,7 +73,7 @@
</ItemsControl>
<!-- The top layer contains tools -->
<ItemsControl Items="{CompiledBinding Tools}" ClipToBounds="False" IsVisible="{CompiledBinding !SuspendedEditing}">
<ItemsControl ItemsSource="{CompiledBinding Tools}" ClipToBounds="False" IsVisible="{CompiledBinding !SuspendedEditing}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Grid />

View File

@ -70,7 +70,7 @@
<Border Grid.Row="0" Classes="card" Padding="0" Margin="4 0 4 4" ClipToBounds="True">
<Grid ColumnDefinitions="Auto,*">
<Border Grid.Column="0">
<ItemsControl Items="{CompiledBinding Tools}">
<ItemsControl ItemsSource="{CompiledBinding Tools}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="shared:IToolViewModel">
<ToggleButton Classes="icon-button editor-sidebar-button"
@ -86,9 +86,9 @@
<ContentControl Grid.Column="1" Content="{CompiledBinding VisualEditorViewModel}" />
</Grid>
</Border>
<GridSplitter Grid.Row="1" Classes="editor-grid-splitter-horizontal" />
<Border Grid.Row="2" Classes="card card-condensed" Margin="4" Padding="0" ClipToBounds="True">
<Panel>
<ContentControl Content="{CompiledBinding PropertiesViewModel}" />
@ -109,9 +109,9 @@
</Panel>
</Border>
</Grid>
<GridSplitter Grid.Row="0" Grid.Column="1" Classes="editor-grid-splitter-vertical" />
<Grid Grid.Row="0" Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
@ -124,9 +124,9 @@
<Border Classes="suspended-editing" />
</Panel>
</Border>
<GridSplitter Grid.Row="1" Classes="editor-grid-splitter-horizontal" />
<Border Grid.Row="2" Classes="card card-condensed" Margin="4">
<Panel>
<ContentControl Content="{CompiledBinding DisplayConditionScriptViewModel}" />

View File

@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:dialogs="clr-namespace:Artemis.UI.Screens.Scripting.Dialogs"
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
xmlns:scriptingProviders="clr-namespace:Artemis.Core.ScriptingProviders;assembly=Artemis.Core"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Scripting.Dialogs.ScriptConfigurationCreateView"
x:DataType="dialogs:ScriptConfigurationCreateViewModel">
@ -12,14 +13,14 @@
<TextBlock Classes="label" Margin="0 5">Script name</TextBlock>
<TextBox Watermark="Name" Text="{CompiledBinding ScriptName}" />
<TextBlock Classes="label" Margin="0 5">Script type</TextBlock>
<ComboBox SelectedItem="{CompiledBinding SelectedScriptingProvider}" Items="{CompiledBinding ScriptingProviders}" HorizontalAlignment="Stretch">
<ComboBox SelectedItem="{CompiledBinding SelectedScriptingProvider}" ItemsSource="{CompiledBinding ScriptingProviders}" HorizontalAlignment="Stretch">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
<ComboBox.ItemTemplate>
<DataTemplate>
<DataTemplate x:DataType="scriptingProviders:ScriptingProvider">
<StackPanel Orientation="Horizontal">
<shared:ArtemisIcon Icon="{CompiledBinding Plugin.Info.ResolvedIcon}" Width="16" Height="16" Margin="0 0 5 0" />
<TextBlock Text="{CompiledBinding LanguageName}" />

View File

@ -16,7 +16,7 @@
<DockPanel>
<ScrollViewer DockPanel.Dock="Left" VerticalScrollBarVisibility="Auto" Width="300" Margin="10">
<StackPanel>
<ListBox Items="{CompiledBinding ScriptConfigurations}" SelectedItem="{CompiledBinding SelectedScript}">
<ListBox ItemsSource="{CompiledBinding ScriptConfigurations}" SelectedItem="{CompiledBinding SelectedScript}">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type scripting:ScriptConfigurationViewModel}">
<Grid ColumnDefinitions="Auto,*,Auto,Auto" RowDefinitions="*,*" Margin="4">

View File

@ -7,7 +7,7 @@
x:Class="Artemis.UI.Screens.Settings.SettingsView"
x:DataType="settings:SettingsViewModel">
<Border Classes="router-container">
<TabControl Margin="12" Items="{CompiledBinding SettingTabs}" SelectedItem="{CompiledBinding SelectedTab}">
<TabControl Margin="12" ItemsSource="{CompiledBinding SettingTabs}" SelectedItem="{CompiledBinding SelectedTab}">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding DisplayName}" />

View File

@ -2,8 +2,10 @@
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:settings="clr-namespace:Artemis.UI.Screens.Settings"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Settings.DevicesTabView">
x:Class="Artemis.UI.Screens.Settings.DevicesTabView"
x:DataType="settings:DevicesTabViewModel">
<Grid RowDefinitions="Auto,*">
<StackPanel MaxWidth="1050">
<TextBlock Classes="h4">Device management</TextBlock>
@ -16,7 +18,7 @@
</StackPanel>
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<ItemsControl Items="{Binding Devices}" Margin="-5 0" MaxWidth="1050">
<ItemsControl ItemsSource="{CompiledBinding Devices}" Margin="-5 0" MaxWidth="1050">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />

View File

@ -238,7 +238,7 @@
<ComboBox Classes="brush"
Width="200"
HorizontalAlignment="Left"
Items="{CompiledBinding LayerBrushDescriptors}"
ItemsSource="{CompiledBinding LayerBrushDescriptors}"
SelectedItem="{CompiledBinding SelectedLayerBrushDescriptor}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="{x:Type layerBrushes:LayerBrushDescriptor}">
@ -279,7 +279,7 @@
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<ComboBox Width="150"
SelectedItem="{CompiledBinding CorePreferredGraphicsContext.Value}"
Items="{CompiledBinding GraphicsContexts}" />
ItemsSource="{CompiledBinding GraphicsContexts}" />
</StackPanel>
</Grid>
<Border Classes="card-separator" />
@ -296,9 +296,9 @@
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<ComboBox Width="150"
SelectedItem="{CompiledBinding SelectedRenderScale}"
Items="{CompiledBinding RenderScales}">
ItemsSource="{CompiledBinding RenderScales}">
<ComboBox.ItemTemplate>
<DataTemplate>
<DataTemplate x:DataType="settings:RenderSettingViewModel">
<TextBlock Text="{CompiledBinding Display}" />
</DataTemplate>
</ComboBox.ItemTemplate>
@ -322,9 +322,9 @@
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<ComboBox Width="150"
SelectedItem="{CompiledBinding SelectedTargetFrameRate}"
Items="{CompiledBinding TargetFrameRates}">
ItemsSource="{CompiledBinding TargetFrameRates}">
<ComboBox.ItemTemplate>
<DataTemplate>
<DataTemplate x:DataType="settings:RenderSettingViewModel">
<TextBlock Text="{CompiledBinding Display}" />
</DataTemplate>
</ComboBox.ItemTemplate>

View File

@ -25,7 +25,7 @@
</Grid>
<ScrollViewer Grid.Row="1" Grid.Column="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" VerticalAlignment="Top">
<ItemsRepeater Items="{CompiledBinding Plugins}" MaxWidth="900" VerticalAlignment="Center">
<ItemsRepeater ItemsSource="{CompiledBinding Plugins}" MaxWidth="900" VerticalAlignment="Center">
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="plugins:PluginSettingsViewModel">
<ContentControl Content="{CompiledBinding}" Height="200"/>

View File

@ -36,7 +36,7 @@
<Grid ColumnDefinitions="300,*" Margin="0 10" IsVisible="{CompiledBinding ReleaseViewModels.Count}">
<Border Classes="card-condensed" Grid.Column="0" Margin="0 0 10 0">
<ListBox Items="{CompiledBinding ReleaseViewModels}" SelectedItem="{CompiledBinding SelectedReleaseViewModel}">
<ListBox ItemsSource="{CompiledBinding ReleaseViewModels}" SelectedItem="{CompiledBinding SelectedReleaseViewModel}">
<ListBox.ItemTemplate>
<DataTemplate x:DataType="updating:ReleaseViewModel">
<Panel>

View File

@ -23,7 +23,7 @@ public class ModuleActivationRequirementViewModel : ActivatableViewModelBase
this.WhenActivated(d =>
{
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Normal, Update);
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Background, Update);
_updateTimer.Start();
Disposable.Create(() =>

View File

@ -21,7 +21,7 @@
</StackPanel>
<TextBlock TextWrapping="Wrap">These requirements allow the module creator to decide when the data is available to your profile you cannot override them.</TextBlock>
<ItemsControl Items="{CompiledBinding ActivationRequirements}" />
<ItemsControl ItemsSource="{CompiledBinding ActivationRequirements}" />
</StackPanel>
</Border>
</StackPanel>

View File

@ -46,14 +46,14 @@
<TextBlock Classes="label">Profile name</TextBlock>
<TextBox Watermark="Name" Text="{CompiledBinding ProfileName}" />
<TextBlock Classes="label">Module</TextBlock>
<ComboBox SelectedItem="{CompiledBinding SelectedModule}" IsEnabled="{CompiledBinding Modules.Count}" Items="{CompiledBinding Modules}" HorizontalAlignment="Stretch">
<ComboBox SelectedItem="{CompiledBinding SelectedModule}" IsEnabled="{CompiledBinding Modules.Count}" ItemsSource="{CompiledBinding Modules}" HorizontalAlignment="Stretch">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
<ComboBox.ItemTemplate>
<DataTemplate>
<DataTemplate x:DataType="local:ProfileModuleViewModel">
<StackPanel Orientation="Horizontal">
<shared:ArtemisIcon Icon="{CompiledBinding Icon, FallbackValue='Close'}" Width="16" Height="16" Margin="0 0 5 0" />
<TextBlock Text="{CompiledBinding Name, FallbackValue='None'}" />
@ -104,7 +104,7 @@
<Border Background="{DynamicResource CheckerboardBrush}" CornerRadius="{DynamicResource CardCornerRadius}" Width="78" Height="78">
<avalonia:MaterialIcon Kind="{CompiledBinding SelectedMaterialIcon.Icon}" Width="45" Height="45" />
</Border>
<ComboBox Items="{CompiledBinding MaterialIcons}"
<ComboBox ItemsSource="{CompiledBinding MaterialIcons}"
SelectedItem="{CompiledBinding SelectedMaterialIcon}"
VerticalAlignment="Bottom"
IsTextSearchEnabled="True"

View File

@ -218,7 +218,7 @@
<Panel Grid.Row="1" IsVisible="{CompiledBinding !IsCollapsed}">
<ListBox Name="SidebarListBox"
Classes="sidebar-listbox"
Items="{CompiledBinding ProfileConfigurations}"
ItemsSource="{CompiledBinding ProfileConfigurations}"
SelectedItem="{CompiledBinding SelectedProfileConfiguration}"
MinHeight="35"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"

View File

@ -23,14 +23,14 @@
<ListBox Classes="sidebar-listbox"
Grid.Row="1"
Margin="10 2"
Items="{CompiledBinding SidebarScreens}"
ItemsSource="{CompiledBinding SidebarScreens}"
SelectedItem="{CompiledBinding SelectedSidebarScreen}" />
<Border Grid.Row="2" Margin="8" Height="1" Background="{DynamicResource ButtonBorderBrush}"></Border>
<!-- Categories -->
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto">
<StackPanel>
<ItemsControl Margin="10 2" Items="{CompiledBinding SidebarCategories}" Classes="profile-categories" />
<ItemsControl Margin="10 2" ItemsSource="{CompiledBinding SidebarCategories}" Classes="profile-categories" />
<Button Content="Add new category"
Margin="10"
HorizontalAlignment="Stretch"

View File

@ -18,7 +18,7 @@
</StackPanel>
<ScrollViewer Grid.Row="1" Margin="0 15">
<ItemsControl Items="{CompiledBinding DeviceProviders}" Margin="-4 0 8 0">
<ItemsControl ItemsSource="{CompiledBinding DeviceProviders}" Margin="-4 0 8 0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="2" />

View File

@ -79,7 +79,7 @@
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.2" Easing="CubicEaseOut" />
</Transitions>
</Grid.Transitions>
<ItemsControl Name="DeviceContainer" Items="{CompiledBinding SurfaceDeviceViewModels}" ClipToBounds="False">
<ItemsControl Name="DeviceContainer" ItemsSource="{CompiledBinding SurfaceDeviceViewModels}" ClipToBounds="False">
<ItemsControl.Styles>
<Style Selector="ContentPresenter">
<Setter Property="Canvas.Left" Value="{Binding Device.X}" />
@ -125,7 +125,7 @@
<Border Grid.Column="1" Classes="card-condensed" Margin="15 0 0 0">
<Grid RowDefinitions="*,Auto,Auto" ColumnDefinitions="*,*">
<ListBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Items="{CompiledBinding ListDeviceViewModels}">
<ListBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{CompiledBinding ListDeviceViewModels}">
<ListBox.ItemTemplate>
<DataTemplate>
<ContentControl Content="{Binding}" ContextFlyout="{StaticResource DeviceMenuFlyout}"></ContentControl>

View File

@ -36,7 +36,7 @@
<TextBox Name="SearchBox" Text="{CompiledBinding SearchText}" Margin="0 0 0 15" Watermark="Search"></TextBox>
<TreeView Name="NodeTree"
Grid.Row="1"
Items="{CompiledBinding Categories}"
ItemsSource="{CompiledBinding Categories}"
IsVisible="{CompiledBinding Categories.Count}"
SelectedItem="{CompiledBinding SelectedNode}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">

View File

@ -62,7 +62,7 @@
<ContentControl Content="{CompiledBinding DragViewModel}" ClipToBounds="False" />
<!-- Cables -->
<ItemsControl Items="{CompiledBinding CableViewModels}" ClipToBounds="False">
<ItemsControl ItemsSource="{CompiledBinding CableViewModels}" ClipToBounds="False">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
@ -71,7 +71,7 @@
</ItemsControl>
<!-- Nodes -->
<ItemsControl Name="NodesContainer" Items="{CompiledBinding NodeViewModels}" ClipToBounds="False">
<ItemsControl Name="NodesContainer" ItemsSource="{CompiledBinding NodeViewModels}" ClipToBounds="False">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />

View File

@ -293,22 +293,16 @@ public class NodeScriptViewModel : ActivatableViewModelBase
private async Task ExecuteCopySelected()
{
if (Application.Current?.Clipboard == null)
return;
List<INode> nodes = NodeViewModels.Where(vm => vm.IsSelected).Select(vm => vm.Node).Where(n => !n.IsDefaultNode && !n.IsExitNode).ToList();
DataObject dataObject = new();
string copy = CoreJson.SerializeObject(new NodesClipboardModel(NodeScript, nodes), true);
dataObject.Set(CLIPBOARD_DATA_FORMAT, copy);
await Application.Current.Clipboard.SetDataObjectAsync(dataObject);
await Shared.UI.Clipboard.SetDataObjectAsync(dataObject);
}
private async Task ExecutePasteSelected()
{
if (Application.Current?.Clipboard == null)
return;
byte[]? bytes = (byte[]?) await Application.Current.Clipboard.GetDataAsync(CLIPBOARD_DATA_FORMAT);
byte[]? bytes = (byte[]?) await Shared.UI.Clipboard.GetDataAsync(CLIPBOARD_DATA_FORMAT);
if (bytes == null!)
return;

View File

@ -23,7 +23,7 @@
<Grid Margin="15" ColumnDefinitions="*,*" RowDefinitions="Auto,Auto,*">
<Menu Grid.Row="0" Grid.ColumnSpan="2" VerticalAlignment="Top" Margin="-10 -10 -10 0">
<MenuItem Header="_File">
<MenuItem Header="Add Node" Items="{CompiledBinding Categories}">
<MenuItem Header="Add Node" ItemsSource="{CompiledBinding Categories}">
<MenuItem.Icon>
<avalonia:MaterialIcon Kind="Plus" />
</MenuItem.Icon>
@ -31,7 +31,7 @@
<Style Selector="MenuItem > MenuItem > MenuItem">
<Setter Property="Command" Value="{Binding CreateNode}" />
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="Items" Value="{Binding Items}" />
<Setter Property="ItemsSource" Value="{Binding Items}" />
</Style>
</MenuItem.Styles>
</MenuItem>

View File

@ -67,9 +67,9 @@ public class NodeScriptWindowViewModel : NodeScriptWindowViewModelBase
{
_keyBindingsEnabled = Shared.UI.KeyBindingsEnabled.ToProperty(this, vm => vm.KeyBindingsEnabled).DisposeWith(d);
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Normal, Update);
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Background, Update);
// TODO: Remove in favor of saving each time a node editor command is executed
DispatcherTimer saveTimer = new(TimeSpan.FromMinutes(2), DispatcherPriority.Normal, Save);
DispatcherTimer saveTimer = new(TimeSpan.FromMinutes(2), DispatcherPriority.Background, Save);
updateTimer.Start();
saveTimer.Start();

View File

@ -75,8 +75,8 @@
IsVisible="{CompiledBinding DisplayCustomViewModelAbove}" />
<StackPanel Grid.Row="1" Grid.Column="0" IsVisible="{CompiledBinding HasInputPins}">
<ItemsControl Items="{CompiledBinding InputPinViewModels}" Margin="4 0" />
<ItemsControl Items="{CompiledBinding InputPinCollectionViewModels}" />
<ItemsControl ItemsSource="{CompiledBinding InputPinViewModels}" Margin="4 0" />
<ItemsControl ItemsSource="{CompiledBinding InputPinCollectionViewModels}" />
</StackPanel>
<ContentControl Grid.Row="1"
@ -86,8 +86,8 @@
IsVisible="{CompiledBinding DisplayCustomViewModelBetween}" />
<StackPanel Grid.Row="1" Grid.Column="2" IsVisible="{CompiledBinding HasOutputPins}">
<ItemsControl Items="{CompiledBinding OutputPinViewModels}" Margin="4 0" />
<ItemsControl Items="{CompiledBinding OutputPinCollectionViewModels}" />
<ItemsControl ItemsSource="{CompiledBinding OutputPinViewModels}" Margin="4 0" />
<ItemsControl ItemsSource="{CompiledBinding OutputPinCollectionViewModels}" />
</StackPanel>
<ContentControl Grid.Row="2"

View File

@ -13,7 +13,7 @@
Command="{CompiledBinding AddPin}">
<avalonia:MaterialIcon Kind="Add"></avalonia:MaterialIcon>
</Button>
<ItemsControl Items="{CompiledBinding PinViewModels}" Margin="4 0">
<ItemsControl ItemsSource="{CompiledBinding PinViewModels}" Margin="4 0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="pins:PinViewModel">
<StackPanel Orientation="Horizontal">

View File

@ -14,7 +14,7 @@
Command="{CompiledBinding AddPin}">
<avalonia:MaterialIcon Kind="Add"></avalonia:MaterialIcon>
</Button>
<ItemsControl Items="{CompiledBinding PinViewModels}" Margin="4 0" HorizontalAlignment="Right">
<ItemsControl ItemsSource="{CompiledBinding PinViewModels}" Margin="4 0" HorizontalAlignment="Right">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="pins:PinViewModel">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">

View File

@ -8,9 +8,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0-preview7" />
<PackageReference Include="DryIoc.dll" Version="5.3.4" />
<PackageReference Include="NoStringEvaluating" Version="2.5.2" />
<PackageReference Include="ReactiveUI" Version="18.4.26" />

View File

@ -8,8 +8,8 @@
x:DataType="screens:LayerPropertyNodeCustomViewModel">
<Grid>
<StackPanel Spacing="5" VerticalAlignment="Top" IsVisible="{CompiledBinding !OutsideProfileContext}">
<ComboBox Classes="condensed" Items="{CompiledBinding ProfileElements}" SelectedItem="{CompiledBinding SelectedProfileElement}" />
<ComboBox Classes="condensed" Items="{CompiledBinding LayerProperties}" SelectedItem="{CompiledBinding SelectedLayerProperty}" />
<ComboBox Classes="condensed" ItemsSource="{CompiledBinding ProfileElements}" SelectedItem="{CompiledBinding SelectedProfileElement}" />
<ComboBox Classes="condensed" ItemsSource="{CompiledBinding LayerProperties}" SelectedItem="{CompiledBinding SelectedLayerProperty}" />
</StackPanel>
<StackPanel IsVisible="{CompiledBinding OutsideProfileContext}" VerticalAlignment="Center">
<TextBlock Classes="BodyStrongTextBlockStyle" TextAlignment="Center">

View File

@ -11,7 +11,7 @@
x:DataType="screens:PressedKeyPositionNodeCustomViewModel">
<StackPanel>
<TextBlock FontSize="13" Margin="0 -2 0 5">Layer</TextBlock>
<ComboBox Classes="condensed" Items="{CompiledBinding Layers}" SelectedItem="{CompiledBinding SelectedLayer}" PlaceholderText="Select a layer">
<ComboBox Classes="condensed" ItemsSource="{CompiledBinding Layers}" SelectedItem="{CompiledBinding SelectedLayer}" PlaceholderText="Select a layer">
<ComboBox.ItemTemplate>
<DataTemplate DataType="core:Layer">
<StackPanel Spacing="5" Orientation="Horizontal">

View File

@ -5,7 +5,7 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.VisualScripting.Nodes.Operators.Screens.EnumEqualsNodeCustomView">
<ComboBox IsEnabled="{Binding EnumValues.Count}"
Items="{Binding EnumValues}"
ItemsSource="{Binding EnumValues}"
SelectedItem="{Binding CurrentValue}"
PlaceholderText="Select a value"
Classes="condensed"

View File

@ -18,7 +18,7 @@ public class DisplayValueNodeCustomViewModel : CustomNodeViewModel
// Because the DisplayValueNode has no output it never evaluates, manually do so here
this.WhenActivated(d =>
{
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Normal, Update);
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Background, Update);
updateTimer.Start();
Disposable.Create(() => updateTimer.Stop()).DisposeWith(d);
});

View File

@ -6,5 +6,5 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.VisualScripting.Nodes.Transition.Screens.EasingFunctionNodeCustomView"
x:DataType="screens:EasingFunctionNodeCustomViewModel">
<ComboBox Classes="condensed" MinWidth="75" Items="{CompiledBinding EasingViewModels}" SelectedItem="{CompiledBinding SelectedEasingViewModel}" />
<ComboBox Classes="condensed" MinWidth="75" ItemsSource="{CompiledBinding EasingViewModels}" SelectedItem="{CompiledBinding SelectedEasingViewModel}" />
</UserControl>