forked from thelsing/CreateKnxProd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
54 lines (48 loc) · 1.66 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 CreateKnxProd.Properties;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Markup;
using WPFLocalizeExtension.Engine;
namespace CreateKnxProd
{
/// <summary>
/// Interaktionslogik für "App.xaml"
/// </summary>
public partial class App : Application
{
public App()
{
InitialiseCultures();
}
private static void InitialiseCultures()
{
if (!string.IsNullOrEmpty(Settings.Default.Culture))
{
LocalizeDictionary.Instance.Culture
= Thread.CurrentThread.CurrentCulture
= new CultureInfo(Settings.Default.Culture);
}
if (!string.IsNullOrEmpty(Settings.Default.UICulture))
{
LocalizeDictionary.Instance.Culture
= Thread.CurrentThread.CurrentUICulture
= new CultureInfo(Settings.Default.UICulture);
}
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name)));
}
private void Application_Startup(object sender, StartupEventArgs e)
{
var messageService = new DialogService();
var mainWindowViewModel = new MainWindowViewModel(messageService);
var mainWindow = new MainWindow() { DataContext = mainWindowViewModel };
mainWindow.Show();
}
}
}