Add rule to use expression body for lambdas
This commit is contained in:
Родитель
0b25d0f827
Коммит
b7769e0a87
|
@ -103,6 +103,9 @@ csharp_prefer_braces = true:error
|
|||
#do not suggest readonly fields
|
||||
dotnet_style_readonly_field = false:error
|
||||
|
||||
# use expression body for lambdas
|
||||
csharp_style_expression_bodied_lambdas = true:error
|
||||
|
||||
|
||||
# name all constant or static fields using PascalCase
|
||||
dotnet_naming_rule.constant_or_static_fields_should_be_pascal_case.severity = error
|
||||
|
|
|
@ -32,10 +32,7 @@ namespace WalletWasabi.Backend
|
|||
{
|
||||
services.AddMemoryCache();
|
||||
|
||||
services.AddMvc(options =>
|
||||
{
|
||||
options.ModelMetadataDetailsProviders.Add(new SuppressChildValidationMetadataProvider(typeof(BitcoinAddress)));
|
||||
})
|
||||
services.AddMvc(options => options.ModelMetadataDetailsProviders.Add(new SuppressChildValidationMetadataProvider(typeof(BitcoinAddress))))
|
||||
.AddControllersAsServices();
|
||||
|
||||
// Register the Swagger generator, defining one or more Swagger documents
|
||||
|
@ -75,10 +72,7 @@ namespace WalletWasabi.Backend
|
|||
app.UseSwagger();
|
||||
|
||||
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), specifying the Swagger JSON endpoint.
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint($"/swagger/v{Constants.BackendMajorVersion}/swagger.json", "Wasabi Wallet API V3");
|
||||
});
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint($"/swagger/v{Constants.BackendMajorVersion}/swagger.json", "Wasabi Wallet API V3"));
|
||||
|
||||
// So to correctly handle HEAD requests.
|
||||
// https://www.tpeczek.com/2017/10/exploring-head-method-behavior-in.html
|
||||
|
|
|
@ -14,10 +14,7 @@ namespace WalletWasabi.Gui.Behaviors
|
|||
|
||||
base.OnAttached();
|
||||
|
||||
Disposables.Add(AssociatedObject.AddHandler(InputElement.PointerPressedEvent, (sender, e) =>
|
||||
{
|
||||
e.Handled = ExecuteCommand();
|
||||
}));
|
||||
Disposables.Add(AssociatedObject.AddHandler(InputElement.PointerPressedEvent, (sender, e) => e.Handled = ExecuteCommand()));
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
|
|
|
@ -14,10 +14,7 @@ namespace WalletWasabi.Gui.Behaviors
|
|||
|
||||
base.OnAttached();
|
||||
|
||||
Disposables.Add(AssociatedObject.AddHandler(InputElement.PointerReleasedEvent, (sender, e) =>
|
||||
{
|
||||
e.Handled = ExecuteCommand();
|
||||
}));
|
||||
Disposables.Add(AssociatedObject.AddHandler(InputElement.PointerReleasedEvent, (sender, e) => e.Handled = ExecuteCommand()));
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
|
|
|
@ -14,10 +14,7 @@ namespace WalletWasabi.Gui.Behaviors
|
|||
|
||||
base.OnAttached();
|
||||
|
||||
Disposables.Add(AssociatedObject.AddHandler(InputElement.DoubleTappedEvent, (sender, e) =>
|
||||
{
|
||||
e.Handled = ExecuteCommand();
|
||||
}));
|
||||
Disposables.Add(AssociatedObject.AddHandler(InputElement.DoubleTappedEvent, (sender, e) => e.Handled = ExecuteCommand()));
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
|
|
|
@ -18,10 +18,7 @@ namespace WalletWasabi.Gui.Behaviors
|
|||
|
||||
base.OnAttached();
|
||||
|
||||
Disposables.Add(AssociatedObject.AddHandler(InputElement.LostFocusEvent, (sender, e) =>
|
||||
{
|
||||
e.Handled = ExecuteCommand();
|
||||
}));
|
||||
Disposables.Add(AssociatedObject.AddHandler(InputElement.LostFocusEvent, (sender, e) => e.Handled = ExecuteCommand()));
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace WalletWasabi.Gui.Behaviors
|
|||
base.OnAttached();
|
||||
|
||||
AssociatedObject.AttachedToLogicalTree += (sender, e) =>
|
||||
{
|
||||
Disposables.Add(this.GetObservable(IsFocusedProperty)
|
||||
.Subscribe(focused =>
|
||||
{
|
||||
|
@ -34,7 +33,6 @@ namespace WalletWasabi.Gui.Behaviors
|
|||
AssociatedObject.Focus();
|
||||
}
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
|
|
|
@ -41,10 +41,7 @@ namespace WalletWasabi.Gui.Controls
|
|||
}
|
||||
};
|
||||
|
||||
this.GetObservable(TextProperty).Subscribe(t =>
|
||||
{
|
||||
EditText = t;
|
||||
});
|
||||
this.GetObservable(TextProperty).Subscribe(t => EditText = t);
|
||||
|
||||
this.GetObservable(InEditModeProperty).Subscribe(mode =>
|
||||
{
|
||||
|
@ -192,10 +189,7 @@ namespace WalletWasabi.Gui.Controls
|
|||
_textBox.SelectionEnd = Text.Length;
|
||||
_textBox.CaretIndex = Text.Length;
|
||||
|
||||
Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
_textBox.Focus();
|
||||
});
|
||||
Dispatcher.UIThread.InvokeAsync(() => _textBox.Focus());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -30,10 +30,7 @@ namespace WalletWasabi.Gui.Controls
|
|||
{
|
||||
_textPasted = new Subject<string>();
|
||||
|
||||
CopyCommand = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await CopyAsync();
|
||||
});
|
||||
CopyCommand = ReactiveCommand.CreateFromTask(async () => await CopyAsync());
|
||||
|
||||
PasteCommand = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
|
|
|
@ -89,10 +89,7 @@ namespace WalletWasabi.Gui.Controls.LockScreen
|
|||
this.WhenAnyValue(x => x.DoneAnimating)
|
||||
.Where(x => x)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
vm.StateChanged = false;
|
||||
})
|
||||
.Subscribe(_ => vm.StateChanged = false)
|
||||
.DisposeWith(vm.Disposables);
|
||||
|
||||
Observable.FromEventPattern(DragThumb, nameof(DragThumb.DragCompleted))
|
||||
|
|
|
@ -90,10 +90,7 @@ namespace WalletWasabi.Gui.Controls
|
|||
|
||||
Disposables = new CompositeDisposable();
|
||||
|
||||
CopyToClipboardCommand = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await TryCopyToClipboardAsync();
|
||||
});
|
||||
CopyToClipboardCommand = ReactiveCommand.CreateFromTask(async () => await TryCopyToClipboardAsync());
|
||||
}
|
||||
|
||||
protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
|
||||
|
@ -112,10 +109,7 @@ namespace WalletWasabi.Gui.Controls
|
|||
.Subscribe(async x => await OnClickedAsync(x))
|
||||
.DisposeWith(Disposables);
|
||||
|
||||
this.WhenAnyValue(x => x.ClipboardNotificationVisible).Subscribe(visible =>
|
||||
{
|
||||
TextVisible = !visible;
|
||||
});
|
||||
this.WhenAnyValue(x => x.ClipboardNotificationVisible).Subscribe(visible => TextVisible = !visible);
|
||||
|
||||
this.WhenAnyValue(x => x.SelectionStart).Subscribe(_ =>
|
||||
{
|
||||
|
|
|
@ -75,14 +75,8 @@ namespace WalletWasabi.Gui.Controls
|
|||
|
||||
Content = stackPnl;
|
||||
|
||||
this.GetObservable(SortDirectionProperty).Subscribe(x =>
|
||||
{
|
||||
SortDirection = x;
|
||||
});
|
||||
this.GetObservable(TextProperty).Subscribe(x =>
|
||||
{
|
||||
Text = x;
|
||||
});
|
||||
this.GetObservable(SortDirectionProperty).Subscribe(x => SortDirection = x);
|
||||
this.GetObservable(TextProperty).Subscribe(x => Text = x);
|
||||
}
|
||||
|
||||
protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
|
||||
|
|
|
@ -30,17 +30,11 @@ namespace WalletWasabi.Gui.Controls
|
|||
|
||||
this.GetObservable(IsPasswordVisibleProperty)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
IsPasswordVisible = x;
|
||||
});
|
||||
.Subscribe(x => IsPasswordVisible = x);
|
||||
|
||||
this.WhenAnyValue(x => x.IsPasswordVisible)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
PasswordChar = x ? '\0' : '\u2022';
|
||||
});
|
||||
.Subscribe(x => PasswordChar = x ? '\0' : '\u2022');
|
||||
}
|
||||
|
||||
protected override bool IsCopyEnabled => false;
|
||||
|
@ -53,10 +47,7 @@ namespace WalletWasabi.Gui.Controls
|
|||
maskedButton.WhenAnyValue(x => x.IsPressed)
|
||||
.Where(x => x)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
IsPasswordVisible = !IsPasswordVisible;
|
||||
});
|
||||
.Subscribe(_ => IsPasswordVisible = !IsPasswordVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,10 +100,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
|
|||
.Select(x => x ? DequeuingButtonTextString : DequeueButtonTextString)
|
||||
.Subscribe(text => DequeueButtonText = text);
|
||||
|
||||
this.WhenAnyValue(x => x.TargetPrivacy).Subscribe(target =>
|
||||
{
|
||||
CoinJoinUntilAnonymitySet = Global.Config.GetTargetLevel(target);
|
||||
});
|
||||
this.WhenAnyValue(x => x.TargetPrivacy)
|
||||
.Subscribe(target => CoinJoinUntilAnonymitySet = Global.Config.GetTargetLevel(target));
|
||||
|
||||
this.WhenAnyValue(x => x.RoundTimesout)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
|
|
|
@ -85,17 +85,13 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
|
|||
Global.ChaumianClient,
|
||||
nameof(Global.ChaumianClient.StateUpdated))
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
RefreshSmartCoinStatus();
|
||||
}).DisposeWith(Disposables);
|
||||
.Subscribe(_ => RefreshSmartCoinStatus())
|
||||
.DisposeWith(Disposables);
|
||||
|
||||
Global.BitcoinStore.HashChain.WhenAnyValue(x => x.ServerTipHeight)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
this.RaisePropertyChanged(nameof(Confirmations));
|
||||
}).DisposeWith(Disposables);
|
||||
.Subscribe(_ => this.RaisePropertyChanged(nameof(Confirmations)))
|
||||
.DisposeWith(Disposables);
|
||||
|
||||
Global.UiConfig.WhenAnyValue(x => x.LurkingWifeMode)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
|
|
|
@ -42,10 +42,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
|
|||
},
|
||||
this.WhenAny(x => x.MaskedPin, (maskedPin) => !string.IsNullOrWhiteSpace(maskedPin.Value)));
|
||||
|
||||
KeyPadCommand = ReactiveCommand.Create<string>((arg) =>
|
||||
{
|
||||
MaskedPin += arg;
|
||||
});
|
||||
KeyPadCommand = ReactiveCommand.Create<string>((arg) => MaskedPin += arg);
|
||||
|
||||
Observable.Merge(SendPinCommand.ThrownExceptions)
|
||||
.Merge(KeyPadCommand.ThrownExceptions)
|
||||
|
|
|
@ -124,10 +124,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
|
|||
{ }
|
||||
}, isCoinListItemSelected);
|
||||
|
||||
ChangeLabelCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
SelectedAddress.InEditMode = true;
|
||||
});
|
||||
#pragma warning disable IDE0053 // Use expression body for lambda expressions
|
||||
ChangeLabelCommand = ReactiveCommand.Create(() => { SelectedAddress.InEditMode = true; });
|
||||
#pragma warning restore IDE0053 // Use expression body for lambda expressions
|
||||
|
||||
_suggestions = new ObservableCollection<SuggestionViewModel>();
|
||||
}
|
||||
|
|
|
@ -168,17 +168,11 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
|
|||
|
||||
this.WhenAnyValue(x => x.IsBusy)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
SetSendText();
|
||||
});
|
||||
.Subscribe(_ => SetSendText());
|
||||
|
||||
this.WhenAnyValue(x => x.IsHardwareBusy)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
SetSendText();
|
||||
});
|
||||
.Subscribe(_ => SetSendText());
|
||||
|
||||
this.WhenAnyValue(x => x.Label)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
|
@ -194,12 +188,12 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
|
|||
|
||||
this.WhenAnyValue(x => x.IsSliderFeeUsed)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(enabled =>
|
||||
{
|
||||
FeeControlOpacity = enabled ? 1 : 0.5; // Give the control the disabled feeling. Real Disable it not a solution as we have to detect if the slider is moved.
|
||||
});
|
||||
.Subscribe(enabled => FeeControlOpacity = enabled ? 1 : 0.5); // Give the control the disabled feeling. Real Disable it not a solution as we have to detect if the slider is moved.
|
||||
|
||||
#pragma warning disable IDE0053 // Use expression body for lambda expressions
|
||||
MaxCommand = ReactiveCommand.Create(() => { IsMax = !IsMax; }, outputScheduler: RxApp.MainThreadScheduler);
|
||||
#pragma warning restore IDE0053 // Use expression body for lambda expressions
|
||||
|
||||
this.WhenAnyValue(x => x.IsMax)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(_ =>
|
||||
|
@ -450,10 +444,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
|
|||
SetFeesAndTexts();
|
||||
});
|
||||
|
||||
FeeSliderClickedCommand = ReactiveCommand.Create((PointerPressedEventArgs mouse) =>
|
||||
{
|
||||
IsSliderFeeUsed = true;
|
||||
});
|
||||
#pragma warning disable IDE0053 // Use expression body for lambda expressions
|
||||
FeeSliderClickedCommand = ReactiveCommand.Create((PointerPressedEventArgs mouse) => { IsSliderFeeUsed = true; });
|
||||
#pragma warning restore IDE0053 // Use expression body for lambda expressions
|
||||
|
||||
HighLightFeeSliderCommand = ReactiveCommand.Create((bool entered) =>
|
||||
{
|
||||
|
|
|
@ -70,10 +70,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
|
|||
TransactionString = textToPaste;
|
||||
});
|
||||
|
||||
BroadcastTransactionCommand = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await OnDoTransactionBroadcastAsync();
|
||||
});
|
||||
BroadcastTransactionCommand = ReactiveCommand.CreateFromTask(async () => await OnDoTransactionBroadcastAsync());
|
||||
|
||||
ImportTransactionCommand = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
|
|
|
@ -21,7 +21,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
|
|||
public WalletAdvancedViewModel(WalletViewModel walletViewModel) : base(walletViewModel.Name, walletViewModel)
|
||||
{
|
||||
Items = new ObservableCollection<WalletActionViewModel>();
|
||||
#pragma warning disable IDE0053 // Use expression body for lambda expressions
|
||||
ExpandItCommand = ReactiveCommand.Create(() => { IsExpanded = !IsExpanded; });
|
||||
#pragma warning restore IDE0053 // Use expression body for lambda expressions
|
||||
}
|
||||
|
||||
public ObservableCollection<WalletActionViewModel> Items
|
||||
|
|
|
@ -7,11 +7,7 @@ namespace WalletWasabi.Gui.Dialogs
|
|||
{
|
||||
public GenSocksServFailDialogViewModel() : base("", true, false)
|
||||
{
|
||||
OKCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
// OK pressed.
|
||||
Close(true);
|
||||
});
|
||||
OKCommand = ReactiveCommand.Create(() => Close(true)); // OK pressed.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,10 +27,7 @@ namespace WalletWasabi.Gui.Dialogs
|
|||
var canOk = this.WhenAnyValue(x => x.TextInput)
|
||||
.Select(x => !string.IsNullOrWhiteSpace(TextInput));
|
||||
|
||||
OKCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
Close(true);
|
||||
}, canOk);
|
||||
OKCommand = ReactiveCommand.Create(() => Close(true), canOk);
|
||||
|
||||
CancelCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
|
|
|
@ -175,10 +175,7 @@ namespace WalletWasabi.Gui
|
|||
|
||||
KillRequested = true;
|
||||
await TryDesperateDequeueAllCoinsAsync();
|
||||
Dispatcher.UIThread.PostLogException(() =>
|
||||
{
|
||||
Application.Current?.MainWindow?.Close();
|
||||
});
|
||||
Dispatcher.UIThread.PostLogException(() => Application.Current?.MainWindow?.Close());
|
||||
await DisposeAsync();
|
||||
|
||||
Logger.LogSoftwareStopped("Wasabi");
|
||||
|
|
|
@ -32,14 +32,8 @@ namespace WalletWasabi.Gui.Helpers
|
|||
var errorBuilder = new StringBuilder();
|
||||
|
||||
var exitCode = ExecuteShellCommand(commandName, args,
|
||||
(s, e) =>
|
||||
{
|
||||
outputBuilder.AppendLine(e.Data);
|
||||
},
|
||||
(s, e) =>
|
||||
{
|
||||
errorBuilder = new StringBuilder();
|
||||
},
|
||||
(s, e) => outputBuilder.AppendLine(e.Data),
|
||||
(s, e) => errorBuilder = new StringBuilder(),
|
||||
false, "");
|
||||
|
||||
return new ShellExecuteResult()
|
||||
|
@ -147,10 +141,7 @@ namespace WalletWasabi.Gui.Helpers
|
|||
{
|
||||
//Use the which command
|
||||
var outputBuilder = new StringBuilder();
|
||||
ExecuteShellCommand("which", $"\"{fileName}\"", (s, e) =>
|
||||
{
|
||||
outputBuilder.AppendLine(e.Data);
|
||||
}, (s, e) => { }, false);
|
||||
ExecuteShellCommand("which", $"\"{fileName}\"", (s, e) => outputBuilder.AppendLine(e.Data), (s, e) => { }, false);
|
||||
var procOutput = outputBuilder.ToString();
|
||||
if (string.IsNullOrWhiteSpace(procOutput))
|
||||
{
|
||||
|
|
|
@ -26,10 +26,7 @@ namespace WalletWasabi.Gui.Shell.Commands
|
|||
AboutCommand = new CommandDefinition(
|
||||
"About",
|
||||
commandIconService.GetCompletionKindImage("About"),
|
||||
ReactiveCommand.Create(() =>
|
||||
{
|
||||
IoC.Get<IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
|
||||
}));
|
||||
ReactiveCommand.Create(() => IoC.Get<IShell>().AddOrSelectDocument(() => new AboutViewModel(Global))));
|
||||
|
||||
CustomerSupportCommand = new CommandDefinition(
|
||||
"Customer Support",
|
||||
|
@ -82,26 +79,17 @@ namespace WalletWasabi.Gui.Shell.Commands
|
|||
PrivacyPolicyCommand = new CommandDefinition(
|
||||
"Privacy Policy",
|
||||
commandIconService.GetCompletionKindImage("PrivacyPolicy"),
|
||||
ReactiveCommand.Create(() =>
|
||||
{
|
||||
IoC.Get<IShell>().AddOrSelectDocument(() => new PrivacyPolicyViewModel(Global));
|
||||
}));
|
||||
ReactiveCommand.Create(() => IoC.Get<IShell>().AddOrSelectDocument(() => new PrivacyPolicyViewModel(Global))));
|
||||
|
||||
TermsAndConditionsCommand = new CommandDefinition(
|
||||
"Terms and Conditions",
|
||||
commandIconService.GetCompletionKindImage("TermsAndConditions"),
|
||||
ReactiveCommand.Create(() =>
|
||||
{
|
||||
IoC.Get<IShell>().AddOrSelectDocument(() => new TermsAndConditionsViewModel(Global));
|
||||
}));
|
||||
ReactiveCommand.Create(() => IoC.Get<IShell>().AddOrSelectDocument(() => new TermsAndConditionsViewModel(Global))));
|
||||
|
||||
LegalIssuesCommand = new CommandDefinition(
|
||||
"Legal Issues",
|
||||
commandIconService.GetCompletionKindImage("LegalIssues"),
|
||||
ReactiveCommand.Create(() =>
|
||||
{
|
||||
IoC.Get<IShell>().AddOrSelectDocument(() => new LegalIssuesViewModel(Global));
|
||||
}));
|
||||
ReactiveCommand.Create(() => IoC.Get<IShell>().AddOrSelectDocument(() => new LegalIssuesViewModel(Global))));
|
||||
}
|
||||
|
||||
[ExportCommandDefinition("Help.About")]
|
||||
|
|
|
@ -27,10 +27,7 @@ namespace WalletWasabi.Gui.Shell.Commands
|
|||
Global = global.Global;
|
||||
var walletManagerCommand = ReactiveCommand.Create(OnWalletManager);
|
||||
|
||||
var settingsCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
IoC.Get<IShell>().AddOrSelectDocument(() => new SettingsViewModel(Global));
|
||||
});
|
||||
var settingsCommand = ReactiveCommand.Create(() => IoC.Get<IShell>().AddOrSelectDocument(() => new SettingsViewModel(Global)));
|
||||
|
||||
#if DEBUG
|
||||
var devToolsCommand = ReactiveCommand.Create(() =>
|
||||
|
|
|
@ -140,10 +140,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
|
|||
}
|
||||
}, outputScheduler: RxApp.MainThreadScheduler);
|
||||
|
||||
OpenBrowserCommand = ReactiveCommand.Create<string>(x =>
|
||||
{
|
||||
IoHelpers.OpenBrowser(x);
|
||||
});
|
||||
OpenBrowserCommand = ReactiveCommand.Create<string>(x => IoHelpers.OpenBrowser(x));
|
||||
|
||||
OpenBrowserCommand.ThrownExceptions.Subscribe(ex => Logger.LogWarning(ex));
|
||||
LoadCommand.ThrownExceptions.Subscribe(ex => Logger.LogWarning(ex));
|
||||
|
@ -681,10 +678,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
|
|||
|
||||
try
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
await Global.InitializeWalletServiceAsync(keyManager);
|
||||
});
|
||||
await Task.Run(async () => await Global.InitializeWalletServiceAsync(keyManager));
|
||||
// Successffully initialized.
|
||||
Owner.OnClose();
|
||||
// Open Wallet Explorer tabs
|
||||
|
|
|
@ -70,10 +70,9 @@ namespace WalletWasabi.Gui.ViewModels
|
|||
{
|
||||
Shell = IoC.Get<IShell>();
|
||||
|
||||
LockScreenCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
Global.UiConfig.LockScreenActive = true;
|
||||
});
|
||||
#pragma warning disable IDE0053 // Use expression body for lambda expressions
|
||||
LockScreenCommand = ReactiveCommand.Create(() => { Global.UiConfig.LockScreenActive = true; });
|
||||
#pragma warning restore IDE0053 // Use expression body for lambda expressions
|
||||
|
||||
LockScreenCommand.ThrownExceptions.Subscribe(ex => Logger.LogWarning(ex));
|
||||
}
|
||||
|
|
|
@ -87,11 +87,8 @@ namespace WalletWasabi.Gui.ViewModels
|
|||
.Merge(Observable.FromEventPattern<NodeEventArgs>(nodes, nameof(nodes.Removed)).Select(x => true)
|
||||
.Merge(Synchronizer.WhenAnyValue(x => x.TorStatus).Select(x => true))))
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
// Set peers to 0 if Tor is not running, because we get Tor status from backend answer so it seems to the user that peers are connected over clearnet, while they are not.
|
||||
Peers = Synchronizer.TorStatus == TorStatus.NotRunning ? 0 : Nodes.Count;
|
||||
}).DisposeWith(Disposables);
|
||||
.Subscribe(_ => Peers = Synchronizer.TorStatus == TorStatus.NotRunning ? 0 : Nodes.Count) // Set peers to 0 if Tor is not running, because we get Tor status from backend answer so it seems to the user that peers are connected over clearnet, while they are not.
|
||||
.DisposeWith(Disposables);
|
||||
|
||||
Peers = Tor == TorStatus.NotRunning ? 0 : Nodes.Count;
|
||||
|
||||
|
@ -102,17 +99,13 @@ namespace WalletWasabi.Gui.ViewModels
|
|||
|
||||
Synchronizer.WhenAnyValue(x => x.TorStatus)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(status =>
|
||||
{
|
||||
Tor = UseTor ? status : TorStatus.TurnedOff;
|
||||
}).DisposeWith(Disposables);
|
||||
.Subscribe(status => Tor = UseTor ? status : TorStatus.TurnedOff)
|
||||
.DisposeWith(Disposables);
|
||||
|
||||
Synchronizer.WhenAnyValue(x => x.BackendStatus)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
Backend = Synchronizer.BackendStatus;
|
||||
}).DisposeWith(Disposables);
|
||||
.Subscribe(_ => Backend = Synchronizer.BackendStatus)
|
||||
.DisposeWith(Disposables);
|
||||
|
||||
_filtersLeft = HashChain.WhenAnyValue(x => x.HashesLeft)
|
||||
.Throttle(TimeSpan.FromMilliseconds(100))
|
||||
|
@ -122,17 +115,13 @@ namespace WalletWasabi.Gui.ViewModels
|
|||
|
||||
Synchronizer.WhenAnyValue(x => x.UsdExchangeRate)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(usd =>
|
||||
{
|
||||
BtcPrice = $"${(long)usd}";
|
||||
}).DisposeWith(Disposables);
|
||||
.Subscribe(usd => BtcPrice = $"${(long)usd}")
|
||||
.DisposeWith(Disposables);
|
||||
|
||||
Observable.FromEventPattern<bool>(Synchronizer, nameof(Synchronizer.ResponseArrivedIsGenSocksServFail))
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(e =>
|
||||
{
|
||||
OnResponseArrivedIsGenSocksServFail(e.EventArgs);
|
||||
}).DisposeWith(Disposables);
|
||||
.Subscribe(e => OnResponseArrivedIsGenSocksServFail(e.EventArgs))
|
||||
.DisposeWith(Disposables);
|
||||
|
||||
this.WhenAnyValue(x => x.FiltersLeft, x => x.DownloadingBlock)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
|
|
|
@ -34,10 +34,7 @@ namespace WalletWasabi.Tests.UnitTests
|
|||
|
||||
var disposable = await asyncMutex.LockAsync();
|
||||
|
||||
var myThread = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
disposable.Dispose();
|
||||
}));
|
||||
var myThread = new Thread(new ThreadStart(() => disposable.Dispose()));
|
||||
myThread.Start();
|
||||
myThread.Join();
|
||||
|
||||
|
|
|
@ -77,71 +77,50 @@ namespace WalletWasabi.Tests.UnitTests
|
|||
var newServerHeight = hashChain.ServerTipHeight + 1;
|
||||
Assert.PropertyChanged(hashChain,
|
||||
nameof(hashChain.ServerTipHeight),
|
||||
() =>
|
||||
{
|
||||
// ASSERT FUNCTION
|
||||
// Assert update server height raises.
|
||||
hashChain.UpdateServerTipHeight(newServerHeight);
|
||||
});
|
||||
// ASSERT FUNCTION
|
||||
// Assert update server height raises.
|
||||
() => hashChain.UpdateServerTipHeight(newServerHeight));
|
||||
newServerHeight++;
|
||||
Assert.PropertyChanged(hashChain,
|
||||
nameof(hashChain.HashesLeft),
|
||||
() =>
|
||||
{
|
||||
// ASSERT FUNCTION
|
||||
// Assert update server height raises.
|
||||
hashChain.UpdateServerTipHeight(newServerHeight);
|
||||
});
|
||||
// ASSERT FUNCTION
|
||||
// Assert update server height raises.
|
||||
() => hashChain.UpdateServerTipHeight(newServerHeight));
|
||||
|
||||
newServerHeight++;
|
||||
Assert.Throws<PropertyChangedException>(() =>
|
||||
Assert.PropertyChanged(hashChain,
|
||||
nameof(hashChain.HashCount),
|
||||
() =>
|
||||
{
|
||||
// ASSERT FUNCTIONS
|
||||
// Assert update server height does not raise unnecessary events.
|
||||
hashChain.UpdateServerTipHeight(newServerHeight);
|
||||
}));
|
||||
// ASSERT FUNCTIONS
|
||||
// Assert update server height does not raise unnecessary events.
|
||||
() => hashChain.UpdateServerTipHeight(newServerHeight)));
|
||||
newServerHeight++;
|
||||
Assert.Throws<PropertyChangedException>(() =>
|
||||
Assert.PropertyChanged(hashChain,
|
||||
nameof(hashChain.TipHash),
|
||||
() =>
|
||||
{
|
||||
// ASSERT FUNCTIONS
|
||||
// Assert update server height does not raise unnecessary events.
|
||||
hashChain.UpdateServerTipHeight(newServerHeight);
|
||||
}));
|
||||
// ASSERT FUNCTIONS
|
||||
// Assert update server height does not raise unnecessary events.
|
||||
() => hashChain.UpdateServerTipHeight(newServerHeight)));
|
||||
newServerHeight++;
|
||||
Assert.Throws<PropertyChangedException>(() =>
|
||||
Assert.PropertyChanged(hashChain,
|
||||
nameof(hashChain.TipHeight),
|
||||
() =>
|
||||
{
|
||||
// ASSERT FUNCTIONS
|
||||
// Assert update server height does not raise unnecessary events.
|
||||
hashChain.UpdateServerTipHeight(newServerHeight);
|
||||
}));
|
||||
// ASSERT FUNCTIONS
|
||||
// Assert update server height does not raise unnecessary events.
|
||||
() => hashChain.UpdateServerTipHeight(newServerHeight)));
|
||||
var sameServerheight = newServerHeight;
|
||||
Assert.Throws<PropertyChangedException>(() =>
|
||||
Assert.PropertyChanged(hashChain,
|
||||
nameof(hashChain.ServerTipHeight),
|
||||
() =>
|
||||
{
|
||||
// ASSERT FUNCTIONS
|
||||
// Assert update server height does not raise without actually changing.
|
||||
hashChain.UpdateServerTipHeight(sameServerheight);
|
||||
}));
|
||||
// ASSERT FUNCTIONS
|
||||
// Assert update server height does not raise without actually changing.
|
||||
() => hashChain.UpdateServerTipHeight(sameServerheight)));
|
||||
Assert.Throws<PropertyChangedException>(() =>
|
||||
Assert.PropertyChanged(hashChain,
|
||||
nameof(hashChain.HashesLeft),
|
||||
() =>
|
||||
{
|
||||
// ASSERT FUNCTIONS
|
||||
// Assert update server height does not raise without actually changing.
|
||||
hashChain.UpdateServerTipHeight(sameServerheight);
|
||||
}));
|
||||
// ASSERT FUNCTIONS
|
||||
// Assert update server height does not raise without actually changing.
|
||||
() => hashChain.UpdateServerTipHeight(sameServerheight)));
|
||||
|
||||
// ASSERT PROPERTIES
|
||||
Assert.Equal(0, hashChain.HashCount);
|
||||
|
|
|
@ -71,10 +71,7 @@ namespace System.IO
|
|||
public static Task<string> ReadPartAsync(this TextReader me, char separator, CancellationToken ctsToken)
|
||||
{
|
||||
return Task<string>.Factory.StartNew(state =>
|
||||
{
|
||||
return ((TextReader)state).ReadPart(separator);
|
||||
},
|
||||
me, ctsToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
|
||||
((TextReader)state).ReadPart(separator), me, ctsToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче