Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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);
     }));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 4
0
 public ClassFieldRemoteMutator <DateTime?, DateTime?, ContT> BuildDateTimePickerNullable(
     Expression <Func <ContT, DateTime?> > getField, DateTimePickerView view,
     params Validate <DateTime?>[] validators)
 {
     return(Build(getField, view, validators));
 }