예제 #1
0
 /// <summary>
 /// 查找一个数据层
 /// </summary>
 /// <param name="_uuid"> 数据层唯一识别码</param>
 /// <returns>找到的数据层</returns>
 protected Model findModel(string _uuid)
 {
     Model.Inner inner = board_.modelCenter.FindModel(_uuid);
     if (null == inner)
     {
         return(null);
     }
     return(inner.model);
 }
예제 #2
0
 /// <summary>
 /// 查找一个数据层
 /// </summary>
 /// <param name="_uuid"> 数据层唯一识别码</param>
 /// <returns>找到的数据层</returns>
 protected Model findModel(string _uuid)
 {
     Model.Inner inner = board_.getModelCenter().FindUnit(_uuid);
     if (null == inner)
     {
         return(null);
     }
     return(inner.getUnit());
 }
예제 #3
0
 /// <summary>
 /// 取消观察一个数据层
 /// 当数据层冒泡时,会自动调用相应的处理函数
 /// </summary>
 /// <param name="_uuid">model的uuid</param>
 /// <param name="_action">行为</param>
 protected void removeObserver(string _uuid, string _action, Action <Model.Status, object> _handler)
 {
     Model.Inner inner = board_.getModelCenter().FindUnit(_uuid);
     if (null == inner)
     {
         return;
     }
     inner.RemoveObserver(_action, _handler);
 }
예제 #4
0
 /// <summary>删除数据层</summary>
 /// <param name="_uuid">数据层唯一识别码</param>
 /// <returns>错误</returns>
 public Error PopModel(string _uuid)
 {
     Model.Inner inner = board_.getModelCenter().FindUnit(_uuid);
     if (null == inner)
     {
         return(Error.NewAccessErr("model {0} not found", _uuid));
     }
     inner.Dismantle();
     return(board_.getModelCenter().Cancel(_uuid));
 }
예제 #5
0
 public Error Register(string _uuid, Model.Inner _inner)
 {
     board_.getLogger().Info("register model {0}", _uuid);
     if (units_.ContainsKey(_uuid))
     {
         return(Error.NewAccessErr("model {0} exists", _uuid));
     }
     units_[_uuid] = _inner;
     return(Error.OK);
 }
예제 #6
0
        /// <summary>添加数据层</summary>
        /// <param name="_uuid">数据层唯一识别码</param>
        /// <param name="_model">数据层实列</param>
        /// <returns>错误</returns>
        public Error PushModel(string _uuid, Model _model)
        {
            Model.Inner inner = new Model.Inner(_model);
            Error       err   = board_.getModelCenter().Register(_uuid, inner);

            if (!Error.IsOK(err))
            {
                return(err);
            }
            inner.Setup(board_);
            return(Error.OK);
        }
예제 #7
0
 /// <summary>注册数据层</summary>
 /// <param name="_uuid">数据层唯一识别码</param>
 /// <param name="_model">数据层实例</param>
 /// <returns>错误</returns>
 public Error RegisterModel(string _uuid, Model _model)
 {
     Model.Inner inner = new Model.Inner(_model);
     return(board_.modelCenter.Register(_uuid, inner));
 }
예제 #8
0
 public Model.Inner FindUnit(string _uuid)
 {
     Model.Inner inner = null;
     units_.TryGetValue(_uuid, out inner);
     return(inner);
 }
예제 #9
0
 public Model.Inner FindModel(string _uuid)
 {
     Model.Inner inner = null;
     models.TryGetValue(_uuid, out inner);
     return(inner);
 }