Пример #1
0
 public Finalizer(SplashForm form)
 {
     _form = form;
 }
Пример #2
0
        public void Run()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ToolStripManager.Renderer = new VS2012ToolStripRenderer();

            using (var serviceContainer = new NiServiceContainer())
                using (_mainForm = new MainForm())
                {
                    bool experimental = false;

                    foreach (string arg in _args)
                    {
                        if (String.Equals(arg, "/experimental", StringComparison.OrdinalIgnoreCase))
                        {
                            experimental = true;
                            break;
                        }
                    }

                    var env = new NiEnv(serviceContainer, _mainForm, experimental);

                    serviceContainer.AddService(typeof(INiEnv), env);

                    // Show the splash form.

                    string pathToSplashImage = FindPathToSplashImage(serviceContainer);

                    if (pathToSplashImage != null)
                    {
                        var splashForm = SplashForm.ShowSplashForm(pathToSplashImage);

                        _mainForm.Shown += (s, e) =>
                        {
                            _mainForm.Activate();
                            splashForm.Dispose();
                        };
                    }

                    // Continue initialization.

                    serviceContainer.AddService(typeof(INiCommandLine), new NiCommandLine(serviceContainer, _args));
                    serviceContainer.AddService(typeof(INiLogger), new NiLogger(serviceContainer));

                    LoggingRedirection.Install(serviceContainer);
                    Log.Info("Starting NetIDE");

                    serviceContainer.AddService(typeof(INiLocalRegistry), new NiLocalRegistry(serviceContainer));
                    serviceContainer.AddService(typeof(INiEditorFactoryRegistry), new NiEditorFactoryRegistry(serviceContainer));
                    serviceContainer.AddService(typeof(INiCommandManager), new NiCommandManager(serviceContainer));
                    serviceContainer.AddService(typeof(INiWindowPaneSelection), new NiWindowPaneSelection(serviceContainer));
                    serviceContainer.AddService(typeof(INiShell), new NiShell(serviceContainer));
                    serviceContainer.AddService(typeof(INiMenuManager), new NiMenuManager(serviceContainer));
                    serviceContainer.AddService(typeof(INiJobManager), new NiJobManager(serviceContainer));
                    serviceContainer.AddService(typeof(INiToolsOptions), new NiToolsOptions(serviceContainer));
                    serviceContainer.AddService(typeof(INiProjectManager), new NiProjectManager(serviceContainer));
                    serviceContainer.AddService(typeof(INiOpenDocumentManager), new NiOpenDocumentManager(serviceContainer));
                    serviceContainer.AddService(typeof(INiRunningDocumentTable), new NiRunningDocumentTable(serviceContainer));
                    serviceContainer.AddService(typeof(INiWaitDialogFactory), new NiWaitDialogFactory(serviceContainer));

                    var packageManager = new NiPackageManager(serviceContainer);
                    serviceContainer.AddService(typeof(INiPackageManager), packageManager);

                    // Initialize the required services.

                    _mainForm.Site = new SiteProxy(serviceContainer);

                    packageManager.Initialize();

                    // Run the main form.

                    Handle = _mainForm.Handle;

                    OnHandleAvailable(EventArgs.Empty);

                    // Queue startup completion.

                    _mainForm.Shown += (s, e) =>
                    {
                        // Flush pending (paint) messages so the main window gets fully
                        // rendered.
                        Application.DoEvents();

                        // Complete startup; executes the INiEnvNotify.OnStartupComplete
                        // callback.
                        env.CompleteStartup();
                    };

                    Application.Run(_mainForm);
                }
        }