diff --git a/DeFRaG_Helper/App.xaml.cs b/DeFRaG_Helper/App.xaml.cs
index 0073489..e4ee408 100644
--- a/DeFRaG_Helper/App.xaml.cs
+++ b/DeFRaG_Helper/App.xaml.cs
@@ -13,20 +13,30 @@ protected override void OnStartup(StartupEventArgs e)
base.OnStartup(e);
// Initialize logging
MessageHelper.Log("Application starting");
- LoadConfigurationAndStartAsync().ContinueWith(_ =>
+ LoadConfigurationAndStartAsync().ContinueWith(task =>
{
- // This ensures the continuation runs on the UI thread
- Dispatcher.Invoke(() =>
+ if (task.IsFaulted)
{
- // Now that configuration and resources are loaded, show the main window
- MessageHelper.Log("Main window created");
- MainWindow mainWindow = new MainWindow();
- mainWindow.Show();
- });
- });
+ // Log the error or show an error message to the user
+ MessageHelper.Log($"Error during startup: {task.Exception}");
+ // Optionally, close the application if critical startup tasks fail
+ Dispatcher.Invoke(() => Current.Shutdown());
+ }
+ else
+ {
+ // This ensures the continuation runs on the UI thread
+ Dispatcher.Invoke(() =>
+ {
+ // Now that configuration and resources are loaded, show the main window
+ MessageHelper.Log("Main window created");
+ MainWindow mainWindow = new MainWindow();
+ mainWindow.Show();
+ });
+ }
+ });
StartDelayedTasks();
-
}
+
private async void StartDelayedTasks()
{
// Wait for 1 minute after the application starts
@@ -51,12 +61,16 @@ private async Task LoadConfigurationAndStartAsync()
ApplyThemeColor();
// Create an instance of MapHistoryManager
+
+
+ await AppConfig.EnsureDatabaseExistsAsync();
+ MessageHelper.Log("Database exists");
+
MessageHelper.Log("Creating MapHistoryManager");
var mapHistoryManager = MapHistoryManager.GetInstance("DeFRaG_Helper");
MessageHelper.Log("MapHistoryManager created");
- await AppConfig.EnsureDatabaseExistsAsync();
- MessageHelper.Log("Database exists");
+
// The main window creation and showing is moved to the continuation of this method in OnStartup
}
private void ApplyThemeColor()
diff --git a/DeFRaG_Helper/AssemblyInfo.cs b/DeFRaG_Helper/AssemblyInfo.cs
index b0ec827..22fc591 100644
--- a/DeFRaG_Helper/AssemblyInfo.cs
+++ b/DeFRaG_Helper/AssemblyInfo.cs
@@ -1,3 +1,4 @@
+using System.Reflection;
using System.Windows;
[assembly: ThemeInfo(
diff --git a/DeFRaG_Helper/DeFRaG_Helper.csproj b/DeFRaG_Helper/DeFRaG_Helper.csproj
index 2d3e613..166fc49 100644
--- a/DeFRaG_Helper/DeFRaG_Helper.csproj
+++ b/DeFRaG_Helper/DeFRaG_Helper.csproj
@@ -7,6 +7,8 @@
enable
true
Quake3.ico
+ 1.0.0
+ 1.0.0
diff --git a/DeFRaG_Helper/Helpers/Downloader.cs b/DeFRaG_Helper/Helpers/Downloader.cs
index 72377de..630a25f 100644
--- a/DeFRaG_Helper/Helpers/Downloader.cs
+++ b/DeFRaG_Helper/Helpers/Downloader.cs
@@ -7,7 +7,6 @@ namespace DeFRaG_Helper
{
public static class Downloader
{
-
private static readonly HttpClient httpClient = CreateHttpClient();
private static HttpClient CreateHttpClient()
diff --git a/DeFRaG_Helper/MainWindow.xaml b/DeFRaG_Helper/MainWindow.xaml
index c44c9d7..8707b48 100644
--- a/DeFRaG_Helper/MainWindow.xaml
+++ b/DeFRaG_Helper/MainWindow.xaml
@@ -32,7 +32,7 @@
-
+
diff --git a/DeFRaG_Helper/MainWindow.xaml.cs b/DeFRaG_Helper/MainWindow.xaml.cs
index 3fb3400..f738b99 100644
--- a/DeFRaG_Helper/MainWindow.xaml.cs
+++ b/DeFRaG_Helper/MainWindow.xaml.cs
@@ -1,5 +1,6 @@
using DeFRaG_Helper.ViewModels;
using System.Diagnostics;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
@@ -69,6 +70,9 @@ public MainWindow()
hideProgressBarTimer = new System.Timers.Timer(2000);
hideProgressBarTimer.Elapsed += HideProgressBarTimer_Elapsed;
hideProgressBarTimer.AutoReset = false; // Ensure the timer runs only once per start
+
+ this.DataContext = this;
+
}
//Method to apply filters based on the page navigated to in the MainFrame
@@ -77,7 +81,14 @@ private void MainFrame_Navigated(object sender, NavigationEventArgs e)
ApplyFilterBasedOnPageAsync(e.Content); //AppConfig.OnRequestGameDirectory += RequestGameDirectoryAsync;
}
-
+ public string AppTitleAndVersion
+ {
+ get
+ {
+ var version = Assembly.GetExecutingAssembly().GetName().Version;
+ return $"DeFRaG_Helper v{version.Major}.{version.Minor}.{version.Build}";
+ }
+ }
//Method to request game directory
private async Task RequestGameDirectoryAsync()
{
diff --git a/DeFRaG_Helper/ToDo.txt b/DeFRaG_Helper/ToDo.txt
index a36bc21..c53745a 100644
--- a/DeFRaG_Helper/ToDo.txt
+++ b/DeFRaG_Helper/ToDo.txt
@@ -4,10 +4,7 @@
- Edit maps
- Config editor
- Records
-- Versioning
-
-- Own File Browser remove old..
-- Refactor appConfig logic to ask gamepath
+- Versioning and AutoUpdate