Allowed ErrorWindow to close properly.
This commit is contained in:
1 parent
663fb256e5
commit
93219aaf9b
7 files changed
+16
-293
No files matched your search
@@ -1,6 +1,4 @@
|
||||
using System.Reactive;
|
||||
using System.Security.Principal;
|
||||
using PcgsInvUi.Views;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
@@ -11,16 +9,15 @@ public class ErrorWindowViewModel : ViewModelBase {
|
||||
get => _message;
|
||||
set => this.RaiseAndSetIfChanged(ref _message, value);
|
||||
}
|
||||
|
||||
private string _message;
|
||||
|
||||
public ReactiveCommand<ErrorWindow, Unit> CloseCommand { get; }
|
||||
public ReactiveCommand<Unit, object> CloseCommand { get; }
|
||||
|
||||
public ErrorWindowViewModel(string message)
|
||||
{
|
||||
_message = message;
|
||||
|
||||
CloseCommand = ReactiveCommand.Create<ErrorWindow>(window => window.Close());
|
||||
CloseCommand = ReactiveCommand.Create(() => (object)false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class MainWindowViewModel : ViewModelBase {
|
||||
public Interaction<DeleteWindowViewModel, Boolean> ShowDeleteWindow { get; }
|
||||
public ReactiveCommand<Unit, Unit> ExportCommand { get; }
|
||||
public Interaction<Unit, Uri> ShowExportWindow { get; }
|
||||
public Interaction<ErrorWindowViewModel, Unit> ShowErrorWindow { get; }
|
||||
public Interaction<ErrorWindowViewModel, bool> ShowErrorWindow { get; }
|
||||
|
||||
private ViewModelBase _sideContent;
|
||||
private Coin? _selectedCoin;
|
||||
@@ -57,7 +57,7 @@ public class MainWindowViewModel : ViewModelBase {
|
||||
TotalValue = DisplayedList.Sum(x => x.TotalPrice);
|
||||
|
||||
// Set up the ability to show the error window.
|
||||
ShowErrorWindow = new Interaction<ErrorWindowViewModel, Unit>();
|
||||
ShowErrorWindow = new Interaction<ErrorWindowViewModel, bool>();
|
||||
|
||||
// Set up the ability to open the delete window.
|
||||
ShowDeleteWindow = new Interaction<DeleteWindowViewModel, bool>();
|
||||
@@ -117,6 +117,7 @@ public class MainWindowViewModel : ViewModelBase {
|
||||
});
|
||||
|
||||
// Change TotalValue anytime SelectedCoin.TotalPrice changes.
|
||||
// TODO: fix this. Should update when a coin within the collection is changed.
|
||||
// Possible null deref - how do you remove this?
|
||||
this.WhenAnyValue(x => x.SelectedCoin.TotalPrice)
|
||||
.Subscribe(_ => TotalValue = ConnectedCoinDatabase.Collection.Sum(x => x.TotalPrice));
|
||||
|
||||
Reference in new issue
Block a user