/// <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); }
/// <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()); }
/// <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); }
/// <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)); }
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); }
/// <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); }
/// <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)); }
public Model.Inner FindUnit(string _uuid) { Model.Inner inner = null; units_.TryGetValue(_uuid, out inner); return(inner); }
public Model.Inner FindModel(string _uuid) { Model.Inner inner = null; models.TryGetValue(_uuid, out inner); return(inner); }