UI - Update Avalonia to preview7

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

No files matched your search

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