Ejemplo n.º 1
0
 private void App_Exit(object sender, ExitEventArgs e)
 {
     try
     {
         AppVM.Close();
         MessageHandlers.UnregisterMessageHandlers(this);
     }
     catch (Exception ex)
     {
         ExceptionUtils.HandleException(ex);
     }
 }
Ejemplo n.º 2
0
        public App(string userConfigPath = null)
        {
            MessageHandlers.RegisterMessageHandlers(this);

            UserConfigPath = GetUserConfigPath(userConfigPath, true);

            AppViewModel.Init(Assembly.GetEntryAssembly(), this, UserConfigPath);

            AppVM.LoadAppConfig();

            if (!File.Exists(UserConfigPath))
            {
                // Makes sure that LoadUserConfig will be successful
                AppVM.SaveUserConfig();
            }

            AppVM.LoadUserConfig(HandleUserConfigLoadException);

            // Makes sure textboxes accept localized inputs
            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

            Exit += App_Exit;
        }