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

@@ -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" />
@@ -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();
}
@@ -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();
@@ -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)
@@ -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;
}
@@ -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;
}
}
@@ -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)
@@ -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}" />
@@ -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>
+6
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>