This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
App.xaml.cs
54 lines (42 loc) · 1.77 KB
/
App.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Reflection;
using System.Windows;
using PropertyChanged;
using DyviniaUtils;
using DyviniaUtils.Dialogs;
namespace FrostyFix {
[GlobalConfig]
[AddINotifyPropertyChangedInterface]
public class Config : SettingsManager<Config> {
public bool LaunchGame { get; set; } = false;
public bool BackgroundThread { get; set; } = true;
public bool UpdateChecker { get; set; } = true;
public string FrostyPath { get; set; }
public string CustomGamePath { get; set; }
public int SelectedGame { get; set; } = -1;
public int SelectedPlatform { get; set; } = -1;
}
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application {
public static readonly string Version = "v" + Assembly.GetExecutingAssembly().GetName().Version.ToString()[..5];
public static readonly string AppName = Assembly.GetEntryAssembly().GetName().Name;
public App() {
Config.Load();
DispatcherUnhandledException += ExceptionDialog.UnhandledException;
}
protected async override void OnStartup(StartupEventArgs e) {
new MainWindow().Show();
if (Config.Settings.UpdateChecker) {
string repoAuthor = "Dyvinia";
string repoName = "FrostyFix";
if (await GitHub.CheckVersion(repoAuthor, repoName)) {
string message = $"Would you like to download the latest version of {repoName}?";
if (MessageBoxDialog.Show(message, repoName, MessageBoxButton.YesNo, DialogSound.Notify) == MessageBoxResult.Yes)
await GitHub.InstallUpdate(repoAuthor, repoName);
}
}
}
}
}