Esempio n. 1
0
        public static void Main(string[] args)
        {
            _progressForm = new ProgressForm();
            var logger = new Logger(new ConsoleLogger(), _progressForm);

            try
            {
                _codeGenApp = new CodeGenApp(logger)
                {
                    GlobalNamespace = new GlobalNamespaceProvider("SharpDX") // Fall back to SharpDX for now
                };
                ParseArguments(args, _codeGenApp);

                if (_codeGenApp.Init())
                {
                    if (Environment.GetEnvironmentVariable("SharpDXBuildNoWindow") == null)
                    {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);

                        _progressForm.Show();

                        var runningThread = new Thread(() => RunAsync(logger))
                        {
                            IsBackground = true
                        };
                        runningThread.Start();

                        Application.Run(_progressForm);
                    }
                    else
                    {
                        RunAsync(logger);
                    }
                }
                else
                {
                    logger.Message("Latest code generation is up to date. No need to run code generation");
                }
            }
            catch (Exception ex)
            {
                logger.Fatal("Unexpected exception", ex);
            }
            Environment.Exit(0);
        }
Esempio n. 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);
        }