Added code ensuring that there is not a crash upon creation of sqlite database.

This commit is contained in:
alphafetus committed 2023-11-23 18:19:47 -05:00
1 parent 602e9bbd8b
commit 83a08edb2e
4 files changed
+11 -3

No files matched your search

+1
View File
@@ -16,6 +16,7 @@
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.5" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.5" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.5" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.5" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.5" />
+8 -2
View File
@@ -36,9 +36,15 @@ public class CoinDatabase {
}
private SQLiteConnection CreateConnection() {
// Create a connection.
// Check if database exists.
if (!System.IO.File.Exists("%USERPROFILE%\\coin_collection")) {
// Create the database.
SQLiteConnection.CreateFile("%USERPROFILE%\\coin_collection");
}
// Create a connection to the database.
SQLiteConnection connection =
new SQLiteConnection("DataSource=C:\\Users\\lvas4\\coin_collection");
new SQLiteConnection("DataSource=%USERPROFILE%\\coin_collection");
// Open the connection.
try {
+1 -1
View File
@@ -5,7 +5,7 @@
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"
Title="Main Window"
WindowStartupLocation="CenterOwner">
<SplitView IsPaneOpen="True"
DisplayMode="Inline"