Exemple #1
0
        /// <summary>
        /// Runs code generation asynchronously.
        /// </summary>
        public static void RunAsync(Logger logger)
        {
            try
            {
                logger.Progress(0, "Starting code generation...");

                _codeGenApp.Run();
            }
            catch (Exception ex)
            {
                logger.Fatal("Unexpected exception", ex);
            }
            finally
            {
                if (_progressForm != null)
                {
                    MethodInvoker methodInvoker = delegate() { _progressForm.Shutdown(); };
                    _progressForm.Invoke(methodInvoker);
                }
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var appBuilder = BuildAvaloniaApp().SetupWithoutStarting();
            var model      = new SharpGenModel();
            var logger     = new Logger(new ConsoleLogger(), new SharpGenModel.ProgressReporter(model));
            var codeGenApp = new CodeGenApp(logger)
            {
                GlobalNamespace = new GlobalNamespaceProvider("SharpGen.Runtime")
            };

            ParseArguments(args, codeGenApp);
            var window = new ProgressView(new SharpGenModel());

            window.Show();

            Task.Run(() =>
            {
                if (codeGenApp.Init())
                {
                    try
                    {
                        logger.Progress(0, "Starting code generation...");

                        codeGenApp.Run();
                    }
                    catch (Exception ex)
                    {
                        logger.Fatal("Unexpected exception", ex);
                    }
                    finally
                    {
                        Application.Current.Exit();
                    }
                }
            });

            appBuilder.Instance.Run(window);
        }