variant_dem_shoe_store/ChudoObuv/App.xaml.cs
2026-10-31 19:36:02 +04:00

32 lines
1.6 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Configuration;
using System.Data;
using System.Windows;
using System.Globalization;
using System.Windows.Markup;
using System.Windows.Threading;
using ChudoObuv.Logic;
namespace ChudoObuv
{
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
// Русский формат чисел, цен и дат во всем приложении (в том числе в привязках XAML)
CultureInfo russian = new CultureInfo("ru-RU");
CultureInfo.DefaultThreadCurrentCulture = russian;
CultureInfo.DefaultThreadCurrentUICulture = russian;
Thread.CurrentThread.CurrentCulture = russian;
Thread.CurrentThread.CurrentUICulture = russian;
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),
new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(russian.IetfLanguageTag)));
base.OnStartup(e);
}
// Последняя защита от аварийного завершения: любая необработанная ошибка показывается пользователю
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
Messages.ShowError($"Произошла непредвиденная ошибка: {e.Exception.Message}\nПовторите действие.Если ошибка повторяется, перезапустите приложение.");
e.Handled = true;
}
}
}