/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override int GetSelectionAnchor(MaskManagerState state) { NumericMaskManagerState state2 = (NumericMaskManagerState)state; if (state2.IsNull) { return(0); } return(GetFormatter(state2).GetPositionFormatted(state2.EditText, state2.SelectionAnchor)); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override string GetEditText(MaskManagerState state) { NumericMaskManagerState state2 = (NumericMaskManagerState)state; if (state2.IsNegative) { return('-' + state2.EditText); } return(state2.EditText); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override string GetDisplayText(MaskManagerState state) { NumericMaskManagerState state2 = (NumericMaskManagerState)state; if (state2.IsNull) { return(string.Empty); } return(GetFormatter(state2).Format(state2.EditText)); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override int GetCursorPosition(MaskManagerState state) { NumericMaskManagerState state2 = (NumericMaskManagerState)state; if (state2.IsNull) { return(0); } return(GetFormatter(state2).GetPositionFormatted(state2.EditText, state2.CursorPosition)); }
/// <summary> /// /// </summary> /// <param name="newState"></param> /// <returns></returns> protected override bool IsValid(MaskManagerState newState) { NumericMaskManagerState state = newState as NumericMaskManagerState; if (state == null) { return(false); } if (!state.IsNull && (GetEditValue(state) == null)) { return(false); } return(true); }
NumericFormatter GetFormatter(NumericMaskManagerState state) { return(_formatters[state.IsNegative ? 1 : 0]); }