コード例 #1
0
        /// <summary>
        /// 编辑文档元素数值
        /// </summary>
        /// <param name="element">文档元素对象</param>
        /// <param name="editor">编辑器对象</param>
        /// <returns>操作是否成功</returns>
        public ElementValueEditResult EditValue(DomElement element, ElementValueEditor editor)
        {
            if (editor == null)
            {
                throw new ArgumentNullException("editor");
            }
            this._ElementInstance = element;
            ElementValueEditContext context = new ElementValueEditContext();

            context.Document     = this.Document;
            context.Element      = element;
            context.PropertyName = null;
            context.Editor       = editor;
            try
            {
                _CurrentEditContext           = context;
                _CurrentEditContext.EditStyle = editor.GetEditStyle(this, context);
                ElementValueEditResult result = editor.EditValue(this, context);
                return(result);
            }
            finally
            {
                _CurrentEditContext = null;
            }
        }
コード例 #2
0
 public virtual void SetEditor(Type elementType, ElementValueEditor editor)
 {
     _Editors[elementType] = editor;
 }