Beispiel #1
0
        public void TestInitialize()
        {
            //Initialisation des mappings profiles
            var loadMappers = new MainMapperProfile();

            loadMappers.ConfigureObjectMapper();
        }
Beispiel #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Dispatcher.UnhandledException += OnDispatcherUnhandledException;

            base.OnStartup(e);

            //AppDomain currentDomain = AppDomain.CurrentDomain;
            //currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);

            Thread.CurrentThread.CurrentCulture              = new CultureInfo("fr-FR");
            Thread.CurrentThread.CurrentUICulture            = new CultureInfo("fr-FR");
            Thread.CurrentThread.CurrentCulture.NumberFormat = NumberFormatInfo.InvariantInfo;

            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
                                                                   XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

            CheckLicencing();

            //Initialize Database
            CreateIfNotExists("FormotsDatabase.sdf");

            //Initialisation des mappings profiles
            var loadMappers = new MainMapperProfile();

            loadMappers.ConfigureObjectMapper();

            //Pour la fenêtre de login, ne pas fermer le programme lorsque l'on quitte la fenêtre.
            Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            var loginWindow = new LoginWindow
            {
                BorderThickness = new Thickness(1),
                GlowBrush       = null
            };

            loginWindow.SetResourceReference(Control.BorderBrushProperty, "AccentColorBrush");
            loginWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;

            if (IsLoginNeeded)
            {
                OpenStartupSplashscreen();
                loginWindow.ShowDialog();
                //var loginViewModel = (LoginWindowViewModel) loginWindow.DataContext;
                //if (loginViewModel != null)
                //{
                //    userConnected = loginViewModel.LoginUser;
                //    MainWindowViewModel.UserConnected = userConnected;
                //}

                if (!loginWindow.DialogResult.GetValueOrDefault())
                {
                    Environment.Exit(0);
                }
            }

            OpenMainWindow();
        }