Only show spectrum control when it is doing something
MODIFY
WalletWasabi.Fluent/Controls/Spectrum/SpectrumControl.cs
WalletWasabi.Fluent/Controls/Spectrum/SpectrumControl.cs
@@ -25,6 +25,9 @@ public class SpectrumControl : TemplatedControl, ICustomDrawOperation
private float[] _data;
private const int NumBins = 250;
+ private bool _isAuraActive;
+ private bool _isSplashActive;
+
public static readonly StyledProperty<bool> IsActiveProperty =
AvaloniaProperty.Register<SpectrumControl, bool>(nameof(IsActive));
@@ -33,10 +36,14 @@ public class SpectrumControl : TemplatedControl, ICustomDrawOperation
public SpectrumControl()
{
+ CheckVisibility();
_data = new float[NumBins];
_auraSpectrumDataSource = new AuraSpectrumDataSource(NumBins);
_splashEffectDataSource = new SplashEffectDataSource(NumBins);
+ _auraSpectrumDataSource.GeneratingDataStateChanged += OnAuraGeneratingDataStateChanged;
+ _splashEffectDataSource.GeneratingDataStateChanged += OnSplashGeneratingDataStateChanged;
+
_sources = new SpectrumDataSource[] { _auraSpectrumDataSource, _splashEffectDataSource };
Background = new RadialGradientBrush()
@@ -49,6 +56,23 @@ public class SpectrumControl : TemplatedControl, ICustomDrawOperation
};
}
+ private void OnSplashGeneratingDataStateChanged(object? sender, bool e)
+ {
+ _isSplashActive = e;
+ CheckVisibility();
+ }
+
+ private void OnAuraGeneratingDataStateChanged(object? sender, bool e)
+ {
+ _isAuraActive = e;
+ CheckVisibility();
+ }
+
+ private void CheckVisibility()
+ {
+ IsVisible = _isSplashActive || _isAuraActive;
+ }
+
private void OnIsActiveChanged()
{
_auraSpectrumDataSource.IsActive = IsActive;

Only show spectrum control when it is doing something