Esempio n. 1
0
        /// <summary>
        /// 设置默认编辑控制器到客户端存储
        /// </summary>
        /// <param name="objectType">对象类型</param>
        /// <param name="editController">默认编辑控制器</param>
        public static void SetEditControllerToStorage(Type objectType, BaseEditController editController)
        {
            string editorID = GetEditorID(editController.GetType(), objectType);

            ConfigStoragePublic.SetConfig(EditorsStorageName, editorID, editController);
        }
Esempio n. 2
0
        /// <summary>
        /// 从客户端存储中默认的编辑控制器
        /// </summary>
        /// <param name="objectType">对象类型</param>
        /// <param name="editorType">编辑器类型</param>
        public static void RemoveEditControllerFromStorage(Type objectType, Type editorType)
        {
            string editorID = GetEditorID(editorType, objectType);

            ConfigStoragePublic.RemoveConfig(EditorsStorageName, editorID);
        }
Esempio n. 3
0
        /// <summary>
        /// 从客户端存储中获取默认的编辑控制器
        /// </summary>
        /// <param name="objectType">对象类型</param>
        /// <param name="editorType">编辑器类型</param>
        /// <returns>默认编辑控制器</returns>
        public static BaseEditController GetEditControllerFromStorage(Type objectType, Type editorType)
        {
            string editorID = GetEditorID(editorType, objectType);

            return(ConfigStoragePublic.GetConfig(EditorsStorageName, editorID) as BaseEditController);
        }
Esempio n. 4
0
        /// <summary>
        /// 运行
        /// </summary>
        public void Start()
        {
            // 一个应用中只能有一个默认应用程序
            Default = this;
            TransactionPublic.Run("主应用程序", () =>
            {
                TransactionPublic.Run("应用程序初始化", () =>
                {
                    TransactionPublic.Run("准备启动", OnPreparing);

                    TransactionPublic.Run("本地配置加载", () =>
                    {
                        // 加载本地配置存储
                        if (ConfigStorageDirName.IsNotNullOrEmpty())
                        {
                            ConfigStoragePublic.LoadConfigStorages(AppPublic.GetAbsolutePath(ConfigStorageDirName));
                        }

                        // 加载Application扩展属性
                        ExtendAddonPublic.GetAddonExtendProperties(this);
                    });

                    TransactionPublic.Run("检索全局插件", () => {
                        AddonPublic.SearchRuntimeAddons(this);
                    });

                    #region 事件
                    TransactionPublic.Run("事件处理机准备", () =>
                    {
                        if (!EventProcessorList.IsNullOrEmpty())
                        {
                            EventPublic.ClearEventProcessor();
                            foreach (var EventProcessor in EventProcessorList)
                            {
                                var logObj = EventProcessor.Value;
                                EventPublic.AddEventProcessor(logObj);
                            }
                        }
                    });
                    #endregion 日志

                    #region  务器
                    TransactionPublic.Run("启动服务器列表", () =>
                    {
                        if (ServerList.IsNotNullOrEmpty())
                        {
                            foreach (var server in ServerList)
                            {
                                var serverObj = server.Value;
                                if (serverObj == null)
                                {
                                    throw new Exception("服务创建失败");
                                }
                                serverObj.Start();
                                EventPublic.Information("服务{0}启动完毕.", serverObj.ObjectToString());
                            }
                        }
                    });
                    #endregion  务
                });

                #region  序
                TransactionPublic.Run("启动程序", Run);
                #endregion  序

                TransactionPublic.Run("应用程序退出", () =>
                {
                    TransactionPublic.Run("扩展属性保存", () =>
                    {
                        // 保存本地配置存储
                        if (ConfigStorageDirName.IsNotNullOrEmpty())
                        {
                            ConfigStoragePublic.SaveConfigStorages(AppPublic.GetAbsolutePath(ConfigStorageDirName));
                        }
                    });
                });
            }, OnException);
        }