Beispiel #1
0
        /// <inheritdoc />
        protected override int RunImpl(string[] args)
        {
            if (!ParseArguments(args))
            {
                ShowHelp();
                return(1);
            }

            if (Arguments.Help)
            {
                ShowHelp();
                return(0);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            UnhandledErrorPolicy();

            var runtimeSetup = new RuntimeSetup
            {
                RuntimePath = Path.GetDirectoryName(AssemblyUtils.GetFriendlyAssemblyLocation(
                                                        typeof(IcarusProgram).Assembly))
            };

            var runtimeLogger = new RuntimeLogger();

            GenericCollectionUtils.ForEach(Arguments.PluginDirectories, runtimeSetup.AddPluginDirectory);

            using (RuntimeBootstrap.Initialize(runtimeSetup, runtimeLogger))
            {
                // wire up services & components
                var scanner = new DefaultConventionScanner(RuntimeAccessor.Registry);
                scanner.Scan("Gallio.Icarus", Assembly.GetExecutingAssembly());

                LoadPackages();

                var optionsController = RuntimeAccessor.ServiceLocator.Resolve <IOptionsController>();

                // create & initialize a test runner whenever the test runner factory is changed
                optionsController.TestRunnerFactory.PropertyChanged += (s, e) =>
                                                                       ConfigureTestRunnerFactory(optionsController.TestRunnerFactory);

                ConfigureTestRunnerFactory(optionsController.TestRunnerFactory);

                var runtimeLogController = RuntimeAccessor.ServiceLocator.Resolve <IRuntimeLogController>();
                runtimeLogController.SetLogger(runtimeLogger);

                var applicationController = RuntimeAccessor.ServiceLocator.Resolve <IApplicationController>();
                applicationController.Arguments = Arguments;

                ErrorDialogUnhandledExceptionHandler.RunApplicationWithHandler(new Main(applicationController));

                UnloadPackages();
            }

            return(ResultCode.Success);
        }
        /// <inheritdoc />
        public DialogResult Show(IWin32Window owner)
        {
            var dialog = CreateControlPanelDialog();

            if (Application.MessageLoop)
            {
                var dr = dialog.ShowDialog(owner);
                return(dr);
            }
            else
            {
                ErrorDialogUnhandledExceptionHandler.RunApplicationWithHandler(dialog);
                return(dialog.DialogResult);
            }
        }
Beispiel #3
0
        /// <inheritdoc />
        protected override int RunImpl(string[] args)
        {
            if (!ParseArguments(args))
            {
                ShowHelp();
                return(1);
            }

            if (Arguments.Help)
            {
                ShowHelp();
                return(0);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            UnhandledErrorPolicy();

            var runtimeSetup = CreateRuntimeSetup();

            var logger = new FilteredLogger(new RichConsoleLogger(Console), Verbosity.Normal);

            using (RuntimeBootstrap.Initialize(runtimeSetup, logger))
            {
                var scanner = new ComponentScanner(RuntimeAccessor.Registry);
                scanner.Scan();

                var copyController     = RuntimeAccessor.ServiceLocator.Resolve <ICopyController>();
                var progressController = RuntimeAccessor.ServiceLocator.Resolve <IProgressController>();
                var copyForm           = new CopyForm(copyController, progressController);

                ErrorDialogUnhandledExceptionHandler.RunApplicationWithHandler(copyForm);
            }

            return(ResultCode.Success);
        }