Пример #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            System.AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true);

            CultureInfo culture = new CultureInfo("en");

            Thread.CurrentThread.CurrentCulture       = culture;
            Thread.CurrentThread.CurrentUICulture     = culture;
            CultureInfo.DefaultThreadCurrentCulture   = culture;
            CultureInfo.DefaultThreadCurrentUICulture = culture;

            string baseDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            CrashHandler.Init(baseDir);

            // Check command line arguments
            var cmdLine = new CommandLine(e.Args);

            // Show Welcome Dialog while initializing
            bool bSkipWelcome = cmdLine.NoWelcomeDialog || cmdLine.HasPathToOpen || cmdLine.HasScriptToRun;

            if (!bSkipWelcome)
            {
                WelcomeDialog.ShowAsync();
            }

            // Set AppUserModelID for Shell-Features like JumpList, Taskbar-Grouping
            Win32Api.SetCurrentProcessExplicitAppUserModelID("Macad.1");

            CreateInstanceMutexes();

            // Init OCCT
#if DEBUG
            Environment.SetEnvironmentVariable(@"CSF_DEBUG", "1");
#endif
            // Init statics
            GlobalEventHandler.Init();
            WindowsClipboard.Init();

            // Init context
            AppContext.Initialize(cmdLine);

            // Start main window
            MainWindow = new MainWindow(new MainWindowModel());
            WelcomeDialog.Current?.SetMainWindow(MainWindow);
            MainWindow.Show();

            ShutdownMode = ShutdownMode.OnMainWindowClose;

            base.OnStartup(e);
        }
Пример #2
0
        //--------------------------------------------------------------------------------------------------

        internal static void ShowAsync()
        {
            Debug.Assert(Current == null);

            var thread = new Thread(() =>
            {
                Current = new WelcomeDialog();
                Current.Show();
                Dispatcher.Run();
            });

            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();
        }