Files
@ 4778889395e8
Branch filter:
Location: ATITD-Tools/Desert-Paint-Codex/Views/ClipArrowsView.axaml.cs - annotation
4778889395e8
2.1 KiB
text/x-csharp
Change the displayed permeutation count to display using locale-specific number formatting (with comma / dot separators). Fix a crash when starting a new round of recipe generation after recipe generation completed during a previous run.
40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 | using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Shapes;
using Avalonia.Markup.Xaml;
using DesertPaintCodex.Models;
namespace DesertPaintCodex.Views
{
public class ClipArrowsView : UserControl
{
public static readonly DirectProperty<ClipArrowsView, ClipType> FlagsProperty = AvaloniaProperty.RegisterDirect<ClipArrowsView, ClipType>( nameof(Flags),
o => o.Flags,
(o, v) => o.Flags = v);
private ClipType _flags;
public ClipType Flags { get => _flags; set => SetAndRaise(FlagsProperty, ref _flags, value); }
private readonly Path _redArrow;
private readonly Path _greenArrow;
private readonly Path _blueArrow;
public ClipArrowsView()
{
InitializeComponent();
_redArrow = this.FindControl<Path>("RedArrow");
_greenArrow = this.FindControl<Path>("GreenArrow");
_blueArrow = this.FindControl<Path>("BlueArrow");
FlagsProperty.Changed.AddClassHandler<ClipArrowsView>((x, _) => x.UpdateFlags());
UpdateFlags();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void UpdateFlags()
{
UpdateArrow(_redArrow, ClipType.RedHigh, ClipType.RedLow);
UpdateArrow(_greenArrow, ClipType.GreenHigh, ClipType.GreenLow);
UpdateArrow(_blueArrow, ClipType.BlueHigh, ClipType.BlueLow);
}
private void UpdateArrow(IControl arrow, ClipType highFlag, ClipType lowFlag)
{
if (_flags.HasFlag(highFlag))
{
arrow.Classes.Remove("DownArrow");
arrow.Classes.Add("UpArrow");
arrow.IsVisible = true;
}
else if (_flags.HasFlag(lowFlag))
{
arrow.Classes.Remove("UpArrow");
arrow.Classes.Add("DownArrow");
arrow.IsVisible = true;
}
else
{
arrow.IsVisible = false;
}
}
}
}
|