fix persistence
MODIFY
WalletWasabi.Gui/Controls/SortingArrow.cs
WalletWasabi.Gui/Controls/SortingArrow.cs
@@ -20,16 +20,14 @@ namespace WalletWasabi.Gui.Controls
{
public struct SortingPreference : IEquatable<SortingPreference>
{
- public static SortingPreference DefaultValue = new SortingPreference(SortOrder.None, null);
-
- public SortingPreference(SortOrder sortOrder, Enum propertyTarget)
+ public SortingPreference(SortOrder sortOrder, int propertyTarget)
{
SortOrder = sortOrder;
PropertyTarget = propertyTarget;
}
public SortOrder SortOrder { get; set; }
- public Enum PropertyTarget { get; set; }
+ public int PropertyTarget { get; set; }
public bool Equals([AllowNull] SortingPreference other) => SortOrder == other.SortOrder && PropertyTarget == other.PropertyTarget;
}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -183,7 +183,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private void SortColumn(SortOrder x, CoinListViewSortTarget privacy)
{
- Global.UiConfig.CoinListViewSortingPreference = new SortingPreference(x, privacy);
+ Global.UiConfig.CoinListViewSortingPreference = new SortingPreference(x, (int)privacy);
SetSortOrder(Global.UiConfig.CoinListViewSortingPreference);
}

ADD
WalletWasabi.Gui/Converters/SortingPreferenceJsonConverter.cs
+using Newtonsoft.Json;
+using System;
+using WalletWasabi.Gui.Controls;
+
+namespace WalletWasabi.Gui.Converters
+{
+ public class SortingPreferenceJsonConverter : JsonConverter
+ {
+ public override bool CanConvert(Type objectType)
+ {
+ return objectType == typeof(SortingPreference);
+ }
+
+ public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ {
+ try
+ {
+ return serializer.Deserialize(reader, typeof(SortingPreference));
+ }
+ catch
+ {
+ return existingValue;
+ }
+ }
+
+ public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+ {
+ serializer.Serialize(writer, value);
+ }
+ }
+}

MODIFY
WalletWasabi.Gui/UiConfig.cs
WalletWasabi.Gui/UiConfig.cs
@@ -101,6 +101,7 @@ namespace WalletWasabi.Gui
}
[JsonProperty(PropertyName = "CoinListViewSortingPreference")]
- public SortingPreference CoinListViewSortingPreference { get; internal set; } = new SortingPreference(SortOrder.Increasing, default(SortOrder));
+ [JsonConverter(typeof(SortingPreferenceJsonConverter))]
+ public SortingPreference CoinListViewSortingPreference { get; internal set; } = new SortingPreference(SortOrder.Increasing, 0);
}
}

fix persistence