Initial commit
This commit is contained in:
commit
8c7e1b917f
180 files changed
+7747
No files matched your search
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Reactive;
|
||||
using PcgsInvUi.Models;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
|
||||
public class NewViewModel : ViewModelBase
|
||||
{
|
||||
private string _pcgsNumber;
|
||||
private string _grade;
|
||||
private string _quantity;
|
||||
|
||||
public string PcgsNumber
|
||||
{
|
||||
get => _pcgsNumber;
|
||||
set => this.RaiseAndSetIfChanged(ref _pcgsNumber, value);
|
||||
}
|
||||
public string Grade
|
||||
{
|
||||
get => _grade;
|
||||
set => this.RaiseAndSetIfChanged(ref _grade, value);
|
||||
}
|
||||
public string Quantity
|
||||
{
|
||||
get => _quantity;
|
||||
set => this.RaiseAndSetIfChanged(ref _quantity, value);
|
||||
}
|
||||
|
||||
public NewViewModel()
|
||||
{
|
||||
var okEnabled = this.WhenAnyValue(
|
||||
x => x.PcgsNumber,
|
||||
x => !string.IsNullOrWhiteSpace(x));
|
||||
|
||||
OkCommand = ReactiveCommand.Create(
|
||||
() => new Coin { PcgsNumber = Int32.Parse(PcgsNumber) },
|
||||
okEnabled);
|
||||
CancelCommand = ReactiveCommand.Create(() => { });
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Coin> OkCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> CancelCommand { get; }
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user