Add API key management. #10
No files matched your search
@@ -23,7 +23,7 @@
|
|||||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.5" />
|
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.5" />
|
||||||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.5" />
|
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.5" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
|
||||||
<PackageReference Include="System.Data.SQLite" Version="1.0.118"/>
|
<PackageReference Include="System.Data.SQLite" Version="1.0.118" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,26 @@
|
|||||||
using System;
|
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
using ReactiveUI;
|
using System.Security.Principal;
|
||||||
using PcgsInvUi.Views;
|
using PcgsInvUi.Views;
|
||||||
|
using ReactiveUI;
|
||||||
|
|
||||||
namespace PcgsInvUi.ViewModels;
|
namespace PcgsInvUi.ViewModels;
|
||||||
|
|
||||||
public class ErrorWindowViewModel : ViewModelBase {
|
public class ErrorWindowViewModel : ViewModelBase {
|
||||||
|
|
||||||
public Exception DisplayedException {
|
public string DisplayedMessage {
|
||||||
get => _message;
|
get => _message;
|
||||||
set => this.RaiseAndSetIfChanged(ref _message, value);
|
set => this.RaiseAndSetIfChanged(ref _message, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Exception _message;
|
private string _message;
|
||||||
|
|
||||||
public ReactiveCommand<ErrorWindow, Unit> CloseCommand { get; }
|
public ReactiveCommand<ErrorWindow, Unit> CloseCommand { get; }
|
||||||
|
|
||||||
public ErrorWindowViewModel(string message) {
|
public ErrorWindowViewModel(string message)
|
||||||
CloseCommand = ReactiveCommand.Create<ErrorWindow>(window => { window.Close(); });
|
{
|
||||||
|
DisplayedMessage = message;
|
||||||
|
|
||||||
|
CloseCommand = ReactiveCommand.Create<ErrorWindow>(window => window.Close());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<Button Grid.Row="1" Grid.Column="1" Margin="5"
|
<Button Grid.Row="1" Grid.Column="1" Margin="5"
|
||||||
Width="100"
|
Width="100"
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||||
HorizontalContentAlignment="Center"
|
HorizontalContentAlignment="Center" IsEnabled="False"
|
||||||
Content="No" Command="{Binding CancelCommand}" />
|
Content="Use X button" Command="{Binding CancelCommand}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -3,11 +3,17 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:viewModels="clr-namespace:PcgsInvUi.ViewModels"
|
xmlns:viewModels="clr-namespace:PcgsInvUi.ViewModels"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="300" d:DesignHeight="150"
|
||||||
x:Class="PcgsInvUi.Views.ErrorWindow" x:DataType="viewModels:ErrorWindowViewModel"
|
x:Class="PcgsInvUi.Views.ErrorWindow" x:DataType="viewModels:ErrorWindowViewModel"
|
||||||
Title="ErrorWindow">
|
Title="Error!" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterOwner"
|
||||||
<Grid RowDefinitions="2">
|
x:Name="NameErrorWindow" CanResize="False" >
|
||||||
<TextBlock Text="{Binding DisplayedException.Message}" />
|
<Grid RowDefinitions="*,*">
|
||||||
<Button Content="OK" Command="{Binding CloseCommand}" />
|
<Label Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Stretch"
|
||||||
|
Margin="15"
|
||||||
|
Content="{Binding DisplayedMessage}" />
|
||||||
|
<Button Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom"
|
||||||
|
Margin="10" Name="CloseButton" IsEnabled="False"
|
||||||
|
Content="Use X button" Command="{Binding CloseCommand, Mode=OneWay}"
|
||||||
|
CommandParameter="{Binding ElementName=NameErrorWindow}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using Avalonia;
|
using Avalonia.ReactiveUI;
|
||||||
using Avalonia.Controls;
|
using PcgsInvUi.ViewModels;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace PcgsInvUi.Views;
|
namespace PcgsInvUi.Views;
|
||||||
|
|
||||||
public partial class ErrorWindow : Window {
|
public partial class ErrorWindow : ReactiveWindow<ErrorWindowViewModel> {
|
||||||
public ErrorWindow() {
|
public ErrorWindow()
|
||||||
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
IsReadOnly="True" />
|
IsReadOnly="True" />
|
||||||
<DataGridTextColumn Header="Est. Price" Width="*"
|
<DataGridTextColumn Header="Est. Price" Width="*"
|
||||||
Binding="{Binding PriceGuideValue}"
|
Binding="{Binding PriceGuideValue}"
|
||||||
IsReadOnly="False" />
|
IsReadOnly="True" />
|
||||||
<DataGridTextColumn Header="PCGS #" Width="*"
|
<DataGridTextColumn Header="PCGS #" Width="*"
|
||||||
Binding="{Binding PCGSNo}"
|
Binding="{Binding PCGSNo}"
|
||||||
IsReadOnly="True" />
|
IsReadOnly="True" />
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel> {
|
|||||||
// this.WhenActivated(d => d(ViewModel!.ShowFindWindow.RegisterHandler(ShowFindWindowAsync)));
|
// this.WhenActivated(d => d(ViewModel!.ShowFindWindow.RegisterHandler(ShowFindWindowAsync)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ShowDeleteWindowAsync(InteractionContext<DeleteWindowViewModel, Boolean> interaction) {
|
private async Task ShowDeleteWindowAsync(InteractionContext<DeleteWindowViewModel, Boolean> interaction) {
|
||||||
var window = new DeleteWindow();
|
var window = new DeleteWindow();
|
||||||
window.DataContext = interaction.Input;
|
window.DataContext = interaction.Input;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel> {
|
|||||||
interaction.SetOutput(result);
|
interaction.SetOutput(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ShowFindWindowAsync(InteractionContext<FindWindowViewModel, int> interaction) {
|
private async Task ShowFindWindowAsync(InteractionContext<FindWindowViewModel, int> interaction) {
|
||||||
var window = new FindWindow();
|
var window = new FindWindow();
|
||||||
window.DataContext = interaction.Input;
|
window.DataContext = interaction.Input;
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel> {
|
|||||||
interaction.SetOutput(result);
|
interaction.SetOutput(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ShowFilePickerAsync(InteractionContext<Unit, Uri> interationContext) {
|
private async Task ShowFilePickerAsync(InteractionContext<Unit, Uri> interationContext) {
|
||||||
var topLevel = GetTopLevel(this);
|
var topLevel = GetTopLevel(this);
|
||||||
var file = await topLevel.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions {
|
var file = await topLevel.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions {
|
||||||
Title = "Save CSV...",
|
Title = "Save CSV...",
|
||||||
@@ -44,8 +44,6 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel> {
|
|||||||
SuggestedStartLocation = await StorageProvider.TryGetWellKnownFolderAsync(WellKnownFolder.Documents)
|
SuggestedStartLocation = await StorageProvider.TryGetWellKnownFolderAsync(WellKnownFolder.Documents)
|
||||||
});
|
});
|
||||||
|
|
||||||
Stream stream;
|
|
||||||
|
|
||||||
if (file is not null) {
|
if (file is not null) {
|
||||||
interationContext.SetOutput(file.Path);
|
interationContext.SetOutput(file.Path);
|
||||||
}
|
}
|
||||||
@@ -55,10 +53,11 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ShowErrorWindowAsync(InteractionContext<ErrorWindowViewModel, Unit> interaction) {
|
private async Task ShowErrorWindowAsync(InteractionContext<ErrorWindowViewModel, Unit> interaction) {
|
||||||
var window = new ErrorWindow();
|
var window = new ErrorWindow();
|
||||||
window.DataContext = interaction.Input;
|
window.DataContext = interaction.Input;
|
||||||
|
|
||||||
await window.ShowDialog(this);
|
await window.ShowDialog(this);
|
||||||
|
interaction.SetOutput(Unit.Default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user