public static LocalValue <DateTime?> BuildDateTimePicker(
            DateTimePickerView view, DateTime?defaultValue = null,
            params Validate <DateTime?>[] validators)
        {
            var result = new LocalValue <DateTime?>(defaultValue);

            view.BindReadWriteAndInitialize(result);
            validators.ForEach(y => result.AddValidatorAndRevalidate(y));
            return(result);
        }
 public static RemoteValue <DateTime?, RemOperResT> BuildDateTimePicker <RemOperResT>(
     DateTime?initialValue,
     Func <DateTime?, Task <RemOperResT> > saveOper,
     DateTimePickerView view,
     Func <RemOperResT, DateTime?> remToLocal,
     params Validate <DateTime?>[] validators)
 {
     return(new RemoteValue <DateTime?, RemOperResT>(
                initialValue,
                saveOper,
                remToLocal,
                initialization: x => {
         validators.ForEach(x.AddValidatorAndRevalidate);
         view.BindReadWriteAndInitialize(x);
     }));
 }
示例#3
0
 /// <summary>note: null value is represented by DateTime.MinValue.
 /// If you want to disallow it check for it in validator</summary>
 public ClassFieldRemoteMutator <DateTime?, DateTime, ContT> BuildDateTimePickerNotNull(
     Expression <Func <ContT, DateTime> > getRemoteField, DateTimePickerView view,
     params Validate <DateTime?>[] validators)
 {
     return(new ClassFieldRemoteMutator <DateTime?, DateTime, ContT>(
                getRemoteField,
                x => x ?? DateTime.MinValue,
                x => (DateTime?)x,
                x => _caller.SaveField(ExpressionUtil.ExtractFieldName(getRemoteField), x),
                x => {
         validators.ForEach(y => x.AddValidatorAndRevalidate(y));
         view.BindReadWriteAndInitialize(x);
     },
                postOperationConsumerOrNull: _postOperationConsumerOrNull,
                postOperationInvokeBeforeChanged: _postOperationInvokeBeforeChanged));
 }
示例#4
0
 public ClassFieldRemoteMutator <DateTime?, DateTime?, ContT> BuildDateTimePickerNullable(
     Expression <Func <ContT, DateTime?> > getField, DateTimePickerView view,
     params Validate <DateTime?>[] validators)
 {
     return(Build(getField, view, validators));
 }