private bool ShouldCharactersChange(UITextField textField, Foundation.NSRange range, string replacementString) { if (textField.Text.Length + replacementString.Length > 51 || replacementString == " ") { return(false); } return(true); }
public void scrollOutputWindowToBottom() { if (outputWindow.Text.Length > 0) { Foundation.NSRange bottom = new Foundation.NSRange(outputWindow.Text.Length - 1, 1); outputWindow.ScrollRangeToVisible(bottom); } }
public override bool ShouldChangeCharacters(UITextField textField, Foundation.NSRange range, string replacementString) { if (textField is ErrorTextField) { (textField as ErrorTextField).IsErrorRevealed = false; } return(true); }
public override bool ShouldChangeCharacters(UITextField textField, Foundation.NSRange range, string replacementString) { if (Regex.IsMatch(textField.Text + replacementString, @"^\d+(,|\.)?\d{0,3}?$")) { return(true); } return(false); }
private bool ShouldCharactersChange(UITextField textField, Foundation.NSRange range, string replacementString) { if (textField.Text.Length + replacementString.Length > 51 || replacementString == " ") { ShowCustomAlert(LocalizationKeys.WrongPrivatePostingKey, textField); return(false); } return(true); }
public new bool ShouldChangeText(UITextView textView, Foundation.NSRange range, string text) { int selection = (int)range.Location; if (text.Equals(Backspace)) { currentText = currentText.Remove(selection, (int)range.Length); } else { currentText = currentText.Insert(selection, text); } return(true); }
public override bool ShouldChangeCharacters(UITextField textField, Foundation.NSRange range, string replacementString) { if (replacementString == string.Empty) { return(true); } if ((textField.Text + replacementString).Length == 17) { return(false); } if (Regex.IsMatch(replacementString, @"[_\w\.-]+")) { return(true); } return(false); }
public override bool ShouldChangeCharacters(UITextField textField, Foundation.NSRange range, string replacementString) { if (replacementString == " " && textField.Text.Length == 0) { return(false); } if (!string.IsNullOrEmpty(replacementString) && Char.IsDigit(Char.Parse(replacementString)) && textField.Text.Length == 0) { return(false); } if (!string.IsNullOrEmpty(replacementString) && !(replacementString == " " || Char.IsLetterOrDigit(Char.Parse(replacementString)))) { return(false); } if ((replacementString + textField.Text).Length > 40) { return(false); } return(true); }
public override bool ShouldChangeCharacters(UITextField textField, Foundation.NSRange range, string replacementString) { if (replacementString == "") { return(true); } if ((replacementString + textField.Text).Length > 40) { return(false); } if (replacementString.Contains(" ")) { return(false); } if (Regex.IsMatch(replacementString, @"[_\w\.-]+")) { return(true); } return(false); }
public unsafe static void SetBuffers(this IMTLArgumentEncoder This, IMTLBuffer [] buffers, nint [] offsets, Foundation.NSRange range) { fixed(void *handle = offsets) This.SetBuffers(buffers, (IntPtr)handle, range); }
public static bool TextWithinMaxLength(this ITextInput textInput, string?text, Foundation.NSRange range, string replacementString) { var currLength = text?.Length ?? 0; // fix a crash on undo if (range.Length + range.Location > currLength) { return(false); } if (textInput.MaxLength < 0) { return(true); } var addLength = replacementString?.Length ?? 0; var remLength = range.Length; var newLength = currLength + addLength - remLength; return(newLength <= textInput.MaxLength); }
public void Update(string text, int selection = -1) { if (currentText == null) { currentText = text; } var watch = new System.Diagnostics.Stopwatch(); watch.Start(); bool shouldReturn = false; Device.BeginInvokeOnMainThread(delegate { if (previousText == null) { return; } string trimmedExisting = previousText.Trim(); string trimmedNew = text.Trim(); if (trimmedExisting.Equals(trimmedNew)) { shouldReturn = true; } }); System.Threading.Tasks.Task.Run(delegate { #if __UWP__ Device.BeginInvokeOnMainThread(delegate { Text = text; }); #endif object result = CartoCSSParser.Parse(text); Device.BeginInvokeOnMainThread(delegate { #if __ANDROID__ TextFormatted = (SpannableStringBuilder)result; if (selection != -1) { SetSelection(selection); } #elif __IOS__ if (shouldReturn) { Log("Not updating Editor, as text hasn't changed (elapsed: " + watch.ElapsedMilliseconds + ")"); watch.Stop(); return; } AttributedText = (Foundation.NSMutableAttributedString)result; previousText = text; if (selection != -1) { SelectedRange = new Foundation.NSRange(selection, SelectedRange.Length); SetContentOffset(ContentOffset, true); } #elif __UWP__ Document.ApplyDisplayUpdates(); #endif System.Diagnostics.Debug.WriteLine("Text highlighting took: " + watch.ElapsedMilliseconds + " milliseconds"); watch.Stop(); }); }); }
public virtual override string GetAccessibilityString(Foundation.NSRange range) { throw new NotImplementedException(); }
public virtual override Foundation.NSData GetAccessibilityRtf(Foundation.NSRange range) { throw new NotImplementedException(); }
public virtual override CoreGraphics.CGRect GetAccessibilityFrame(Foundation.NSRange range) { throw new NotImplementedException(); }
public override bool ShouldChangeCharacters(UITextField textField, Foundation.NSRange range, string replacementString) { return(Validations.ValidateCode(replacementString)); }