Make it robust.
MODIFY
WalletWasabi.Gui/Converters/NetworkColorConverter.cs
WalletWasabi.Gui/Converters/NetworkColorConverter.cs
using Avalonia;
+using Avalonia.Controls;
using Avalonia.Data.Converters;
using Avalonia.Media;
using NBitcoin;
@@ -6,18 +7,22 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
+using System.Text.RegularExpressions;
using WalletWasabi.Exceptions;
namespace WalletWasabi.Gui.Converters
{
public class NetworkColorConverter : IValueConverter
{
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
- value switch
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- Network network => Application.Current.Resources[network.Name],
- _ => Application.Current.Resources[Network.Main.Name]
- };
+ if (Application.Current.TryFindResource(value.ToString(), out var color))
+ {
+ return color;
+ }
+
+ return "#007ACC";
+ }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
throw new NotSupportedException();

Make it robust.