Exemplo n.º 1
0
        public App(string configFile)
        {
            MessageHandlers.RegisterMessageHandlers(this);

#if PORTABLE
            ViewerConfigPath = !string.IsNullOrWhiteSpace(configFile) ? configFile : DefaultViewerConfigFileName;
#else
            ViewerConfigPath = !string.IsNullOrWhiteSpace(configFile) ? configFile : GetAppDataViewerConfigPath();
#endif

            AppViewModelParameters parameters = new AppViewModelParameters()
            {
                ProgramTitle             = Assembly.GetEntryAssembly().GetName().Name,
                FullVersion              = Assembly.GetEntryAssembly().GetName().Version.ToString(),
                ViewerConfig             = LoadConfig(),
                DoOnUIThread             = (action) => { Dispatcher.Invoke(action); },
                TextToClipboard          = TextToClipboard,
                InternalGameEngineConfig = InternalGameEngineConfig, // Should be the unmodified defaults
            };

            if (parameters.ViewerConfig.EngineType == EngineType.CommandLine)
            {
                parameters.EngineWrapper = new CLIEngineWrapper(parameters.ViewerConfig.EngineCommandLine);
            }

            AppViewModel.Init(parameters);

            Exit += App_Exit;
        }
Exemplo n.º 2
0
        public App(string configFile)
        {
            MessageHandlers.RegisterMessageHandlers(this);

            AppViewModel.Init(LoadConfig(configFile), (action) =>
            {
                Dispatcher.Invoke(action);
            });

            Exit += App_Exit;
        }
Exemplo n.º 3
0
 private void App_Exit(object sender, ExitEventArgs e)
 {
     try
     {
         SaveConfig();
         AppVM.EngineWrapper.StopEngine();
     }
     catch (Exception ex)
     {
         ExceptionUtils.HandleException(ex);
     }
     finally
     {
         MessageHandlers.UnregisterMessageHandlers(this);
     }
 }