fix code factor issues for mainwindowVM
MODIFY
WalletWasabi.Gui/ViewModels/MainWindowViewModel.cs
WalletWasabi.Gui/ViewModels/MainWindowViewModel.cs
@@ -21,8 +21,39 @@ namespace WalletWasabi.Gui.ViewModels
{
private ModalDialogViewModelBase _modalDialog;
private bool _canClose = true;
-
private string _title = "Wasabi Wallet";
+ private double _height;
+ private double _width;
+ private WindowState _windowState;
+ private StatusBarViewModel _statusBar;
+ private LockScreenViewModelBase _lockScreen;
+ private volatile bool _disposedValue = false; // To detect redundant calls
+
+ public MainWindowViewModel()
+ {
+ Shell = IoC.Get<IShell>();
+
+ var global = Locator.Current.GetService<Global>();
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ var uiConfig = global.UiConfig;
+
+ Width = uiConfig.Width;
+ Height = uiConfig.Height;
+ WindowState = uiConfig.WindowState;
+ }
+ else
+ {
+ WindowState = WindowState.Maximized;
+ }
+
+ InitializeLockScreen(global.UiConfig);
+
+ StatusBar = new StatusBarViewModel();
+
+ DisplayWalletManager();
+ }
public string Title
{
@@ -30,40 +61,30 @@ namespace WalletWasabi.Gui.ViewModels
internal set => this.RaiseAndSetIfChanged(ref _title, value);
}
- private double _height;
-
public double Height
{
get => _height;
set => this.RaiseAndSetIfChanged(ref _height, value);
}
- private double _width;
-
public double Width
{
get => _width;
set => this.RaiseAndSetIfChanged(ref _width, value);
}
- private WindowState _windowState;
-
public WindowState WindowState
{
get => _windowState;
set => this.RaiseAndSetIfChanged(ref _windowState, value);
}
- private StatusBarViewModel _statusBar;
-
public StatusBarViewModel StatusBar
{
get => _statusBar;
set => this.RaiseAndSetIfChanged(ref _statusBar, value);
}
- private LockScreenViewModelBase _lockScreen;
-
public LockScreenViewModelBase LockScreen
{
get => _lockScreen;
@@ -72,31 +93,9 @@ namespace WalletWasabi.Gui.ViewModels
public ReactiveCommand<Unit, Unit> LockScreenCommand { get; }
- public MainWindowViewModel()
- {
- Shell = IoC.Get<IShell>();
-
- var global = Locator.Current.GetService<Global>();
-
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- var uiConfig = global.UiConfig;
-
- Width = uiConfig.Width;
- Height = uiConfig.Height;
- WindowState = uiConfig.WindowState;
- }
- else
- {
- WindowState = WindowState.Maximized;
- }
-
- InitializeLockScreen(global.UiConfig);
-
- StatusBar = new StatusBarViewModel();
+ public IShell Shell { get; }
- DisplayWalletManager();
- }
+ public static MainWindowViewModel Instance { get; internal set; }
public void Initialize()
{
@@ -145,10 +144,6 @@ namespace WalletWasabi.Gui.ViewModels
}
}
- public IShell Shell { get; }
-
- public static MainWindowViewModel Instance { get; internal set; }
-
public async Task<bool> ShowDialogAsync(ModalDialogViewModelBase dialog)
{
ModalDialog = dialog;
@@ -173,9 +168,6 @@ namespace WalletWasabi.Gui.ViewModels
}
#region IDisposable Support
-
- private volatile bool _disposedValue = false; // To detect redundant calls
-
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)

fix code factor issues for mainwindowVM