Merge vas-working to master (attempt 2) #2
No files matched your search
+3
-3
@@ -3,12 +3,12 @@
|
||||
x:Class="PcgsInvUi.App"
|
||||
xmlns:local="using:PcgsInvUi"
|
||||
RequestedThemeVariant="Light">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator/>
|
||||
<local:ViewLocator />
|
||||
</Application.DataTemplates>
|
||||
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml" />
|
||||
|
||||
+7
-12
@@ -7,23 +7,18 @@ using PcgsInvUi.Views;
|
||||
|
||||
namespace PcgsInvUi;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
public partial class App : Application {
|
||||
public override void Initialize() {
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
public override void OnFrameworkInitializationCompleted() {
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) {
|
||||
var coins = new Services.CoinCollection();
|
||||
|
||||
desktop.MainWindow = new MainWindow
|
||||
{
|
||||
|
||||
desktop.MainWindow = new MainWindow {
|
||||
DataContext = new MainWindowViewModel(coins),
|
||||
};
|
||||
}
|
||||
|
||||
+41
-49
@@ -3,55 +3,52 @@ using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.Models;
|
||||
|
||||
public class Coin : ReactiveObject
|
||||
{
|
||||
public string PCGSNo
|
||||
{
|
||||
public class Coin : ReactiveObject {
|
||||
public string PCGSNo {
|
||||
get => _pcgsNo;
|
||||
set => this.RaiseAndSetIfChanged(ref _pcgsNo, value);
|
||||
}
|
||||
|
||||
private string _pcgsNo;
|
||||
|
||||
public string Name
|
||||
{
|
||||
public string Name {
|
||||
get => _name;
|
||||
set => this.RaiseAndSetIfChanged(ref _name, value);
|
||||
}
|
||||
|
||||
private string _name;
|
||||
|
||||
public int Year
|
||||
{
|
||||
public int Year {
|
||||
get => _year;
|
||||
set => this.RaiseAndSetIfChanged(ref _year, value);
|
||||
}
|
||||
|
||||
private int _year;
|
||||
|
||||
public string Denomination
|
||||
{
|
||||
public string Denomination {
|
||||
get => _denomination;
|
||||
set => this.RaiseAndSetIfChanged(ref _denomination, value);
|
||||
}
|
||||
|
||||
private string _denomination;
|
||||
|
||||
public string MintMark
|
||||
{
|
||||
public string MintMark {
|
||||
get => _mintMark;
|
||||
set => this.RaiseAndSetIfChanged(ref _mintMark, value);
|
||||
}
|
||||
|
||||
private string _mintMark;
|
||||
|
||||
public string Grade
|
||||
{
|
||||
public string Grade {
|
||||
get => _grade;
|
||||
set => this.RaiseAndSetIfChanged(ref _grade, value);
|
||||
}
|
||||
|
||||
private string _grade;
|
||||
|
||||
public double PriceGuideValue
|
||||
{
|
||||
public double PriceGuideValue {
|
||||
get => _priceGuideValue;
|
||||
set
|
||||
{
|
||||
set {
|
||||
TotalPrice = value * Quantity;
|
||||
this.RaiseAndSetIfChanged(ref _priceGuideValue, value);
|
||||
}
|
||||
@@ -59,67 +56,65 @@ public class Coin : ReactiveObject
|
||||
|
||||
private double _priceGuideValue;
|
||||
|
||||
public string CoinFactsLink
|
||||
{
|
||||
public string CoinFactsLink {
|
||||
get => _coinFactsLink;
|
||||
set => this.RaiseAndSetIfChanged(ref _coinFactsLink, value);
|
||||
}
|
||||
|
||||
private string _coinFactsLink;
|
||||
|
||||
public string MajorVariety
|
||||
{
|
||||
public string MajorVariety {
|
||||
get => _majorVariety;
|
||||
set => this.RaiseAndSetIfChanged(ref _majorVariety, value);
|
||||
}
|
||||
|
||||
private string _majorVariety;
|
||||
|
||||
public string MinorVariety
|
||||
{
|
||||
public string MinorVariety {
|
||||
get => _minorVariety;
|
||||
set => this.RaiseAndSetIfChanged(ref _minorVariety, value);
|
||||
}
|
||||
|
||||
private string _minorVariety;
|
||||
|
||||
public string DieVariety
|
||||
{
|
||||
public string DieVariety {
|
||||
get => _dieVariety;
|
||||
set => this.RaiseAndSetIfChanged(ref _dieVariety, value);
|
||||
}
|
||||
|
||||
private string _dieVariety;
|
||||
|
||||
public string SeriesName
|
||||
{
|
||||
public string SeriesName {
|
||||
get => _seriesName;
|
||||
set => this.RaiseAndSetIfChanged(ref _seriesName, value);
|
||||
}
|
||||
|
||||
private string _seriesName;
|
||||
|
||||
public string Category
|
||||
{
|
||||
public string Category {
|
||||
get => _category;
|
||||
set => this.RaiseAndSetIfChanged(ref _category, value);
|
||||
}
|
||||
|
||||
private string _category;
|
||||
|
||||
public string Designation
|
||||
{
|
||||
public string Designation {
|
||||
get => _designation;
|
||||
set => this.RaiseAndSetIfChanged(ref _designation, value);
|
||||
}
|
||||
|
||||
private string _designation;
|
||||
|
||||
public int CertificateNumber
|
||||
{
|
||||
public int CertificateNumber {
|
||||
get => _certificateNumber;
|
||||
set => this.RaiseAndSetIfChanged(ref _certificateNumber, value);
|
||||
}
|
||||
|
||||
private int _certificateNumber;
|
||||
|
||||
public int Quantity
|
||||
{
|
||||
public int Quantity {
|
||||
get => _quantity;
|
||||
set
|
||||
{
|
||||
set {
|
||||
TotalPrice = value * PriceGuideValue;
|
||||
this.RaiseAndSetIfChanged(ref _quantity, value);
|
||||
}
|
||||
@@ -127,29 +122,28 @@ public class Coin : ReactiveObject
|
||||
|
||||
private int _quantity;
|
||||
|
||||
public double TotalPrice
|
||||
{
|
||||
public double TotalPrice {
|
||||
get => _totalPrice;
|
||||
set => this.RaiseAndSetIfChanged(ref _totalPrice, value);
|
||||
}
|
||||
|
||||
private double _totalPrice;
|
||||
|
||||
public double PaidFor
|
||||
{
|
||||
public double PaidFor {
|
||||
get => _paidFor;
|
||||
set => this.RaiseAndSetIfChanged(ref _paidFor, value);
|
||||
}
|
||||
|
||||
private double _paidFor;
|
||||
|
||||
public string Notes
|
||||
{
|
||||
public string Notes {
|
||||
get => _notes;
|
||||
set => this.RaiseAndSetIfChanged(ref _notes, value);
|
||||
}
|
||||
|
||||
private string _notes;
|
||||
|
||||
public Coin()
|
||||
{
|
||||
|
||||
public Coin() {
|
||||
PCGSNo = "";
|
||||
Name = "";
|
||||
Year = 0;
|
||||
@@ -168,7 +162,5 @@ public class Coin : ReactiveObject
|
||||
Quantity = 0;
|
||||
PaidFor = 0;
|
||||
Notes = "";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+69
-68
@@ -1,85 +1,86 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
<AvaloniaResource Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**"/>
|
||||
<AvaloniaResource Remove="obj\**"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.2" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.0.2" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.2" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.2" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.2" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.2"/>
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.0.2"/>
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.2"/>
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.2"/>
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.2"/>
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.2"/>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
|
||||
<PackageReference Include="System.Data.SQLite" Version="1.0.118"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="obj\Debug\net6.0\apphost.exe" />
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\original.dll" />
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\original.pdb" />
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\original.ref.dll" />
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\references" />
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\resources" />
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\Resources.Inputs.cache" />
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.AssemblyInfoInputs.cache" />
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.assets.cache" />
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.csproj.AssemblyReference.cache" />
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.csproj.CopyComplete" />
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.csproj.CoreCompileInputs.cache" />
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.csproj.FileListAbsolute.txt" />
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.dll" />
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.GeneratedMSBuildEditorConfig.editorconfig" />
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.genruntimeconfig.cache" />
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.pdb" />
|
||||
<Content Include="obj\Debug\net6.0\refint\PcgsInvUi.dll" />
|
||||
<Content Include="obj\Debug\net6.0\ref\PcgsInvUi.dll" />
|
||||
<Content Include="obj\PcgsInvUi.csproj.nuget.dgspec.json" />
|
||||
<Content Include="obj\PcgsInvUi.csproj.nuget.g.props" />
|
||||
<Content Include="obj\PcgsInvUi.csproj.nuget.g.targets" />
|
||||
<Content Include="obj\project.assets.json" />
|
||||
<Content Include="obj\project.nuget.cache" />
|
||||
<Content Include="obj\project.packagespec.json" />
|
||||
<Content Include="obj\rider.project.model.nuget.info" />
|
||||
<Content Include="obj\rider.project.restore.info" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="obj\Debug\net6.0\apphost.exe"/>
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\original.dll"/>
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\original.pdb"/>
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\original.ref.dll"/>
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\references"/>
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\resources"/>
|
||||
<Content Include="obj\Debug\net6.0\Avalonia\Resources.Inputs.cache"/>
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.AssemblyInfoInputs.cache"/>
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.assets.cache"/>
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.csproj.AssemblyReference.cache"/>
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.csproj.CopyComplete"/>
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.csproj.CoreCompileInputs.cache"/>
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.csproj.FileListAbsolute.txt"/>
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.dll"/>
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.GeneratedMSBuildEditorConfig.editorconfig"/>
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.genruntimeconfig.cache"/>
|
||||
<Content Include="obj\Debug\net6.0\PcgsInvUi.pdb"/>
|
||||
<Content Include="obj\Debug\net6.0\refint\PcgsInvUi.dll"/>
|
||||
<Content Include="obj\Debug\net6.0\ref\PcgsInvUi.dll"/>
|
||||
<Content Include="obj\PcgsInvUi.csproj.nuget.dgspec.json"/>
|
||||
<Content Include="obj\PcgsInvUi.csproj.nuget.g.props"/>
|
||||
<Content Include="obj\PcgsInvUi.csproj.nuget.g.targets"/>
|
||||
<Content Include="obj\project.assets.json"/>
|
||||
<Content Include="obj\project.nuget.cache"/>
|
||||
<Content Include="obj\project.packagespec.json"/>
|
||||
<Content Include="obj\rider.project.model.nuget.info"/>
|
||||
<Content Include="obj\rider.project.restore.info"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="obj\Debug\net6.0\.NETCoreApp,Version=v6.0.AssemblyAttributes.cs" />
|
||||
<Compile Include="obj\Debug\net6.0\PcgsInvUi.AssemblyInfo.cs" />
|
||||
<Compile Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="obj\Debug\net6.0\.NETCoreApp,Version=v6.0.AssemblyAttributes.cs"/>
|
||||
<Compile Include="obj\Debug\net6.0\PcgsInvUi.AssemblyInfo.cs"/>
|
||||
<Compile Remove="obj\**"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaXaml Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AvaloniaXaml Remove="obj\**"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="obj\**"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Remove="obj\**"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="obj\**"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -4,8 +4,7 @@ using System;
|
||||
|
||||
namespace PcgsInvUi;
|
||||
|
||||
class Program
|
||||
{
|
||||
class Program {
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
@@ -20,4 +19,4 @@ class Program
|
||||
.WithInterFont()
|
||||
.LogToTrace()
|
||||
.UseReactiveUI();
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,8 @@ using PcgsInvUi.Models;
|
||||
|
||||
namespace PcgsInvUi.Services;
|
||||
|
||||
public class CoinCollection
|
||||
{
|
||||
public IEnumerable<Coin> GetItems() => new[]
|
||||
{
|
||||
public class CoinCollection {
|
||||
public IEnumerable<Coin> GetItems() => new[] {
|
||||
new Coin(),
|
||||
new Coin(),
|
||||
new Coin(),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
namespace PcgsInvUi.Services;
|
||||
|
||||
public class Database
|
||||
{
|
||||
// TODO Create a database using SQLite.
|
||||
public class Database {
|
||||
public Database() { }
|
||||
}
|
||||
@@ -4,31 +4,26 @@ using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
// using Newtonsoft.Json;
|
||||
using PcgsInvUi.Models;
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace PcgsInvUi.Services;
|
||||
|
||||
public class PcgsClient
|
||||
{
|
||||
public class PcgsClient {
|
||||
private string _apiUri = "https://api.pcgs.com/publicapi";
|
||||
private readonly string _apiKey;
|
||||
|
||||
public PcgsClient(string apiKey)
|
||||
{
|
||||
public PcgsClient(string apiKey) {
|
||||
// _apiKey = apiKey;
|
||||
_apiKey =
|
||||
"E8xivTVN_k4Q8ubk8Xv_uU11U91WX0wDht4S4m4BAf2HPmKnGrZ0J2f9nccM7Ns1VkGoT1SXYR74I7aNaMKqXlJGEy3oobseKV0nGiqu1IKvFkOTVjhV37SWUVExSDFMC6FLzs7xJQIHwkcxr5JFOQNmc4ZytEh_-hmCN3NL-z0fEk98tzBmPJ_F7bq_xNru86QMD2A9yalu_dWe-lCysfyE2bCA2EDqwvWenRYf-0XnNtp6qlxxCMlCd-TDqqRKLC3qefCwpXSemwBiNSP5gbC9pwcKrZugkruuJ0nyxxThZymm";
|
||||
}
|
||||
|
||||
public async Task<Coin> GetCoinFactsByGrade(int pcgsNumber, string grade, bool plusGrade = false)
|
||||
{
|
||||
public async Task<Coin> GetCoinFactsByGrade(int pcgsNumber, string grade, bool plusGrade = false) {
|
||||
Coin newCoin = null;
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
using (HttpClient client = new HttpClient()) {
|
||||
var gradeParam = GetGradeFromString(grade);
|
||||
|
||||
|
||||
string requestUri =
|
||||
$"{_apiUri}/coindetail/GetCoinFactsByGrade/?PCGSNo={pcgsNumber}&GradeNo={gradeParam}&PlusGrade={plusGrade}";
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", _apiKey);
|
||||
@@ -36,14 +31,12 @@ public class PcgsClient
|
||||
HttpResponseMessage response = await client.GetAsync(requestUri);
|
||||
Console.WriteLine("Got response.");
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
if (response.IsSuccessStatusCode) {
|
||||
string jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
newCoin = ParseJsonResponse(jsonResponse);
|
||||
Console.WriteLine("Coin created.");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
Console.WriteLine($"Error: {response.StatusCode} - {response.ReasonPhrase}");
|
||||
}
|
||||
}
|
||||
@@ -51,24 +44,22 @@ public class PcgsClient
|
||||
return newCoin;
|
||||
}
|
||||
|
||||
private int GetGradeFromString(string grade)
|
||||
{
|
||||
private int GetGradeFromString(string grade) {
|
||||
var actualGrade = int.Parse(grade.Substring(grade.Length - 2));
|
||||
Console.WriteLine($"Grade is {actualGrade}");
|
||||
return actualGrade;
|
||||
}
|
||||
|
||||
|
||||
// TODO Will eventually create the other methods that are included in the Public API.
|
||||
|
||||
private Coin ParseJsonResponse(string json)
|
||||
{
|
||||
|
||||
private Coin ParseJsonResponse(string json) {
|
||||
Console.WriteLine(json);
|
||||
Coin newCoin = JsonSerializer.Deserialize<Coin>(json);
|
||||
Console.WriteLine($"New Coin has pcgs number {newCoin.PCGSNo}");
|
||||
|
||||
string test = JsonSerializer.Serialize(newCoin);
|
||||
Console.WriteLine(test);
|
||||
|
||||
|
||||
return newCoin;
|
||||
}
|
||||
}
|
||||
@@ -5,23 +5,19 @@ using PcgsInvUi.ViewModels;
|
||||
|
||||
namespace PcgsInvUi;
|
||||
|
||||
public class ViewLocator : IDataTemplate
|
||||
{
|
||||
public Control Build(object data)
|
||||
{
|
||||
public class ViewLocator : IDataTemplate {
|
||||
public Control Build(object data) {
|
||||
var name = data.GetType().FullName!.Replace("ViewModel", "View");
|
||||
var type = Type.GetType(name);
|
||||
|
||||
if (type != null)
|
||||
{
|
||||
if (type != null) {
|
||||
return (Control)Activator.CreateInstance(type)!;
|
||||
}
|
||||
|
||||
|
||||
return new TextBlock { Text = "Not Found: " + name };
|
||||
}
|
||||
|
||||
public bool Match(object data)
|
||||
{
|
||||
public bool Match(object data) {
|
||||
return data is ViewModelBase;
|
||||
}
|
||||
}
|
||||
@@ -5,19 +5,18 @@ using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
|
||||
public class CoinListViewModel : ViewModelBase
|
||||
{
|
||||
public class CoinListViewModel : ViewModelBase {
|
||||
public ObservableCollection<Coin> CoinCollection { get; set; }
|
||||
private float _totalValue;
|
||||
public float TotalValue
|
||||
{
|
||||
|
||||
public float TotalValue {
|
||||
get => _totalValue;
|
||||
set => this.RaiseAndSetIfChanged(ref _totalValue, value);
|
||||
}
|
||||
|
||||
public Coin? SelectedCoin { get; set; }
|
||||
|
||||
public CoinListViewModel(IEnumerable<Coin> items)
|
||||
{
|
||||
|
||||
public CoinListViewModel(IEnumerable<Coin> items) {
|
||||
CoinCollection = new ObservableCollection<Coin>(items);
|
||||
TotalValue = 0;
|
||||
}
|
||||
|
||||
@@ -4,14 +4,12 @@ using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
|
||||
public class DeleteWindowViewModel : ViewModelBase
|
||||
{
|
||||
public class DeleteWindowViewModel : ViewModelBase {
|
||||
public ReactiveCommand<Unit, object> OkCommand { get; }
|
||||
public ReactiveCommand<DeleteWindow, Unit> CancelCommand { get; }
|
||||
|
||||
public DeleteWindowViewModel()
|
||||
{
|
||||
OkCommand = ReactiveCommand.Create(() => (object)true);
|
||||
public DeleteWindowViewModel() {
|
||||
OkCommand = ReactiveCommand.Create(() => (object)true);
|
||||
CancelCommand = ReactiveCommand.Create<DeleteWindow>(window => window.Close());
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,12 @@ using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
|
||||
public class EditViewModel : ViewModelBase
|
||||
{
|
||||
public class EditViewModel : ViewModelBase {
|
||||
public Coin CurrentCoin { get; set; }
|
||||
|
||||
|
||||
public ReactiveCommand<Unit, Unit> OkCommand { get; }
|
||||
|
||||
public EditViewModel(Coin coin)
|
||||
{
|
||||
public EditViewModel(Coin coin) {
|
||||
CurrentCoin = coin;
|
||||
|
||||
var okEnabled = this.WhenAnyValue(
|
||||
@@ -23,7 +21,7 @@ public class EditViewModel : ViewModelBase
|
||||
!string.IsNullOrWhiteSpace(grade) &&
|
||||
(quantity != 0)
|
||||
);
|
||||
|
||||
|
||||
// Setup OkCommand - all Coin-related properties must be non-whitespace.
|
||||
OkCommand = ReactiveCommand.Create(() => { });
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
|
||||
public class FindWindowViewModel : ViewModelBase
|
||||
{
|
||||
public class FindWindowViewModel : ViewModelBase {
|
||||
public ReactiveCommand<Unit, object> OkCommand { get; } = ReactiveCommand.Create(() => (object)1);
|
||||
}
|
||||
@@ -19,80 +19,78 @@ namespace PcgsInvUi.ViewModels;
|
||||
// TODO API request tracker (1000 per day)
|
||||
// TODO API update schedules (per month? manual override? needs to store a date of last update in the coin object)
|
||||
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
public ViewModelBase SidebarContent
|
||||
{
|
||||
public class MainWindowViewModel : ViewModelBase {
|
||||
public ViewModelBase SidebarContent {
|
||||
get => _sideContent;
|
||||
private set => this.RaiseAndSetIfChanged(ref _sideContent, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<Coin> CoinCollection { get; set; }
|
||||
public ObservableCollection<Coin> DisplayedList { get; set; }
|
||||
public Coin? SelectedCoin
|
||||
{
|
||||
|
||||
public Coin? SelectedCoin {
|
||||
get => _selectedCoin;
|
||||
set => this.RaiseAndSetIfChanged(ref _selectedCoin, value);
|
||||
}
|
||||
public double TotalValue
|
||||
{
|
||||
|
||||
public double TotalValue {
|
||||
get => _totalValue;
|
||||
set => this.RaiseAndSetIfChanged(ref _totalValue, value);
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Unit> DeleteCommand { get; }
|
||||
public Interaction<DeleteWindowViewModel, Boolean> ShowDeleteWindow { get; }
|
||||
public ReactiveCommand<Unit, Coin> FindCommand { get; }
|
||||
public Interaction<FindWindowViewModel, int> ShowFindWindow { get; }
|
||||
|
||||
|
||||
private ViewModelBase _sideContent;
|
||||
private Coin? _selectedCoin;
|
||||
private double _totalValue;
|
||||
private PcgsClient _pcgsClient;
|
||||
|
||||
public MainWindowViewModel(CoinCollection coins)
|
||||
{
|
||||
public MainWindowViewModel(CoinCollection coins) {
|
||||
var newViewModel = new NewViewModel();
|
||||
_sideContent = newViewModel;
|
||||
DisplayedList = CoinCollection = new ObservableCollection<Coin>(coins.GetItems());
|
||||
_pcgsClient = new PcgsClient("eAb8gS0I2XAvT_5gJeiGJaglMia1Tk-oB4kJUK6kuafyrny_S61vIJY-Ikl4nCQM67wrdxzUqLVWTV2kBSxD3d5XNBHxHnYBhcSS6dOPug0hZaF3qAv56df3gYSzOGh9Tif5y0eP3Iw0LrqKDr1Hj-dk6SV6GKog2IIqCPQhhHH8FMTWBTYO-_O8cx7qLdM5GM8KlTsic6g3VRUhM8EA_4OO04dCfmNLGhqINRl3jGZ0Q4ziI8fng2bVWsIyteqiPzUn10rIQ3-OPpqVZG_DxeOmOejj4GzbUNyqUOajy-nr5rYY");
|
||||
|
||||
_pcgsClient = new PcgsClient(
|
||||
"eAb8gS0I2XAvT_5gJeiGJaglMia1Tk-oB4kJUK6kuafyrny_S61vIJY-Ikl4nCQM67wrdxzUqLVWTV2kBSxD3d5XNBHxHnYBhcSS6dOPug0hZaF3qAv56df3gYSzOGh9Tif5y0eP3Iw0LrqKDr1Hj-dk6SV6GKog2IIqCPQhhHH8FMTWBTYO-_O8cx7qLdM5GM8KlTsic6g3VRUhM8EA_4OO04dCfmNLGhqINRl3jGZ0Q4ziI8fng2bVWsIyteqiPzUn10rIQ3-OPpqVZG_DxeOmOejj4GzbUNyqUOajy-nr5rYY");
|
||||
|
||||
// Set up the ability to open the delete window.
|
||||
ShowDeleteWindow = new Interaction<DeleteWindowViewModel, bool>();
|
||||
var deleteEnabled = this.WhenAnyValue(x => x.SelectedCoin)
|
||||
.Select(x => x != null);
|
||||
DeleteCommand = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
DeleteCommand = ReactiveCommand.CreateFromTask(async () => {
|
||||
var deleteViewModel = new DeleteWindowViewModel();
|
||||
var result = await ShowDeleteWindow.Handle(deleteViewModel);
|
||||
if (result) CoinCollection.Remove(SelectedCoin); // possible null deref - ignored due to button being disabled.
|
||||
if (result)
|
||||
CoinCollection.Remove(SelectedCoin); // possible null deref - ignored due to button being disabled.
|
||||
}, deleteEnabled);
|
||||
|
||||
// Set up the ability to open the find window.
|
||||
ShowFindWindow = new Interaction<FindWindowViewModel, int>();
|
||||
var findEnabled = this.WhenAnyValue(x => x.CoinCollection.Count,
|
||||
x => x > 0);
|
||||
FindCommand = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
FindCommand = ReactiveCommand.CreateFromTask(async () => {
|
||||
var findViewModel = new FindWindowViewModel();
|
||||
var result = await ShowFindWindow.Handle(findViewModel);
|
||||
// Find the coin with the matching ID. The issue is that there could be multiple - so we need to return a list.
|
||||
// Perhaps a secondary viewmodel?
|
||||
return new Coin();
|
||||
}, findEnabled);
|
||||
|
||||
|
||||
// Subscribe to SidebarContent.OkCommand, which is an IObservable<(int, string, int)>
|
||||
// This is the same as the above, but with a different syntax.
|
||||
newViewModel.OkCommand
|
||||
.Subscribe(async requestStructure =>
|
||||
{
|
||||
.Subscribe(async requestStructure => {
|
||||
var newCoin = await _pcgsClient.GetCoinFactsByGrade(requestStructure.Item1, requestStructure.Item2);
|
||||
newCoin.Quantity = requestStructure.Item3;
|
||||
CoinCollection.Add(newCoin);
|
||||
TotalValue += newCoin.Quantity * newCoin.PriceGuideValue;
|
||||
});
|
||||
|
||||
|
||||
// Change TotalValue anytime SelectedCoin.TotalPrice changes.
|
||||
// Possible null deref - ignored due to null values summing to 0.
|
||||
this.WhenAnyValue(x => x.SelectedCoin.TotalPrice)
|
||||
.Subscribe(_ => TotalValue = CoinCollection.Sum(x => x.TotalPrice) );
|
||||
.Subscribe(_ => TotalValue = CoinCollection.Sum(x => x.TotalPrice));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,31 +4,29 @@ using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
|
||||
public class NewViewModel : ViewModelBase
|
||||
{
|
||||
public class NewViewModel : ViewModelBase {
|
||||
private string _pcgsNumber = "";
|
||||
private string _grade = "";
|
||||
private string _quantity = "";
|
||||
|
||||
public string PcgsNumber
|
||||
{
|
||||
|
||||
public string PcgsNumber {
|
||||
get => _pcgsNumber;
|
||||
set => this.RaiseAndSetIfChanged(ref _pcgsNumber, value);
|
||||
}
|
||||
public string Grade
|
||||
{
|
||||
|
||||
public string Grade {
|
||||
get => _grade;
|
||||
set => this.RaiseAndSetIfChanged(ref _grade, value);
|
||||
}
|
||||
public string Quantity
|
||||
{
|
||||
|
||||
public string Quantity {
|
||||
get => _quantity;
|
||||
set => this.RaiseAndSetIfChanged(ref _quantity, value);
|
||||
}
|
||||
|
||||
public List<string> GradesList { get; }
|
||||
|
||||
public NewViewModel()
|
||||
{
|
||||
public NewViewModel() {
|
||||
var okEnabled = this.WhenAnyValue(
|
||||
x => x.PcgsNumber,
|
||||
x => x.Grade,
|
||||
@@ -40,9 +38,8 @@ public class NewViewModel : ViewModelBase
|
||||
OkCommand = ReactiveCommand.Create(
|
||||
() => (int.Parse(PcgsNumber), Grade, int.Parse(Quantity)),
|
||||
okEnabled);
|
||||
|
||||
ClearCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
|
||||
ClearCommand = ReactiveCommand.Create(() => {
|
||||
PcgsNumber = "";
|
||||
Grade = "";
|
||||
Quantity = "";
|
||||
@@ -50,8 +47,7 @@ public class NewViewModel : ViewModelBase
|
||||
|
||||
// Initialize grade values for use in the view.
|
||||
// This must be typed out manually, as there is no way to get a list of grades from the API.
|
||||
GradesList = new List<string>
|
||||
{
|
||||
GradesList = new List<string> {
|
||||
"P-01",
|
||||
"FR-02",
|
||||
"AG-03",
|
||||
@@ -84,8 +80,7 @@ public class NewViewModel : ViewModelBase
|
||||
"MS-70"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public ReactiveCommand<Unit, (int, string, int)> OkCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ClearCommand { get; }
|
||||
|
||||
}
|
||||
@@ -2,6 +2,4 @@
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
|
||||
public class ViewModelBase : ReactiveObject
|
||||
{
|
||||
}
|
||||
public class ViewModelBase : ReactiveObject { }
|
||||
@@ -7,18 +7,18 @@
|
||||
Width="325" Height="100" WindowStartupLocation="CenterOwner"
|
||||
Title="DeleteWindow">
|
||||
<Grid ColumnDefinitions="*, *" RowDefinitions="*, *">
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="10"
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="10"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Content="Are you sure you want to delete this item?"/>
|
||||
<Button Grid.Row="1" Grid.Column="0" Margin="5"
|
||||
Content="Are you sure you want to delete this item?" />
|
||||
<Button Grid.Row="1" Grid.Column="0" Margin="5"
|
||||
Width="100"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Content="Yes" Command="{Binding OkCommand}"/>
|
||||
Content="Yes" Command="{Binding OkCommand}" />
|
||||
<Button Grid.Row="1" Grid.Column="1" Margin="5"
|
||||
Width="100"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Content="No" Command="{Binding CancelCommand}"/>
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Content="No" Command="{Binding CancelCommand}" />
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -5,10 +5,8 @@ using System;
|
||||
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class DeleteWindow : ReactiveWindow<DeleteWindowViewModel>
|
||||
{
|
||||
public DeleteWindow()
|
||||
{
|
||||
public partial class DeleteWindow : ReactiveWindow<DeleteWindowViewModel> {
|
||||
public DeleteWindow() {
|
||||
InitializeComponent();
|
||||
this.WhenActivated(d => d(ViewModel!.OkCommand.Subscribe(Close)));
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
x:Class="PcgsInvUi.Views.FindWindow"
|
||||
Title="FindWindow">
|
||||
<Grid ColumnDefinitions="Auto, *" RowDefinitions="*, *">
|
||||
<Label Content="PCGS #:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="5"/>
|
||||
<Label Content="PCGS #:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5" />
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="5" />
|
||||
<Button Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="Find"
|
||||
HorizontalAlignment="Center" Margin="5" Width="75"/>
|
||||
HorizontalAlignment="Center" Margin="5" Width="75" />
|
||||
</Grid>
|
||||
</Window>
|
||||
</Window>
|
||||
@@ -5,10 +5,8 @@ using System;
|
||||
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class FindWindow : ReactiveWindow<FindWindowViewModel>
|
||||
{
|
||||
public FindWindow()
|
||||
{
|
||||
public partial class FindWindow : ReactiveWindow<FindWindowViewModel> {
|
||||
public FindWindow() {
|
||||
InitializeComponent();
|
||||
this.WhenActivated(d => d(ViewModel!.OkCommand.Subscribe(Close)));
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<SplitView IsPaneOpen="True"
|
||||
DisplayMode="Inline"
|
||||
PanePlacement="Right" >
|
||||
PanePlacement="Right">
|
||||
<SplitView.Pane>
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
<UserControl Grid.Row="0" Margin="10, 20, 10, 10" VerticalAlignment="Center" Content="{Binding SidebarContent}"/>
|
||||
<TextBox Grid.Row="1" Margin="5" Watermark="Notes..."/>
|
||||
<UserControl Grid.Row="0" Margin="10, 20, 10, 10" VerticalAlignment="Center"
|
||||
Content="{Binding SidebarContent}" />
|
||||
<TextBox Grid.Row="1" Margin="5" Watermark="Notes..." />
|
||||
</Grid>
|
||||
</SplitView.Pane>
|
||||
<Grid RowDefinitions="*, Auto" ShowGridLines="False">
|
||||
@@ -26,51 +27,56 @@
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Series" Width="*"
|
||||
Binding="{Binding SeriesName}"
|
||||
IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Year"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Year"
|
||||
Binding="{Binding Year}"
|
||||
IsReadOnly="True"/>
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Mint" Width="*"
|
||||
Binding="{Binding MintMark}"
|
||||
IsReadOnly="True"/>
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Denomination" Width="*"
|
||||
Binding="{Binding Denomination}"
|
||||
IsReadOnly="True"/>
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Variety" Width="*"
|
||||
Binding="{Binding MajorVariety}"
|
||||
IsReadOnly="True"/>
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Grade" Width="*"
|
||||
Binding="{Binding Grade}"
|
||||
IsReadOnly="True"/>
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Designation" Width="*"
|
||||
Binding="{Binding Designation}"
|
||||
IsReadOnly="True"/>
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Est. Price" Width="*"
|
||||
Binding="{Binding PriceGuideValue}"
|
||||
IsReadOnly="False"/>
|
||||
Binding="{Binding PriceGuideValue}"
|
||||
IsReadOnly="False" />
|
||||
<DataGridTextColumn Header="PCGS #" Width="*"
|
||||
Binding="{Binding PCGSNo}"
|
||||
IsReadOnly="True"/>
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Quantity" Width="*"
|
||||
Binding="{Binding Quantity}"
|
||||
IsReadOnly="False"/>
|
||||
Binding="{Binding Quantity}"
|
||||
IsReadOnly="False" />
|
||||
<DataGridTextColumn Header="Total Price" Width="*"
|
||||
Binding="{Binding TotalPrice, StringFormat='${0:0.00}'}"
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<DockPanel Grid.Row="1">
|
||||
<Grid HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" ColumnDefinitions="Auto, Auto" DockPanel.Dock="Left">
|
||||
<Button Grid.Column="0" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Delete"
|
||||
Command="{Binding DeleteCommand}"/>
|
||||
<Button Grid.Column="1" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Find..."
|
||||
Command="{Binding FindCommand}"/>
|
||||
<Grid HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" ColumnDefinitions="Auto, Auto"
|
||||
DockPanel.Dock="Left">
|
||||
<Button Grid.Column="0" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Delete"
|
||||
Command="{Binding DeleteCommand}" />
|
||||
<Button Grid.Column="1" Margin="5" Width="100" HorizontalContentAlignment="Center"
|
||||
Content="Find..."
|
||||
Command="{Binding FindCommand}" />
|
||||
</Grid>
|
||||
<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" ColumnDefinitions="Auto, Auto" DockPanel.Dock="Right">
|
||||
<Label Grid.Column="0" Margin="5" VerticalAlignment="Center" Content="{Binding TotalValue, StringFormat='Total Value: ${0:0.00}'}" />
|
||||
<Button Grid.Column="1" Margin="5" Width="150" HorizontalContentAlignment="Center" Content="Export to CSV..." />
|
||||
<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" ColumnDefinitions="Auto, Auto"
|
||||
DockPanel.Dock="Right">
|
||||
<Label Grid.Column="0" Margin="5" VerticalAlignment="Center"
|
||||
Content="{Binding TotalValue, StringFormat='Total Value: ${0:0.00}'}" />
|
||||
<Button Grid.Column="1" Margin="5" Width="150" HorizontalContentAlignment="Center"
|
||||
Content="Export to CSV..." />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</SplitView>
|
||||
</Window>
|
||||
</Window>
|
||||
@@ -6,26 +6,22 @@ using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
public partial class MainWindow : ReactiveWindow<MainWindowViewModel> {
|
||||
public MainWindow() {
|
||||
InitializeComponent();
|
||||
this.WhenActivated(d => d(ViewModel!.ShowDeleteWindow.RegisterHandler(ShowDeleteWindowAsync)));
|
||||
this.WhenActivated(d => d(ViewModel!.ShowFindWindow.RegisterHandler(ShowFindWindowAsync)));
|
||||
}
|
||||
|
||||
public async Task ShowDeleteWindowAsync(InteractionContext<DeleteWindowViewModel, Boolean> interaction)
|
||||
{
|
||||
public async Task ShowDeleteWindowAsync(InteractionContext<DeleteWindowViewModel, Boolean> interaction) {
|
||||
var window = new DeleteWindow();
|
||||
window.DataContext = interaction.Input;
|
||||
|
||||
var result = await window.ShowDialog<bool>(this);
|
||||
interaction.SetOutput(result);
|
||||
}
|
||||
|
||||
public async Task ShowFindWindowAsync(InteractionContext<FindWindowViewModel, int> interaction)
|
||||
{
|
||||
|
||||
public async Task ShowFindWindowAsync(InteractionContext<FindWindowViewModel, int> interaction) {
|
||||
var window = new FindWindow();
|
||||
window.DataContext = interaction.Input;
|
||||
|
||||
|
||||
@@ -7,19 +7,20 @@
|
||||
x:Class="PcgsInvUi.Views.NewView" x:DataType="viewmodels:NewViewModel">
|
||||
<DockPanel>
|
||||
<Grid DockPanel.Dock="Top" ColumnDefinitions="Auto, *" RowDefinitions="*, *, *">
|
||||
<Label Grid.Column="0" Grid.Row="0" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="PCGS #:"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Margin="5, 5, 10, 5" Text="{Binding PcgsNumber}"/>
|
||||
<Label Grid.Column="0" Grid.Row="1" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="Grade:"/>
|
||||
<ComboBox Name="GradeChoices" Grid.Column="1" Grid.Row="1" SelectedIndex="0" Margin="5, 5, 10, 5" Width="150"
|
||||
ItemsSource="{Binding GradesList}" SelectedItem="{Binding Grade}"/>
|
||||
<Label Grid.Column="0" Grid.Row="2" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="Quantity:"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Margin="5, 5, 10, 5" Text="{Binding Quantity}"/>
|
||||
<Label Grid.Column="0" Grid.Row="0" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="PCGS #:" />
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Margin="5, 5, 10, 5" Text="{Binding PcgsNumber}" />
|
||||
<Label Grid.Column="0" Grid.Row="1" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="Grade:" />
|
||||
<ComboBox Name="GradeChoices" Grid.Column="1" Grid.Row="1" SelectedIndex="0" Margin="5, 5, 10, 5"
|
||||
Width="150"
|
||||
ItemsSource="{Binding GradesList}" SelectedItem="{Binding Grade}" />
|
||||
<Label Grid.Column="0" Grid.Row="2" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="Quantity:" />
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Margin="5, 5, 10, 5" Text="{Binding Quantity}" />
|
||||
</Grid>
|
||||
<Grid DockPanel.Dock="Bottom" ColumnDefinitions="*, *">
|
||||
<Button Grid.Column="0" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Width="90" HorizontalContentAlignment="Center" Content="OK" Command="{Binding OkCommand}"/>
|
||||
<Button Grid.Column="1" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
<Button Grid.Column="0" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Width="90" HorizontalContentAlignment="Center" Content="OK" Command="{Binding OkCommand}" />
|
||||
<Button Grid.Column="1" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Width="90" HorizontalContentAlignment="Center" Content="Clear" Command="{Binding ClearCommand}" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
</UserControl>
|
||||
@@ -4,10 +4,8 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class NewView : UserControl
|
||||
{
|
||||
public NewView()
|
||||
{
|
||||
public partial class NewView : UserControl {
|
||||
public NewView() {
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
+13
-13
@@ -1,18 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<!-- This manifest is used on Windows only.
|
||||
Don't remove it as it might cause problems with window transparency and embeded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="PcgsInvUi.Desktop"/>
|
||||
<!-- This manifest is used on Windows only.
|
||||
Don't remove it as it might cause problems with window transparency and embeded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="PcgsInvUi.Desktop"/>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
Reference in new issue
Block a user