コード例 #1
0
ファイル: BarControl.cs プロジェクト: netide/netide
        protected BarControl(IServiceProvider serviceProvider, NiCommandBar bar, IBarControl control)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException("serviceProvider");
            if (bar == null)
                throw new ArgumentNullException("bar");

            _menuManager = (NiMenuManager)serviceProvider.GetService(typeof(INiMenuManager));
            _env = (NiEnv)serviceProvider.GetService(typeof(INiEnv));

            Bar = bar;
            Bar.AppearanceChanged += Bar_AppearanceChanged;

            var objectWithSite = control as INiObjectWithSite;
            if (objectWithSite != null)
                ErrorUtil.ThrowOnFailure(objectWithSite.SetSite(serviceProvider));

            Control = control;
            Control.Tag = this;
            Control.QueryStatus += (s, e) => _menuManager.QueryStatus(Bar);

            UpdateItem();

            _groupManager = new GroupManager(Bar, serviceProvider, Control);
        }
コード例 #2
0
ファイル: PackageUpdater.cs プロジェクト: netide/netide
        public PackageUpdater(IServiceProvider serviceProvider, IEnumerable<PendingUpdate> pendingUpdates)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException("serviceProvider");
            if (pendingUpdates == null)
                throw new ArgumentNullException("pendingUpdates");

            _pendingUpdates = pendingUpdates.ToList();
            _env = (NiEnv)serviceProvider.GetService(typeof(INiEnv));
        }
コード例 #3
0
ファイル: NiShell.cs プロジェクト: netide/netide
        public NiShell(IServiceProvider serviceProvider)
            : base(serviceProvider)
        {
            _env = (NiEnv)GetService(typeof(INiEnv));

            ((IServiceContainer)GetService(typeof(IServiceContainer))).AddService(
                typeof(INiQuerySave),
                this
            );

            Application.AddMessageFilter(new MessageFilter(this));

            MouseWheelMessageFilter.Install();

            _synchronizationContext = SynchronizationContext.Current;

            QueueRequery();

            _automationAccessButton = CreateAutomationAccessButton();
        }
コード例 #4
0
ファイル: NetIdeApplication.cs プロジェクト: netide/netide
        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);
            }
        }
コード例 #5
0
ファイル: DockContent.cs プロジェクト: netide/netide
            public Proxy(DockContent owner)
            {
                _owner = owner;
                _env = (NiEnv)_owner.GetService(typeof(INiEnv));

                if ((owner.DockAreas & WeifenLuo.WinFormsUI.Docking.DockAreas.Document) != 0)
                    _properties[(int)NiFrameProperty.Type] = NiFrameType.Document;
                else
                    _properties[(int)NiFrameProperty.Type] = NiFrameType.Tool;
            }