-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathApp.xaml.cs
50 lines (43 loc) · 1.67 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
using Edda.Const;
using System.Diagnostics;
using System.Windows;
namespace RagnarockEditor {
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application {
internal RecentOpenedFolders RecentMaps;
internal UserSettingsManager UserSettings;
internal DiscordClient DiscordClient;
App() {
this.RecentMaps = new(Program.RecentOpenedMapsFile, Program.MaxRecentOpenedMaps);
this.UserSettings = new UserSettingsManager(Program.SettingsFile);
this.DiscordClient = new DiscordClient();
if (UserSettings.GetValueForKey(UserSettingsKey.EnableDiscordRPC) == null) {
UserSettings.SetValueForKey(UserSettingsKey.EnableDiscordRPC, DefaultUserSettings.EnableDiscordRPC);
}
SetDiscordRPC(UserSettings.GetBoolForKey(UserSettingsKey.EnableDiscordRPC));
// for testing cultures
//CultureInfo.CurrentCulture = CultureInfo.GetCultureInfoByIetfLanguageTag("fr-FR");
}
protected override void OnStartup(StartupEventArgs e) {
try {
if (UserSettings.GetBoolForKey(UserSettingsKey.CheckForUpdates)) {
//#if !DEBUG
Helper.CheckForUpdates();
//#endif
}
} catch {
Trace.WriteLine("INFO: Could not check for updates.");
}
base.OnStartup(e);
}
public void SetDiscordRPC(bool enable) {
if (enable) {
DiscordClient.Enable();
} else {
DiscordClient.Disable();
}
}
}
}