Пример #1
0
        public virtual bool EndEdit()
        {
            bool flag = false;

            if (this.EndEditCore(true, false))
            {
                flag = true;
                GridViewRowInfo currentRow = this.gridViewElement.Template.CurrentRow;
                if (currentRow == null)
                {
                    return(true);
                }
                if (currentRow is GridViewNewRowInfo)
                {
                    flag = this.FinishEditingOperation();
                }
                else if (currentRow.IsModified)
                {
                    this.gridViewElement.Template.ListSource.BeginUpdate();
                    flag = currentRow.CallOnEndEdit();
                    this.gridViewElement.Template.ListSource.EndUpdate(false);
                    currentRow.IsModified = false;
                    if (currentRow.ViewTemplate.EnableCustomGrouping && currentRow.ViewTemplate.GroupDescriptors.Count > 0)
                    {
                        currentRow.ViewTemplate.Refresh();
                    }
                }
            }
            return(flag);
        }
Пример #2
0
        private bool FinishEditingOperation()
        {
            bool               flag1              = false;
            GridViewRowInfo    currentRow         = this.gridViewElement.Template.CurrentRow;
            GridViewNewRowInfo gridViewNewRowInfo = currentRow as GridViewNewRowInfo;

            if (gridViewNewRowInfo != null && gridViewNewRowInfo.Validated)
            {
                gridViewNewRowInfo.Validated = false;
                return(true);
            }
            bool flag2 = gridViewNewRowInfo != null;

            if (currentRow != null && (currentRow.IsAttached || flag2) && this.RaiseRowValidatingEvent(currentRow))
            {
                return(flag1);
            }
            if (currentRow != null && (currentRow.IsAttached || flag2))
            {
                this.RaiseRowValidatedEvent(currentRow);
            }
            bool flag3 = true;

            if (flag2 && !currentRow.IsModified && (gridViewNewRowInfo.ViewTemplate != null && gridViewNewRowInfo.ViewTemplate.ListSource != null))
            {
                gridViewNewRowInfo.ViewTemplate.ListSource.CreateATransactionForEveryValueSetting = true;
            }
            if (currentRow == null || !currentRow.IsModified)
            {
                return(flag3);
            }
            this.GridViewElement.Template.SynchronizationService.RemoveListener((IGridViewEventListener)this);
            try
            {
                if (flag2)
                {
                    flag3 = currentRow.CallOnEndEdit();
                }
                if (flag3)
                {
                    currentRow.IsModified = false;
                }
                return(flag3);
            }
            finally
            {
                this.GridViewElement.Template.SynchronizationService.AddListener((IGridViewEventListener)this);
            }
        }