chore: commit missing files
This commit is contained in:
1 parent
3a819ce180
commit
51f1eb8c65
12 files changed
+277
No files matched your search
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ReactiveUI" Version="23.2.28" />
|
||||
<PackageReference Include="ReactiveUI.SourceGenerators" Version="3.1.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,15 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="PcgsInv.App"
|
||||
xmlns:local="using:PcgsInv"
|
||||
RequestedThemeVariant="Light">
|
||||
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator />
|
||||
</Application.DataTemplates>
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme/>
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -0,0 +1,22 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using PcgsInv.ViewModels;
|
||||
using PcgsInv.Views;
|
||||
|
||||
namespace PcgsInv;
|
||||
|
||||
public class App : Application {
|
||||
public override void Initialize() {
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted() {
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
desktop.MainWindow = new MainWindow {
|
||||
DataContext = new MainWindowViewModel()
|
||||
};
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
@@ -0,0 +1,39 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="12.0.4"/>
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="12.0.0" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="12.0.4"/>
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="12.0.4"/>
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="12.0.4"/>
|
||||
<PackageReference Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.2">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ReactiveUI" Version="23.2.28" />
|
||||
<PackageReference Include="ReactiveUI.Avalonia" Version="12.0.3" />
|
||||
<PackageReference Include="ReactiveUI.SourceGenerators" Version="3.1.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Converters\"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PcgsApi\PcgsApi.csproj"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using ReactiveUI.Avalonia;
|
||||
|
||||
namespace PcgsInv;
|
||||
|
||||
internal sealed 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()
|
||||
.UseReactiveUI(builder => builder.WithAvalonia())
|
||||
#if DEBUG
|
||||
.WithDeveloperTools()
|
||||
#endif
|
||||
.WithInterFont()
|
||||
.LogToTrace();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using PcgsInv.ViewModels;
|
||||
|
||||
namespace PcgsInv;
|
||||
|
||||
/// <summary>
|
||||
/// Given a view model, returns the corresponding view if possible.
|
||||
/// </summary>
|
||||
[RequiresUnreferencedCode(
|
||||
"Default implementation of ViewLocator involves reflection which may be trimmed away.",
|
||||
Url = "https://docs.avaloniaui.net/docs/concepts/view-locator")]
|
||||
public class ViewLocator : IDataTemplate {
|
||||
public Control? Build(object? param) {
|
||||
if (param is null)
|
||||
return null;
|
||||
|
||||
var name = param.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal);
|
||||
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,30 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using PcgsApi;
|
||||
using PcgsInv.Models;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.SourceGenerators;
|
||||
|
||||
namespace PcgsInv.ViewModels;
|
||||
|
||||
public partial class MainWindowViewModel : ViewModelBase {
|
||||
[Reactive] private CoinCollection _collection;
|
||||
[Reactive] private PcgsCoin? _selectedCoin;
|
||||
|
||||
public MainWindowViewModel() {
|
||||
Collection = new CoinCollection();
|
||||
_selectedCoin = null;
|
||||
|
||||
Collection.PropertyChanged += (s, e) => {
|
||||
Debug.WriteLine($"Collection raised event: {e.PropertyName}");
|
||||
};
|
||||
|
||||
this.WhenAnyValue(x => x.Collection.TotalValue)
|
||||
.Subscribe(x => Debug.WriteLine($"Total value was recomputed: {x}"));
|
||||
}
|
||||
|
||||
[ReactiveCommand]
|
||||
private void CreateTestingCoin() {
|
||||
Collection.Coins.Add(new PcgsCoin());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
using ReactiveUI;
|
||||
|
||||
namespace PcgsInv.ViewModels;
|
||||
|
||||
public abstract class ViewModelBase : ReactiveObject { }
|
||||
@@ -0,0 +1,64 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:PcgsInv.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
Height="450" Width="800"
|
||||
x:Class="PcgsInv.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="{Binding Collection.Name, StringFormat='PCGS Inventory - {0}'}">
|
||||
|
||||
<Design.DataContext>
|
||||
<vm:MainWindowViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<Grid ColumnDefinitions="3*, Auto, *"
|
||||
RowDefinitions="Auto, *">
|
||||
|
||||
<Menu Grid.Row="0" Grid.ColumnSpan="2">
|
||||
<Menu.Items>
|
||||
<MenuItem Header="File">
|
||||
<MenuItem Header="Hello"/>
|
||||
</MenuItem>
|
||||
</Menu.Items>
|
||||
</Menu>
|
||||
|
||||
<DockPanel Grid.Row="1" Grid.Column="0">
|
||||
<Grid DockPanel.Dock="Top" Margin="5" ColumnDefinitions="Auto, *">
|
||||
<TextBlock Grid.Column="0" VerticalAlignment="Center" Text="Collection name: "/>
|
||||
<TextBox Grid.Column="1" Text="{Binding Collection.Name}" />
|
||||
</Grid>
|
||||
|
||||
<Button DockPanel.Dock="Top"
|
||||
Command="{Binding CreateTestingCoinCommand}"
|
||||
Content="Create Test Coin"/>
|
||||
|
||||
<TextBlock DockPanel.Dock="Bottom"
|
||||
Margin="5"
|
||||
Text="{Binding Collection.TotalValue, StringFormat='Total Value: ${0}'}"/>
|
||||
|
||||
<DataGrid ItemsSource="{Binding Collection.Coins}"
|
||||
SelectedItem="{Binding SelectedCoin}"
|
||||
Margin="5">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="*" Header="Name" Binding="{Binding Name}"/>
|
||||
<DataGridTextColumn Header="Quantity" Binding="{Binding Quantity}"/>
|
||||
<DataGridTextColumn Header="Price" Binding="{Binding PriceGuideValue}"/>
|
||||
<DataGridTextColumn Header="Total" Binding="{Binding TotalPrice}"
|
||||
IsReadOnly="True"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
|
||||
<GridSplitter Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" Background="Gray" ResizeDirection="Columns" Margin="3"/>
|
||||
|
||||
<!-- Some other content -->
|
||||
|
||||
<DockPanel Grid.Row="1" Grid.Column="2">
|
||||
<TextBlock>This is a test!</TextBlock>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
@@ -0,0 +1,9 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace PcgsInv.Views;
|
||||
|
||||
public partial class MainWindow : Window {
|
||||
public MainWindow() {
|
||||
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 embedded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="PcgsInv.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>
|
||||
Reference in new issue
Block a user