/// <summary> /// /// </summary> /// <param name="comparedState"></param> /// <returns></returns> public override bool IsSame(MaskManagerState comparedState) { if (comparedState == null) { return(false); } if (base.GetType() != comparedState.GetType()) { throw new NotImplementedException("Internal error"); } RegExpMaskManagerState state = (RegExpMaskManagerState)comparedState; if (EditText != state.EditText) { return(false); } if (CursorPosition != state.CursorPosition) { return(false); } if (SelectionAnchor != state.SelectionAnchor) { return(false); } return(true); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override string GetEditText(MaskManagerState state) { if (this._ignoreMaskBlank && ((LegacyMaskManagerState)state).IsEmpty()) { return(string.Empty); } return(((LegacyMaskManagerState)state).GetEditText(this._blank, this._saveLiteral)); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override string GetDisplayText(MaskManagerState state) { if (!_showPlaceHolders) { return(GetCurrentEditText()); } return(_logic.GetMaskedText(GetCurrentEditText(), _anySymbolPlaceHolder)); }
/// <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="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 object GetEditValue(MaskManagerState state) { if (((NumericMaskManagerState)state).IsNull) { return(null); } string editText = GetEditText(state); if (_formatters[0]._Is100Multiplied) { editText = NumericMaskLogic.Div100(editText); } if (editText.IndexOf('.') >= 0) { while (editText.EndsWith("0")) { editText = editText.Substring(0, editText.Length - 1); } } if (editText.EndsWith(".")) { editText = editText.Substring(0, editText.Length - 1); } if ((editText.Length == 0) || (editText == "-")) { editText = editText + '0'; } if (_hasValueType) { try { return(Convert.ChangeType(editText, _editValueTypeCode)); } catch { goto Label_00E6; } } try { return(Convert.ChangeType(editText, typeof(Int32))); } catch { } try { return(Convert.ChangeType(editText, typeof(Decimal))); } catch { } Label_00E6: return(null); }
/// <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); }
/// <summary> /// /// </summary> /// <param name="comparedState"></param> /// <returns></returns> public override bool IsSame(MaskManagerState comparedState) { if (comparedState == null) { return(false); } if (base.GetType() != typeof(LegacyMaskManagerState)) { throw new NotImplementedException("Internal error"); } if (comparedState.GetType() != typeof(LegacyMaskManagerState)) { throw new InvalidOperationException("Internal error"); } LegacyMaskManagerState state = (LegacyMaskManagerState)comparedState; if (this.CursorPositionElement != state.CursorPositionElement) { return(false); } if (this.CursorPositionInsideElement != state.CursorPositionInsideElement) { return(false); } if (this.SelectionAnchorElement != state.SelectionAnchorElement) { return(false); } if (this.SelectionAnchorInsideElement != state.SelectionAnchorInsideElement) { return(false); } if (!object.ReferenceEquals(this.Info, state.Info)) { throw new InvalidOperationException("Internal error"); } if (this.Elements.Length != state.Elements.Length) { throw new InvalidOperationException("Internal error"); } for (int i = 0; i < this.Elements.Length; i++) { if (this.Elements[i] != state.Elements[i]) { return(false); } } return(true); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override string GetDisplayText(MaskManagerState state) { return(((LegacyMaskManagerState)state).GetDisplayText(this._blank)); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override int GetCursorPosition(MaskManagerState state) { return(((LegacyMaskManagerState)state).DisplayCursorPosition); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override int GetSelectionAnchor(MaskManagerState state) { return(((RegExpMaskManagerState)state).SelectionAnchor); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override string GetEditText(MaskManagerState state) { return(((RegExpMaskManagerState)state).EditText); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override object GetEditValue(MaskManagerState state) { return(this.GetEditText(state)); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override int GetSelectionAnchor(MaskManagerState state) { return(((LegacyMaskManagerState)state).DisplaySelectionAnchor); }
/// <summary> /// /// </summary> /// <param name="state"></param> /// <returns></returns> protected override int GetCursorPosition(MaskManagerState state) { return(((RegExpMaskManagerState)state).CursorPosition); }