コード例 #1
0
        private bool RaiseRecordFieldWriteError(object target, long index, string propName, ref object value, Exception ex)
        {
            bool   retValue = true;
            object state    = value;

            if (Writer != null && Writer.HasRecordFieldWriteErrorSubscribed)
            {
                retValue = ChoFuncEx.RunWithIgnoreError(() => Writer.RaiseRecordFieldWriteError(target, index, propName, ref state, ex), true);
                if (retValue)
                {
                    value = state;
                }
            }
            else if (target is IChoNotifyRecordFieldWrite)
            {
                retValue = ChoFuncEx.RunWithIgnoreError(() => ((IChoNotifyRecordFieldWrite)target).RecordFieldWriteError(target, index, propName, ref state, ex), true);
                if (retValue)
                {
                    value = state;
                }
            }
            else if (CallbackRecordFieldWrite != null)
            {
                retValue = ChoFuncEx.RunWithIgnoreError(() => CallbackRecordFieldWrite.RecordFieldWriteError(target, index, propName, ref state, ex), true);
                if (retValue)
                {
                    value = state;
                }
            }
            return(retValue);
        }
コード例 #2
0
 private bool RaiseAfterRecordFieldWrite(object target, long index, string propName, object value)
 {
     if (Writer != null && Writer.HasAfterRecordFieldWriteSubscribed)
     {
         return(ChoFuncEx.RunWithIgnoreError(() => Writer.RaiseAfterRecordFieldWrite(target, index, propName, value), true));
     }
     else if (target is IChoNotifyRecordFieldWrite)
     {
         return(ChoFuncEx.RunWithIgnoreError(() => ((IChoNotifyRecordFieldWrite)target).AfterRecordFieldWrite(target, index, propName, value), true));
     }
     else if (CallbackRecordFieldWrite != null)
     {
         return(ChoFuncEx.RunWithIgnoreError(() => CallbackRecordFieldWrite.AfterRecordFieldWrite(target, index, propName, value), true));
     }
     return(true);
 }
コード例 #3
0
        private bool RaiseBeforeRecordFieldWrite(object target, long index, string propName, ref object value)
        {
            if (Writer != null && Writer.HasBeforeRecordFieldWriteSubscribed)
            {
                object state    = value;
                bool   retValue = ChoFuncEx.RunWithIgnoreError(() => Writer.RaiseBeforeRecordFieldWrite(target, index, propName, ref state), true);

                if (retValue)
                {
                    value = state;
                }

                return(retValue);
            }
            else if (target is IChoNotifyRecordFieldWrite)
            {
                object state    = value;
                bool   retValue = ChoFuncEx.RunWithIgnoreError(() => ((IChoNotifyRecordFieldWrite)target).BeforeRecordFieldWrite(target, index, propName, ref state), true);

                if (retValue)
                {
                    value = state;
                }

                return(retValue);
            }
            else if (CallbackRecordFieldWrite != null)
            {
                object state    = value;
                bool   retValue = ChoFuncEx.RunWithIgnoreError(() => CallbackRecordFieldWrite.BeforeRecordFieldWrite(target, index, propName, ref state), true);

                if (retValue)
                {
                    value = state;
                }

                return(retValue);
            }
            return(true);
        }