Initial commit
This commit is contained in:
commit
8c7e1b917f
180 files changed
+7747
No files matched your search
Generated
+13
@@ -0,0 +1,13 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/.idea.pcgs-inv.iml
|
||||
/contentModel.xml
|
||||
/modules.xml
|
||||
/projectSettingsUpdater.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
Generated
+16
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AvaloniaProject">
|
||||
<option name="projectPerEditor">
|
||||
<map>
|
||||
<entry key="PcgsInvUi/App.axaml" value="PcgsInvUi/PcgsInvUi.csproj" />
|
||||
<entry key="PcgsInvUi/Views/CoinListView.axaml" value="PcgsInvUi/PcgsInvUi.csproj" />
|
||||
<entry key="PcgsInvUi/Views/DeleteWindow.axaml" value="PcgsInvUi/PcgsInvUi.csproj" />
|
||||
<entry key="PcgsInvUi/Views/MainWindow.axaml" value="PcgsInvUi/PcgsInvUi.csproj" />
|
||||
<entry key="PcgsInvUi/Views/MainWindowOld.axaml" value="PcgsInvUi/PcgsInvUi.csproj" />
|
||||
<entry key="PcgsInvUi/Views/NewControl.axaml" value="PcgsInvUi/PcgsInvUi.csproj" />
|
||||
<entry key="PcgsInvUi/Views/NewView.axaml" value="PcgsInvUi/PcgsInvUi.csproj" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="PROJECT_FILES" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="PcgsInvUi.App"
|
||||
xmlns:local="using:PcgsInvUi"
|
||||
RequestedThemeVariant="Dark">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator/>
|
||||
</Application.DataTemplates>
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml" />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -0,0 +1,32 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using PcgsInvUi.ViewModels;
|
||||
using PcgsInvUi.Views;
|
||||
|
||||
namespace PcgsInvUi;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
var coins = new Services.CoinCollection();
|
||||
|
||||
desktop.MainWindow = new MainWindow
|
||||
{
|
||||
DataContext = new MainWindowViewModel(coins),
|
||||
};
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace PcgsInvUi.Models;
|
||||
|
||||
public class Coin
|
||||
{
|
||||
public int PcgsNumber { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Year { get; set; }
|
||||
public string Denomination { get; set; }
|
||||
public string MintMark { get; set; }
|
||||
public string Grade { get; set; }
|
||||
public double PriceGuideValue { get; set; }
|
||||
public string CoinFactsLink { get; set; }
|
||||
public string MajorVariety { get; set; }
|
||||
public string MinorVariety { get; set; }
|
||||
public string DieVariety { get; set; }
|
||||
public string Series { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string Designation { get; set; }
|
||||
public int CertificateNumber { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
public double TotalPrice => Quantity * PriceGuideValue;
|
||||
public double PaidFor { get; set; }
|
||||
public String Notes { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<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>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
</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>
|
||||
</Project>
|
||||
@@ -0,0 +1,23 @@
|
||||
using Avalonia;
|
||||
using Avalonia.ReactiveUI;
|
||||
using System;
|
||||
|
||||
namespace PcgsInvUi;
|
||||
|
||||
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.
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.WithInterFont()
|
||||
.LogToTrace()
|
||||
.UseReactiveUI();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using PcgsInvUi.Models;
|
||||
|
||||
namespace PcgsInvUi.Services;
|
||||
|
||||
public class CoinCollection
|
||||
{
|
||||
public IEnumerable<Coin> GetItems() => new[]
|
||||
{
|
||||
new Coin(),
|
||||
new Coin(),
|
||||
new Coin(),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace PcgsInvUi.Services;
|
||||
|
||||
public class Database
|
||||
{
|
||||
// TODO Create a database using SQLite.
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using PcgsInvUi.Models;
|
||||
|
||||
namespace PcgsInvUi.Services;
|
||||
|
||||
public class PcgsClient
|
||||
{
|
||||
private string _apiUri = "https://api.pcgs.com/publicapi";
|
||||
private readonly string _apiKey;
|
||||
|
||||
public PcgsClient(string apiKey)
|
||||
{
|
||||
_apiKey = apiKey;
|
||||
}
|
||||
|
||||
public async Task<Coin> GetCoinFactsByGrade(int pcgsNumber, int grade, bool plusGrade)
|
||||
{
|
||||
Coin newCoin = null;
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
string requestUri =
|
||||
$"{_apiUri}/coindetail/GetCoinFactsByGrade/?PCGSNo={pcgsNumber}&GradeNo={grade}&PlusGrade={plusGrade}";
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", _apiKey);
|
||||
HttpResponseMessage response = await client.GetAsync(requestUri);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
newCoin = ParseJsonResponse(jsonResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Error: {response.StatusCode} - {response.ReasonPhrase}");
|
||||
}
|
||||
}
|
||||
|
||||
return newCoin;
|
||||
}
|
||||
|
||||
// TODO Will eventually create the other methods that are included in the Public API.
|
||||
|
||||
private Coin ParseJsonResponse(string json)
|
||||
{
|
||||
Coin newCoin = JsonConvert.DeserializeObject<Coin>(json);
|
||||
return newCoin;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using PcgsInvUi.ViewModels;
|
||||
|
||||
namespace PcgsInvUi;
|
||||
|
||||
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)
|
||||
{
|
||||
return (Control)Activator.CreateInstance(type)!;
|
||||
}
|
||||
|
||||
return new TextBlock { Text = "Not Found: " + name };
|
||||
}
|
||||
|
||||
public bool Match(object data)
|
||||
{
|
||||
return data is ViewModelBase;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using PcgsInvUi.Models;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
|
||||
public class CoinListViewModel : ViewModelBase
|
||||
{
|
||||
public ObservableCollection<Coin> CoinCollection { get; set; }
|
||||
private float _totalValue;
|
||||
public float TotalValue
|
||||
{
|
||||
get => _totalValue;
|
||||
set => this.RaiseAndSetIfChanged(ref _totalValue, value);
|
||||
}
|
||||
public Coin? SelectedCoin { get; set; }
|
||||
|
||||
public CoinListViewModel(IEnumerable<Coin> items)
|
||||
{
|
||||
CoinCollection = new ObservableCollection<Coin>(items);
|
||||
TotalValue = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Reactive.Linq;
|
||||
using PcgsInvUi.Models;
|
||||
using PcgsInvUi.Services;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
public CoinListViewModel List { get; }
|
||||
private ViewModelBase _content;
|
||||
|
||||
public MainWindowViewModel(CoinCollection coins)
|
||||
{
|
||||
List = new CoinListViewModel(coins.GetItems());
|
||||
Content = List;
|
||||
}
|
||||
|
||||
public ViewModelBase Content
|
||||
{
|
||||
get => _content;
|
||||
private set => this.RaiseAndSetIfChanged(ref _content, value);
|
||||
}
|
||||
|
||||
public void AddItem()
|
||||
{
|
||||
Console.WriteLine("You hit the button!");
|
||||
var newViewModel = new NewViewModel();
|
||||
|
||||
Observable.Merge(
|
||||
newViewModel.OkCommand,
|
||||
newViewModel.CancelCommand.Select(_ => (Coin?)null))
|
||||
.Take(1)
|
||||
.Subscribe(model =>
|
||||
{
|
||||
if (model != null)
|
||||
List.CoinCollection.Add(model);
|
||||
|
||||
Content = List;
|
||||
});
|
||||
|
||||
Content = newViewModel;
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using ReactiveUI;
|
||||
|
||||
namespace PcgsInvUi.ViewModels;
|
||||
|
||||
public class ViewModelBase : ReactiveObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:PcgsInvUi.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="PcgsInvUi.Views.CoinListView"
|
||||
x:DataType="viewModels:CoinListViewModel">
|
||||
<DockPanel>
|
||||
<DockPanel DockPanel.Dock="Top">
|
||||
<DataGrid x:Name="CollectionView"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
DockPanel.Dock="Top"
|
||||
ItemsSource="{Binding CoinCollection}"
|
||||
SelectedItem="{Binding SelectedCoin, Mode=TwoWay}"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserResizeColumns="True" >
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Series" Width="*"
|
||||
Binding="{Binding Series}"
|
||||
IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Year"
|
||||
Binding="{Binding Year}"
|
||||
IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Mint" Width="*"
|
||||
Binding="{Binding MintMark}"
|
||||
IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Denomination" Width="*"
|
||||
Binding="{Binding Denomination}"
|
||||
IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Variety" Width="*"
|
||||
Binding="{Binding MajorVariety}"
|
||||
IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Grade" Width="*"
|
||||
Binding="{Binding Grade}"
|
||||
IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Designation" Width="*"
|
||||
Binding="{Binding Designation}"
|
||||
IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Est. Price" Width="*"
|
||||
Binding="{Binding PriceGuideValue}"
|
||||
IsReadOnly="False"/>
|
||||
<DataGridTextColumn Header="PCGS #" Width="*"
|
||||
Binding="{Binding PcgsNumber}"
|
||||
IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Quantity" Width="*"
|
||||
Binding="{Binding Quantity}"
|
||||
IsReadOnly="False"/>
|
||||
<DataGridTextColumn Header="Total Price" Width="*"
|
||||
Binding="{Binding TotalPrice}"
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
<DockPanel DockPanel.Dock="Bottom">
|
||||
<Grid HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" ColumnDefinitions="Auto, Auto, Auto, Auto" DockPanel.Dock="Left">
|
||||
<Button Grid.Column="0" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="New..." />
|
||||
<Button Grid.Column="1" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Edit..." />
|
||||
<Button Grid.Column="2" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Delete" />
|
||||
<Button Grid.Column="3" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Find..."
|
||||
Command="{Binding $parent[Window].((viewModels:MainWindowViewModel)DataContext).AddItem}"/>
|
||||
</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>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class CoinListView : UserControl
|
||||
{
|
||||
public CoinListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignWidth="325" d:DesignHeight="100"
|
||||
x:Class="PcgsInvUi.Views.DeleteWindow"
|
||||
Width="325" Height="100" WindowStartupLocation="CenterOwner"
|
||||
Title="DeleteWindow">
|
||||
<Grid ColumnDefinitions="*, *" RowDefinitions="*, *">
|
||||
<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"
|
||||
Width="100"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Content="Yes" Click="AcceptClicked"/>
|
||||
<Button Grid.Row="1" Grid.Column="1" Margin="5"
|
||||
Width="100"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Content="No" Click="CancelClicked"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,27 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class DeleteWindow : Window
|
||||
{
|
||||
public bool Accepted { get; set; }
|
||||
|
||||
public DeleteWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Accepted = false;
|
||||
}
|
||||
|
||||
public void AcceptClicked(object source, RoutedEventArgs args)
|
||||
{
|
||||
// TODO Delete the SelectedCoin?
|
||||
Accepted = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
public void CancelClicked(object source, RoutedEventArgs args)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:PcgsInvUi.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="PcgsInvUi.Views.MainWindow" x:DataType="viewModels:MainWindowViewModel"
|
||||
Title="MainWindow"
|
||||
Content="{Binding Content}" />
|
||||
@@ -0,0 +1,28 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
// TODO New window.
|
||||
// TODO Edit window.
|
||||
// TODO Delete window.
|
||||
// TODO Find window.
|
||||
// TODO Export window.
|
||||
// TODO Error handling.
|
||||
// TODO Manual handling of API key.
|
||||
// TODO Use CoinFacts link.
|
||||
// TODO Export to CSV.
|
||||
// TODO Take giant sheet of coins to integrate into the application.
|
||||
// TODO Update all coins.
|
||||
// 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 MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewmodels="clr-namespace:PcgsInvUi.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="PcgsInvUi.Views.NewControl" 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" />
|
||||
<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" />
|
||||
<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" />
|
||||
</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"
|
||||
Width="90" HorizontalContentAlignment="Center" Content="Cancel" Command="{Binding CancelCommand}"/>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,64 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class NewControl : UserControl
|
||||
{
|
||||
public string SelectedGrade { get; set; } = "";
|
||||
|
||||
public void AcceptClick(object source, RoutedEventArgs args)
|
||||
{
|
||||
// TODO Send a message to the MainWindow to add a new coin and close the NewControl.
|
||||
}
|
||||
|
||||
public void CancelClick(object source, RoutedEventArgs args)
|
||||
{
|
||||
// TODO Send a message to the MainWindow to close the NewControl.
|
||||
}
|
||||
|
||||
public NewControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
GradeChoices.SelectedItem = SelectedGrade;
|
||||
// Had to type this out - there's no pattern to follow.
|
||||
GradeChoices.ItemsSource = new ObservableCollection<string>()
|
||||
{
|
||||
"PO01",
|
||||
"FR02",
|
||||
"AG03",
|
||||
"G04",
|
||||
"G06",
|
||||
"VG08",
|
||||
"VG10",
|
||||
"F12",
|
||||
"F15",
|
||||
"VF20",
|
||||
"VF25",
|
||||
"VF30",
|
||||
"VF35",
|
||||
"EF40",
|
||||
"EF45",
|
||||
"AU50",
|
||||
"AU53",
|
||||
"AU55",
|
||||
"AU58",
|
||||
"MS60",
|
||||
"MS61",
|
||||
"MS62",
|
||||
"MS63",
|
||||
"MS64",
|
||||
"MS65",
|
||||
"MS66",
|
||||
"MS67",
|
||||
"MS68",
|
||||
"MS69",
|
||||
"MS70"
|
||||
};
|
||||
}
|
||||
|
||||
public NewControl(object? context = null) : this()
|
||||
{
|
||||
DataContext = context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewmodels="clr-namespace:PcgsInvUi.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
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"
|
||||
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"
|
||||
Width="90" HorizontalContentAlignment="Center" Content="Cancel" Command="{Binding CancelCommand}" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class NewView : UserControl
|
||||
{
|
||||
public NewView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +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"/>
|
||||
|
||||
<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>
|
||||
</assembly>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net6.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "6.0.0"
|
||||
},
|
||||
"configProperties": {
|
||||
"System.Runtime.InteropServices.BuiltInComInterop.IsSupported": true
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loaded 100 of 180 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user