Code style fix.
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -28,6 +28,7 @@ using WalletWasabi.KeyManagement;
using WalletWasabi.Models;
using WalletWasabi.Models.TransactionBuilding;
using WalletWasabi.Services;
+
using WalletWasabi.Models;
namespace WalletWasabi.Gui.Controls.WalletExplorer
@@ -1053,7 +1054,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
return ErrorDescriptors.Empty;
}
- return new ErrorDescriptors(new ErrorDescriptor(ErrorSeverity.Warning, "Invalid address."));
+ return new ErrorDescriptors(new ErrorDescriptor(ErrorSeverity.Error, "Invalid address."));
}
[ValidateMethod(nameof(ValidateAddress))]

MODIFY
WalletWasabi.Gui/ViewModels/Validation/Validator.cs
WalletWasabi.Gui/ViewModels/Validation/Validator.cs
@@ -14,7 +14,10 @@ namespace WalletWasabi.Gui.ViewModels.Validation
{
var vma = ReflectionHelper.GetAttribute<ValidateMethodAttribute>(pInfo);
- if (vma is null) continue;
+ if (vma is null)
+ {
+ continue;
+ }
var mInfo = ReflectionHelper.GetMethodInfo<ErrorDescriptors>(instance, vma.MethodName);
yield return (pInfo.Name, mInfo);
@@ -24,7 +27,10 @@ namespace WalletWasabi.Gui.ViewModels.Validation
public static ErrorDescriptors ValidateAllProperties(ViewModelBase viewModelBase,
List<(string propertyName, MethodInfo mInfo)> validationMethodCache)
{
- if (validationMethodCache is null) return ErrorDescriptors.Empty;
+ if (validationMethodCache is null)
+ {
+ return ErrorDescriptors.Empty;
+ }
ErrorDescriptors result = null;
@@ -32,7 +38,10 @@ namespace WalletWasabi.Gui.ViewModels.Validation
{
var invokeRes = (ErrorDescriptors)validationCache.mInfo.Invoke(viewModelBase, null);
- if (result is null) result = new ErrorDescriptors();
+ if (result is null)
+ {
+ result = new ErrorDescriptors();
+ }
result.AddRange(invokeRes);
}
@@ -44,17 +53,26 @@ namespace WalletWasabi.Gui.ViewModels.Validation
string propertyName,
List<(string propertyName, MethodInfo mInfo)> validationMethodCache)
{
- if (validationMethodCache is null) return ErrorDescriptors.Empty;
+ if (validationMethodCache is null)
+ {
+ return ErrorDescriptors.Empty;
+ }
ErrorDescriptors result = null;
foreach (var validationCache in validationMethodCache)
{
- if (validationCache.propertyName != propertyName) continue;
+ if (validationCache.propertyName != propertyName)
+ {
+ continue;
+ }
var invokeRes = (ErrorDescriptors)validationCache.mInfo.Invoke(viewModelBase, null);
- if (result is null) result = new ErrorDescriptors();
+ if (result is null)
+ {
+ result = new ErrorDescriptors();
+ }
result.AddRange(invokeRes);
}

MODIFY
WalletWasabi.Gui/ViewModels/ViewModelBase.cs
WalletWasabi.Gui/ViewModels/ViewModelBase.cs
@@ -13,14 +13,18 @@ namespace WalletWasabi.Gui.ViewModels
{
public class ViewModelBase : ReactiveObject, INotifyDataErrorInfo
{
- private List<(string propertyName, MethodInfo mInfo)> ValidationMethodCache;
+ private List<(string propertyName, MethodInfo mInfo)> ValidationMethodCache { get; }
+
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;
public ViewModelBase()
{
var vmc = Validator.PropertiesWithValidation(this).ToList();
- if (vmc.Count == 0) return;
+ if (vmc.Count == 0)
+ {
+ return;
+ }
ValidationMethodCache = vmc;
}
@@ -34,8 +38,10 @@ namespace WalletWasabi.Gui.ViewModels
// HACK: Need to serialize this in order to pass through IndeiValidationPlugin on Avalonia 0.8.2.
// Should be removed when Avalonia has the hotfix update.
if (error.HasErrors)
+ {
yield return JsonConvert.SerializeObject(error);
}
+ }
protected void NotifyErrorsChanged(string propertyName)
{

Code style fix.