Example #1
0
        /// <summary>
        /// Registers the xtra grid.
        /// </summary>
        /// <param name="editableService">The editable service.</param>
        /// <param name="control">The control.</param>
        /// <param name="register">if set to <c>true</c> [register].</param>
        private void RegisterXtraGridEditAdapter(IEditableService editableService, Control control, bool register)
        {
            Guard.ArgumentNotNull(editableService, "editableService");
            Guard.ArgumentNotNull(control, "control");

            foreach (Control ctrl in control.Controls)
            {
                if (ctrl is GridControl)
                {
                    if (register)
                    {
                        editableService.Register(ctrl);
                    }
                    else
                    {
                        editableService.UnRegister(ctrl);
                    }
                }

                if (ctrl.Controls.Count > 0)
                {
                    RegisterXtraGridEditAdapter(editableService, ctrl, register);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Registers the text edit.
        /// </summary>
        /// <param name="editableService">The editable service.</param>
        /// <param name="control">The control.</param>
        /// <param name="register">if set to <c>true</c> [register].</param>
        private void RegisterTextEdit(IEditableService editableService, Control control, bool register)
        {
            Guard.ArgumentNotNull(editableService, "editableService");
            Guard.ArgumentNotNull(control, "control");

            foreach (Control ctrl in control.Controls)
            {
                if (ctrl is TextEdit)
                {
                    if (register)
                    {
                        editableService.Register(ctrl);
                        ((TextEdit)ctrl).EnterMoveNextControl = true; // 设置可以通过Enter键将焦点移到下一控件
                    }
                    else
                    {
                        editableService.UnRegister(ctrl);
                    }
                }

                if (ctrl.Controls.Count > 0)
                {
                    RegisterTextEdit(editableService, ctrl, register);
                }
            }
        }
Example #3
0
        /// <summary>
        /// See <see cref="IBuilderStrategy.TearDown"/> for more information.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        public override object TearDown(IBuilderContext context, object item)
        {
            WorkItem workItem = StrategyUtility.GetWorkItem(context, item);

            if (workItem != null)
            {
                IEditableService editableService = workItem.Services.Get <IEditableService>();
                if (editableService != null && item is Control)
                {
                    RegisterTextEdit(editableService, (Control)item, false);
                }
            }
            return(base.TearDown(context, item));
        }
Example #4
0
        /// <summary>
        /// See <see cref="IBuilderStrategy.BuildUp"/> for more information.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="typeToBuild"></param>
        /// <param name="existing"></param>
        /// <param name="idToBuild"></param>
        /// <returns></returns>
        public override object BuildUp(IBuilderContext context, Type typeToBuild, object existing, string idToBuild)
        {
            WorkItem workItem = StrategyUtility.GetWorkItem(context, existing);

            if (workItem != null)
            {
                IEditableService editableService = workItem.Services.Get <IEditableService>();
                if (editableService != null && existing is Control)
                {
                    RegisterXtraGridEditAdapter(editableService, (Control)existing, true);
                }
            }

            return(base.BuildUp(context, typeToBuild, existing, idToBuild));
        }
        /// <summary>
        /// Registers the xtra grid.
        /// </summary>
        /// <param name="editableService">The editable service.</param>
        /// <param name="control">The control.</param>
        /// <param name="register">if set to <c>true</c> [register].</param>
        private void RegisterXtraGridEditAdapter(IEditableService editableService, Control control, bool register)
        {
            Guard.ArgumentNotNull(editableService, "editableService");
            Guard.ArgumentNotNull(control, "control");

            foreach (Control ctrl in control.Controls) {
                if (ctrl is GridControl) {
                    if (register)
                        editableService.Register(ctrl);
                    else
                        editableService.UnRegister(ctrl);
                }

                if (ctrl.Controls.Count > 0)
                    RegisterXtraGridEditAdapter(editableService, ctrl, register);
            }
        }
        /// <summary>
        /// Registers the text edit.
        /// </summary>
        /// <param name="editableService">The editable service.</param>
        /// <param name="control">The control.</param>
        /// <param name="register">if set to <c>true</c> [register].</param>
        private void RegisterTextEdit(IEditableService editableService, Control control, bool register)
        {
            Guard.ArgumentNotNull(editableService, "editableService");
            Guard.ArgumentNotNull(control, "control");

            foreach (Control ctrl in control.Controls) {
                if (ctrl is TextEdit)
                {
                    if (register) {
                        editableService.Register(ctrl);
                        ((TextEdit)ctrl).EnterMoveNextControl = true; // 设置可以通过Enter键将焦点移到下一控件
                    }
                    else
                        editableService.UnRegister(ctrl);
                }

                if (ctrl.Controls.Count > 0)
                    RegisterTextEdit(editableService, ctrl, register);
            }
        }