Exemplo n.º 1
0
        public static void Main( string[] args )
        {
            try{
                _log = LogManager.GetCurrentClassLogger();
            }catch(Exception ex ){
                Console.WriteLine(ex.Message);
            }

            _log.InfoFormat("{0} ready to serve.", APP_NAME);
            // BATCH
            if (args.Length > 0) {
                CodeRunner codeRunner = new CodeRunner();
                try {
                    string padFile = args[0];
                    _log.InfoFormat("File argument: {0}", padFile);

                    // load configuration
                    PadConfig padConfig = new PadConfig();
                    if (!padConfig.Load(padFile)) {
                        _log.ErrorFormat("Error loading pad file!");
                        return;
                    }

                    // setup single factory (fast calls optimization)
                    if (padConfig.DataContext.Enabled) {
                        CustomConfiguration cfg = ServiceHelper.GetService<CustomConfiguration>();
                        cfg.FactoryRebuildOnTheFly = bool.FalseString;
                        cfg.IsConfigured = true;
                    }

                    // run
                    codeRunner.Build(padConfig);
                    codeRunner.Run();

                } catch (Exception ex) {

                    _log.ErrorFormat(ex.Message);

                } finally {

                    codeRunner.Release();
                }

            } else {

                // GUI
                try {
                    Application.Init();
                    SpoolPadWindow win = new SpoolPadWindow();
                    win.Show();
                    Application.Run();
                } catch (Exception ex) {
                    MessageHelper.ShowError(ex);
                }

            }

            _log.Info("SpoolPad goes to sleep.");
        }
Exemplo n.º 2
0
    public SpoolPadWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        _currentConfigPad = new PadConfig();
        _codeRunner = new CodeRunner(_currentConfigPad);

        foreach (ISpoolerService spoolerService in SpoolerHelper.Spoolers) {
            Widget temp = spoolerService.GetSpoolerWidget();
            if (temp != null) {
                if (!ExistResultView)
                    _resultView = temp;
                else
                    throw new Exception("The Spooling services MUST be consistent.\nMore than one UI Widget is defined!\nCannot continue.");
            }
        }

        Build();
        InitControls();
        Reset();
    }