Updated TODO lists, deleted unused .axaml
This commit is contained in:
1 parent
8f489775ef
commit
298e6d8294
5 files changed
+14
-39
No files matched your search
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Windows.Input;
|
||||
using PcgsInvUi.Models;
|
||||
using PcgsInvUi.Services;
|
||||
using ReactiveUI;
|
||||
@@ -16,7 +17,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
private set => this.RaiseAndSetIfChanged(ref _sideContent, value);
|
||||
}
|
||||
public ObservableCollection<Coin> CoinCollection { get; set; }
|
||||
public Coin SelectedCoin
|
||||
public Coin? SelectedCoin
|
||||
{
|
||||
get => _selectedCoin;
|
||||
set => this.RaiseAndSetIfChanged(ref _selectedCoin, value);
|
||||
@@ -26,10 +27,10 @@ public class MainWindowViewModel : ViewModelBase
|
||||
get => _totalValue;
|
||||
set => this.RaiseAndSetIfChanged(ref _totalValue, value);
|
||||
}
|
||||
public ICommand DeleteCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> DeleteCommand { get; }
|
||||
public Interaction<DeleteWindowViewModel, Boolean> ShowDeleteWindow { get; }
|
||||
|
||||
private ViewModelBase? _sideContent;
|
||||
private ViewModelBase _sideContent;
|
||||
private Coin? _selectedCoin;
|
||||
private double _totalValue;
|
||||
private PcgsClient _pcgsClient;
|
||||
@@ -37,7 +38,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
public MainWindowViewModel(CoinCollection coins)
|
||||
{
|
||||
var newViewModel = new NewViewModel();
|
||||
SidebarContent = newViewModel;
|
||||
_sideContent = newViewModel;
|
||||
CoinCollection = new ObservableCollection<Coin>(coins.GetItems());
|
||||
_pcgsClient = new PcgsClient("eAb8gS0I2XAvT_5gJeiGJaglMia1Tk-oB4kJUK6kuafyrny_S61vIJY-Ikl4nCQM67wrdxzUqLVWTV2kBSxD3d5XNBHxHnYBhcSS6dOPug0hZaF3qAv56df3gYSzOGh9Tif5y0eP3Iw0LrqKDr1Hj-dk6SV6GKog2IIqCPQhhHH8FMTWBTYO-_O8cx7qLdM5GM8KlTsic6g3VRUhM8EA_4OO04dCfmNLGhqINRl3jGZ0Q4ziI8fng2bVWsIyteqiPzUn10rIQ3-OPpqVZG_DxeOmOejj4GzbUNyqUOajy-nr5rYY");
|
||||
|
||||
@@ -46,7 +47,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
var deleteViewModel = new DeleteWindowViewModel();
|
||||
var result = await ShowDeleteWindow.Handle(deleteViewModel);
|
||||
if (result) CoinCollection.Remove(SelectedCoin);
|
||||
if (result && SelectedCoin != null) CoinCollection.Remove(SelectedCoin);
|
||||
});
|
||||
|
||||
// Subscribe to SidebarContent.OkCommand, which is an IObservable<(int, string, int)>
|
||||
@@ -59,10 +60,10 @@ public class MainWindowViewModel : ViewModelBase
|
||||
CoinCollection.Add(newCoin);
|
||||
TotalValue += newCoin.Quantity * newCoin.PriceGuideValue;
|
||||
});
|
||||
}
|
||||
|
||||
public void FindItem()
|
||||
{
|
||||
|
||||
// Change TotalValue anytime SelectedCoin.TotalPrice changes. This does work properly with the DeleteCommand.
|
||||
this.WhenAnyValue(x => x.SelectedCoin.TotalPrice)
|
||||
.Where(x => x != null)
|
||||
.Subscribe(_ => TotalValue = CoinCollection.Sum(x => x.TotalPrice) );
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<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">
|
||||
|
||||
</UserControl>
|
||||
@@ -1,13 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class CoinListView : UserControl
|
||||
{
|
||||
public CoinListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
<TextBox Grid.Row="1" Margin="5" Watermark="Notes..."/>
|
||||
</Grid>
|
||||
</SplitView.Pane>
|
||||
<Grid RowDefinitions="*, Auto" ShowGridLines="True">
|
||||
<Grid RowDefinitions="*, Auto" ShowGridLines="False">
|
||||
<DataGrid Grid.Row="0" HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
ItemsSource="{Binding CoinCollection}"
|
||||
@@ -64,7 +64,7 @@
|
||||
<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 FindItem}"/>
|
||||
/>
|
||||
</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}'}" />
|
||||
|
||||
@@ -8,14 +8,11 @@ namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
|
||||
{
|
||||
// TODO New window.
|
||||
// TODO Edit window.
|
||||
// TODO Find window.
|
||||
// TODO Export window.
|
||||
// TODO Export window and export function.
|
||||
// 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)
|
||||
|
||||
Reference in new issue
Block a user