Exemple #1
0
        /// <summary>
        /// Invokes the command.
        /// </summary>
        public override void Run()
        {
            EventWatcher.Initialize();
            ServiceManager svcMgr = ServiceManager.Instance;

            Res.RegisterNeutralStrings(FdoToolbox.Base.Strings.ResourceManager);
            Res.RegisterNeutralImages(FdoToolbox.Base.Images.ResourceManager);
            Res.RegisterNeutralStrings(ResourceUtil.StringResourceManager);

            Workbench.WorkbenchInitialized += delegate
            {
                Workbench wb = Workbench.Instance;
                List <IObjectExplorerExtender> extenders = AddInTree.BuildItems <IObjectExplorerExtender>("/ObjectExplorer/Extenders", this);
                if (extenders != null)
                {
                    foreach (IObjectExplorerExtender dec in extenders)
                    {
                        dec.Decorate(wb.ObjectExplorer);
                    }
                }

                svcMgr.RestoreSession();
                Msg.MainForm = wb;

                //Find and register drag and drop handlers
                List <IDragDropHandler> handlers = AddInTree.BuildItems <IDragDropHandler>("/FdoToolbox/DragDropHandlers", this);
                if (handlers != null)
                {
                    IDragDropHandlerService handlerSvc = ServiceManager.Instance.GetService <IDragDropHandlerService>();
                    foreach (IDragDropHandler h in handlers)
                    {
                        handlerSvc.RegisterHandler(h);
                    }
                }

                //Init the scripting engine
                ScriptingEngine engine = ScriptingEngine.Instance;
                ScriptManager   mgr    = new ScriptManager();
                wb.ShowContent(mgr, ViewRegion.Right);

                string startup = Path.Combine(Application.StartupPath, "Scripts\\" + ScriptingEngine.STARTUP_SCRIPT);

                engine.ScriptLoaded += new ScriptEventHandler(EventWatcher.OnScriptLoaded);

                //Run startup script
                engine.RunScript(startup);

                wb.FormClosing += delegate
                {
                    svcMgr.UnloadAllServices();
                };
            };
        }
Exemple #2
0
        /// <summary>
        /// Initializes from the AddIn registry
        /// </summary>
        /// <param name="callback"></param>
        public static void Initialize(Action callback)
        {
            if (_init)
            {
                return;
            }

            _services = AddInTree.BuildItems <ServiceBase>("/Maestro/ApplicationServices", null); //NOXLATE
            foreach (var svc in _services)
            {
                svc.Initialize();
                svc.Load();
            }
            _init = true;
            EventWatcher.Initialize();
            callback?.Invoke();
        }
Exemple #3
0
 public override void Run()
 {
     ResourceService.RegisterNeutralStrings(Strings.ResourceManager);
     EventWatcher.Initialize();
 }