public IntegerInputBox() : base() { TextChanged += TextChangedEvent; InputScope = new InputScope() { Names = {new InputScopeName() {NameValue = InputScopeNameValue.Number }} }; }
public TextBoxFocusSelect() { GotFocus += OnGotFocus; LostFocus += OnLostFocus; TextChanged += OnTextChanged; KeyDown += OnKeyDown; // Make this a numeric TextBox InputScope = new InputScope(); InputScope.Names.Add(new InputScopeName { NameValue = InputScopeNameValue.NumberFullWidth }); }
// Constructor public MainPage() { InitializeComponent(); // Determine the visibility of the dark background. Visibility darkBackgroundVisibility = (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"]; // Icon dark or light if (darkBackgroundVisibility == Visibility.Visible) { BitmapImage bm = new BitmapImage(new Uri(@"/Assets/calculator.png", UriKind.RelativeOrAbsolute)); iconApp.Source = bm; BitmapImage arrow = new BitmapImage(new Uri(@"/Assets/next.png", UriKind.RelativeOrAbsolute)); Arrow.Source = arrow; } else { BitmapImage bm = new BitmapImage(new Uri(@"/Assets/calculatorBlack.png", UriKind.RelativeOrAbsolute)); iconApp.Source = bm; BitmapImage arrow = new BitmapImage(new Uri(@"/Assets/nextBlack.png", UriKind.RelativeOrAbsolute)); Arrow.Source = arrow; } stringDEC = ""; //Initial Base if (Models.BaseUpdate.firstTime == false) { Models.BaseUpdate.first(); } LabelBase1.Text = Models.BaseUpdate.nameShortBase1; LabelBase2.Text = Models.BaseUpdate.nameShortBase2; LabelBase3.Text = Models.BaseUpdate.nameShortBase3; LabelBase4.Text = Models.BaseUpdate.nameShortBase4; // Código de ejemplo para traducir ApplicationBar //BuildLocalizedApplicationBar(); //Input Text textBoxDEC.InputScope = null; InputScope scope = new InputScope(); InputScopeName name = new InputScopeName(); if (Models.BaseUpdate.nameShortBase1 == "HEX") { name.NameValue = InputScopeNameValue.Default; scope.Names.Clear(); scope.Names.Add(name); } else { name.NameValue = InputScopeNameValue.Number; scope.Names.Clear(); scope.Names.Add(name); } textBoxDEC.InputScope = scope; var asdf = textBoxDEC.InputScope.Names[0].GetType().Name.ToString(); }
public OneLineTextInputDialog( Window parent, String caption, String initialValue, Func <String, String?> validator, Func <String, Task <String?> > onOk, InputStyle inputRestriction = InputStyle.None ) { this.Owner = parent; this.WindowStartupLocation = WindowStartupLocation.CenterOwner; this.SourceInitialized += (x, y) => this.HideMinimizeAndMaximizeButtons(); this.initialValue = initialValue; this.validator = validator; InitializeComponent(); switch (inputRestriction) { default: break; case InputStyle.RoomUrl: // タッチキーボードの文字種を変更する var scope = new InputScope(); scope.Names.Add(new InputScopeName { NameValue = InputScopeNameValue.Url }); tbContent.InputScope = scope; break; } lbCaption.Content = caption; tbContent.Text = initialValue; tbContent.Focus(); updateOkButton(); tbContent.TextChanged += (sender, e) => updateOkButton(); btnCancel.Click += (sender, e) => Close(); tbContent.KeyDown += (sender, e) => { if (e.Key == Key.Enter) { btnOk.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); } }; btnOk.Click += async(sender, e) => { if (!updateOkButton()) { return; } var text = tbContent.Text.ToString().Trim(); var error = await onOk(text); if (error != null) { tbError.textOrGone(error ?? ""); btnOk.IsEnabled = false; } else { Close(); } }; }
public static void SetInputScope(DependencyObject obj, InputScope value) { obj.SetValue(InputScopeProperty, value); }
public static InputScope ToInputScope(this Keyboard self) { var result = new InputScope(); var name = new InputScopeName(); if (self == Keyboard.Default) { name.NameValue = InputScopeNameValue.Default; } else if (self == Keyboard.Chat) { name.NameValue = InputScopeNameValue.Default; } else if (self == Keyboard.Email) { name.NameValue = InputScopeNameValue.EmailUserName; } else if (self == Keyboard.Numeric) { name.NameValue = InputScopeNameValue.Number; } else if (self == Keyboard.Telephone) { name.NameValue = InputScopeNameValue.TelephoneNumber; } else if (self == Keyboard.Text) { name.NameValue = InputScopeNameValue.Default; } else if (self == Keyboard.Url) { name.NameValue = InputScopeNameValue.Url; } else if (self is CustomKeyboard) { var custom = (CustomKeyboard)self; bool capitalizedSentenceEnabled = (custom.Flags & KeyboardFlags.CapitalizeSentence) == KeyboardFlags.CapitalizeSentence; bool spellcheckEnabled = (custom.Flags & KeyboardFlags.Spellcheck) == KeyboardFlags.Spellcheck; bool suggestionsEnabled = (custom.Flags & KeyboardFlags.Suggestions) == KeyboardFlags.Suggestions; if (!capitalizedSentenceEnabled && !spellcheckEnabled && !suggestionsEnabled) { name.NameValue = InputScopeNameValue.Default; } if (!capitalizedSentenceEnabled && !spellcheckEnabled && suggestionsEnabled) { name.NameValue = InputScopeNameValue.Default; } if (!capitalizedSentenceEnabled && spellcheckEnabled && !suggestionsEnabled) { Debug.WriteLine("Keyboard: Suggestions cannot be disabled in Windows Phone if spellcheck is enabled"); name.NameValue = InputScopeNameValue.Default; } if (!capitalizedSentenceEnabled && spellcheckEnabled && suggestionsEnabled) { name.NameValue = InputScopeNameValue.Default; } if (capitalizedSentenceEnabled && !spellcheckEnabled && !suggestionsEnabled) { Debug.WriteLine("Keyboard: Suggestions cannot be disabled in Windows Phone if auto Capitalization is enabled"); name.NameValue = InputScopeNameValue.Default; } if (capitalizedSentenceEnabled && !spellcheckEnabled && suggestionsEnabled) { name.NameValue = InputScopeNameValue.Default; } if (capitalizedSentenceEnabled && spellcheckEnabled && !suggestionsEnabled) { Debug.WriteLine("Keyboard: Suggestions cannot be disabled in Windows Phone if spellcheck is enabled"); name.NameValue = InputScopeNameValue.Default; } if (capitalizedSentenceEnabled && spellcheckEnabled && suggestionsEnabled) { name.NameValue = InputScopeNameValue.Default; } } else { // Should never happens name.NameValue = InputScopeNameValue.Default; } result.Names.Add(name); return(result); }
public static InputScope ToInputScope(this Keyboard self) { if (self == null) { throw new ArgumentNullException("self"); } var result = new InputScope(); var name = new InputScopeName(); if (self == Keyboard.Default) { name.NameValue = InputScopeNameValue.Default; } else if (self == Keyboard.Chat) { name.NameValue = InputScopeNameValue.Chat; } else if (self == Keyboard.Email) { name.NameValue = InputScopeNameValue.EmailSmtpAddress; } else if (self == Keyboard.Numeric) { name.NameValue = InputScopeNameValue.Number; } else if (self == Keyboard.Telephone) { name.NameValue = InputScopeNameValue.TelephoneNumber; } else if (self == Keyboard.Text) { name.NameValue = InputScopeNameValue.Default; } else if (self == Keyboard.Url) { name.NameValue = InputScopeNameValue.Url; } else { var custom = (CustomKeyboard)self; var capitalizedSentenceEnabled = (custom.Flags & KeyboardFlags.CapitalizeSentence) == KeyboardFlags.CapitalizeSentence; var capitalizedWordsEnabled = (custom.Flags & KeyboardFlags.CapitalizeWord) == KeyboardFlags.CapitalizeWord; var capitalizedCharacterEnabled = (custom.Flags & KeyboardFlags.CapitalizeCharacter) == KeyboardFlags.CapitalizeCharacter; var spellcheckEnabled = (custom.Flags & KeyboardFlags.Spellcheck) == KeyboardFlags.Spellcheck; var suggestionsEnabled = (custom.Flags & KeyboardFlags.Suggestions) == KeyboardFlags.Suggestions; InputScopeNameValue nameValue = InputScopeNameValue.Default; if (capitalizedSentenceEnabled) { if (!spellcheckEnabled) { Log.Warning(null, "CapitalizeSentence only works when spell check is enabled"); } } else if (capitalizedWordsEnabled) { if (!spellcheckEnabled) { Log.Warning(null, "CapitalizeWord only works when spell check is enabled"); } nameValue = InputScopeNameValue.NameOrPhoneNumber; } if (capitalizedCharacterEnabled) { Log.Warning(null, "UWP does not support CapitalizeCharacter"); } name.NameValue = nameValue; } result.Names.Add(name); return(result); }
private void AddToCart_Click(object sender, EventArgs e) { StackPanel s = new StackPanel(); PhoneTextBox Quantity = new PhoneTextBox(); InputScope scope = new InputScope(); InputScopeName number = new InputScopeName(); number.NameValue = InputScopeNameValue.Number; scope.Names.Add(number); Quantity.Hint = "Quantity"; Quantity.InputScope = scope; s.Children.Add(Quantity); CustomMessageBox messageBox = new CustomMessageBox() { Caption = "Select Quantity", Message = "Select how many " + Product.Name + " do you want?", LeftButtonContent = "Add To Cart", Content = s, RightButtonContent = "Cancel" }; messageBox.Show(); messageBox.Dismissed += async(s1, e1) => { switch (e1.Result) { case CustomMessageBoxResult.LeftButton: var Current = ""; var allChecked = true; UserSettings.TryGetValue <string>("current_user", out Current); var AttributesArray = new List <string>(); for (int i = 0; i < Product.Attributes.Count; i++) { switch (Product.Attributes[i].AttributeControl) { case AttributeControlType.TextBox: var TmpText = (PhoneTextBox)Controls[i]; if (TmpText.Text.Equals("") && Product.Attributes[i].isRequired) { MessageBox.Show("You must fill " + Product.Attributes[i].Name); allChecked = false; } AttributesArray.Add(TmpText.Text); break; case AttributeControlType.DropdownList: var TmpDrop = (ListPicker)Controls[i]; if (TmpDrop.SelectedItem == null && Product.Attributes[i].isRequired) { MessageBox.Show("You must select " + Product.Attributes[i].Name); allChecked = false; } AttributesArray.Add(TmpDrop.SelectedItem.ToString()); break; case AttributeControlType.MultilineTextbox: var TmpTextM = (PhoneTextBox)Controls[i]; if (TmpTextM.Text.Equals("") && Product.Attributes[i].isRequired) { MessageBox.Show("You must fill " + Product.Attributes[i].Name); allChecked = false; } AttributesArray.Add(TmpTextM.Text); break; case AttributeControlType.RadioList: var TmpRadio = (List <RadioButton>)Controls[i]; var Count = 0; foreach (RadioButton r in TmpRadio) { if ((bool)r.IsChecked) { AttributesArray.Add(r.Content.ToString()); Count++; } } if (Count == 0 && Product.Attributes[i].isRequired) { MessageBox.Show("You must select " + Product.Attributes[i].Name); allChecked = false; } break; case AttributeControlType.Checkboxes: var TmpCheck = (List <CheckBox>)Controls[i]; var CountCheck = 0; foreach (CheckBox r in TmpCheck) { if ((bool)r.IsChecked) { AttributesArray.Add(r.Content.ToString()); CountCheck++; } } if (CountCheck == 0 && Product.Attributes[i].isRequired) { MessageBox.Show("You must select " + Product.Attributes[i].Name); allChecked = false; } break; } } if (allChecked) { if (Quantity.Text == "") { Quantity.Text = "1"; } var AddResult = await api.AddToCart(Current, Product.Id, Int32.Parse(Quantity.Text), AttributesArray.ToArray(), ShoppingCartType.ShoppingCart); if (AddResult) { RefreshCart = true; CustomMessageBox SuccessToast = new CustomMessageBox() { Caption = "Added Successfully", Message = "The product was added to your cart sucessfuly", LeftButtonContent = "Dismiss" }; SuccessToast.Show(); await Task.Delay(2500); SuccessToast.Dismiss(); } } break; } }; }
public static InputScope Unbox_InputScope(IntPtr val) { InputScope ret = (InputScope)NoesisGUI_PINVOKE.Unbox_InputScope(val); return(ret); }
public SupportAccountAskDialog() { _popup = new Popup(); Border border_root = new Border(); border_root.Margin = new Thickness(0, 0, 0, 0); //border_root.CornerRadius = new CornerRadius(8); border_root.Width = 0;//// Application.Current.Host.Content.ActualHeight; border_root.Height = 400; border_root.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xA1, 0x4E)); Grid grid_root = new Grid(); grid_root.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); grid_root.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); Border border_content = new Border(); border_content.VerticalAlignment = VerticalAlignment.Stretch; border_content.HorizontalAlignment = HorizontalAlignment.Stretch; border_content.Margin = new Thickness(15, 15, 15, 15); StackPanel panel_content = new StackPanel(); panel_content.HorizontalAlignment = HorizontalAlignment.Center; panel_content.VerticalAlignment = VerticalAlignment.Stretch; panel_content.HorizontalAlignment = HorizontalAlignment.Stretch; //BEGIN CONTENT TextBlock title = new TextBlock(); title.TextAlignment = TextAlignment.Center; title.Height = 55; title.Text = "Support"; title.FontSize = 30; panel_content.Children.Add(title); //current id TextBlock current = new TextBlock(); current.TextWrapping = TextWrapping.Wrap; current.Text = ""; panel_content.Children.Add(current); //add money TextBlock _id_title = new TextBlock(); _id_title.Text = "Account ID:"; panel_content.Children.Add(_id_title); //TextBox _id = new TextBox(); panel_content.Children.Add(_id); InputScope scope = new InputScope(); InputScopeName name = new InputScopeName(); name.NameValue = InputScopeNameValue.Number; scope.Names.Add(name); _id.InputScope = scope; //button Grid grid_btn = new Grid(); grid_btn.Margin = new Thickness(0, 50, 0, 0); grid_btn.Width = 750; //grid_btn.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(200, GridUnitType.Pixel) }); //grid_btn.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(250, GridUnitType.Pixel) }); //grid_btn.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); panel_content.Children.Add(grid_btn); Button btnOk = new Button(); btnOk.Content = "Ok"; btnOk.Name = "Ok"; //btnOk.Height = 55; //btnOk.Width = 100; btnOk.Padding = new Thickness(5, 5, 5, 5); btnOk.Click += btnOk_Click; //btnOk.FontSize = 34; grid_btn.Children.Add(btnOk); Grid.SetColumn(btnOk, 0); border_content.Child = panel_content; grid_root.Children.Add(border_content); border_root.Child = grid_root; _popup.Child = border_root; }
private void ApplyInputScope(InputScope scope) => _textBoxView?.SetInputScope(scope);
private async void SearchLocationButton(object sender, object e) { RoomInfo ri = null; try { Waiter(true); var tcs = new TaskCompletionSource<object>(); InputScope ins = new InputScope(); ins.Names.Add(new InputScopeName() { NameValue = InputScopeNameValue.TelephoneNumber }); TextBox roomNumber = new TextBox() { Text = "2 2102", InputScope = ins, BorderBrush = new SolidColorBrush(Colors.Gray) }; CustomMessageBox messageBox = new CustomMessageBox() { Title = "Find Room", Message = "Enter room number, in the form '24 1152'", Content = roomNumber, LeftButtonContent = "OK", RightButtonContent = "Cancel", IsFullScreen = false, }; messageBox.Dismissed += (s2, e2) => { if (e2.Result == CustomMessageBoxResult.LeftButton && !string.IsNullOrEmpty(roomNumber.Text)) { ri = RoomInfo.Parse(roomNumber.Text); } }; messageBox.Unloaded += (s2, e2) => tcs.SetResult(null); messageBox.Show(); await tcs.Task; await ShowMap(ri); } finally { Waiter(false); } }
private static InputScopeNameValue?GetInputScopeName(InputScope value) => value?.Names?.FirstOrDefault()?.NameValue;
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { shablon = Options.shablon; if (shablon == String.Empty) { shablon = "%ussd%"; } if (NavigationContext.QueryString.TryGetValue("NTYPE", out spgType)) { if (spgType == "PhoneType") { pgType = nTypes.PhoneType; restNum = 9; } else if (spgType == "SummaType") { pgType = nTypes.SummaType; restNum = 0; } else if (spgType == "NumberType4") { pgType = nTypes.NumberType4; restNum = 4; } else if (spgType == "NumberType14") { pgType = nTypes.NumberType14; restNum = 14; } else if (spgType == "All") { pgType = nTypes.All; restNum = 0; } else { pgType = nTypes.NumberType; restNum = 0; } restCount.Text = restNum.ToString(); } // Видимость для ввода номера телефона switch (pgType) { case nTypes.NumberType14: case nTypes.NumberType4: case nTypes.SummaType: case nTypes.NumberType: phoneNumberText.Visibility = System.Windows.Visibility.Collapsed; phoneNumberEdit.Visibility = System.Windows.Visibility.Collapsed; break; } // Видимость ввода суммы switch (pgType) { case nTypes.PhoneType: numberText.Visibility = System.Windows.Visibility.Collapsed; numberEdit.Visibility = System.Windows.Visibility.Collapsed; break; } // Видимость отсчета оставшегося количества цифр номера switch (pgType) { case nTypes.SummaType: case nTypes.NumberType: restText.Visibility = System.Windows.Visibility.Collapsed; restCount.Visibility = System.Windows.Visibility.Collapsed; break; } if (pgType != nTypes.SummaType) { numberText.Text = "Номер"; } phoneEdit.Text = CreateUSSD(String.Empty); InputScope inputScope = new InputScope(); InputScopeName inputScopeName = new InputScopeName(); inputScopeName.NameValue = InputScopeNameValue.NumberFullWidth; inputScope.Names.Add(inputScopeName); numberEdit.tbMain.InputScope = inputScope; numberEdit.Focus(); }
public static IntPtr Box_InputScope(InputScope val) { IntPtr ret = NoesisGUI_PINVOKE.Box_InputScope((int)val); return(ret); }
public void UpdateShortcutButtons() { if (DI == null) { return; } // Getting the list of buttons. var deviceName = DI.di.Name; CurrConfigList = AllShortcuts.GetShortcuts(deviceName); if (!String.IsNullOrEmpty(SerialPortPreferences?.ShortcutId)) { var preflist = AllShortcuts.GetShortcuts("", SerialPortPreferences.ShortcutId); if (preflist.Count > 0) { CurrConfigList = preflist; } } uiShortcutButtonList.Children.Clear(); Variables.Clear(); uiShortcutButtonList.ItemWidth = 120; uiShortcutButtonList.ItemHeight = 60; foreach (var shortcuts in CurrConfigList) { // Add in all values foreach (var(name, setting) in shortcuts.Settings) { setting.CmdName = name; switch (setting.InputType) { case VariableDescription.UiType.Hide: // Hiden values do nothing. break; case VariableDescription.UiType.TextBox: { var numberScope = new InputScope(); numberScope.Names.Add(new InputScopeName() { NameValue = InputScopeNameValue.Number }); var tb = new TextBox() { Header = setting.Label ?? setting.Name ?? name, InputScope = numberScope, Text = setting.Init.ToString(), Tag = setting, }; tb.TextChanged += SettingValueTextChanged; uiShortcutButtonList.Children.Add(tb); VariableSizedWrapGrid.SetColumnSpan(tb, 1); } break; case VariableDescription.UiType.Slider: { var slider = new Slider() { Header = setting.Label ?? setting.Name ?? name, Value = setting.Init, Margin = SliderMargin, Minimum = setting.Min, Maximum = setting.Max, Tag = setting, }; slider.ValueChanged += SliderValueChanged; uiShortcutButtonList.Children.Add(slider); VariableSizedWrapGrid.SetColumnSpan(slider, 1); } break; } Variables.SetCurrDouble(name, setting.Init); Variables.SetPreviousDouble(name, setting.Init); } FontFamily ff = new FontFamily("Segoe UI,Segoe MDL2 Assets"); // Add in the button proper foreach (var(name, shortcut) in shortcuts.Commands) { if (!shortcut.IsHidden) { var b = new Button() { Content = shortcut.Label ?? name, // no shortcut.Name... FontFamily = ff, Tag = shortcut, Width = 100, Margin = shortcutButtonMargin, VerticalAlignment = VerticalAlignment.Bottom, }; b.Click += OnShortcutClick; uiShortcutButtonList.Children.Add(b); } } } }
private void comboxField_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox comField = sender as ComboBox; StackPanel spLine = comField.Parent as StackPanel; ComboBoxItem comItem = comField.SelectedItem as ComboBoxItem; if (comItem != null && comItem.Content != null) { var spLineChildrenCount = spLine == null ? 3 : spLine.Children.Count; if (comItem.Content.ToString() == "match_all") { if (spLine != null && spLineChildrenCount == 4) { spLine.Children.RemoveAt(spLineChildrenCount - 1); } } else if (comItem.Content.ToString() == "_all") { } else { if (spLine != null && spLineChildrenCount == 3) { StackPanel spH = new StackPanel(); spH.Name = "spH"; spH.Orientation = Orientation.Horizontal; ComboBox comboBoxMustSearchKeyword = new ComboBox(); comboBoxMustSearchKeyword.BorderThickness = new Thickness(0.2); comboBoxMustSearchKeyword.Margin = new Thickness(10, 0, 0, 0); comboBoxMustSearchKeyword.Width = 110; //comboBoxMustSearchKeyword.SelectionChanged += comboxMust_SelectionChanged; comboBoxMustSearchKeyword.Items.Add(new ComboBoxItem() { Content = "term", IsSelected = true }); comboBoxMustSearchKeyword.Items.Add(new ComboBoxItem() { Content = "wildcard" }); comboBoxMustSearchKeyword.Items.Add(new ComboBoxItem() { Content = "prefix" }); //comboBoxMustSearchKeyword.Items.Add(new ComboBoxItem() { Content = "fuzzy" }); //comboBoxMustSearchKeyword.Items.Add(new ComboBoxItem() { Content = "range" }); comboBoxMustSearchKeyword.Items.Add(new ComboBoxItem() { Content = "query_string" }); comboBoxMustSearchKeyword.Items.Add(new ComboBoxItem() { Content = "text" }); comboBoxMustSearchKeyword.Items.Add(new ComboBoxItem() { Content = "missing" }); spH.Children.Add(comboBoxMustSearchKeyword); TextBox textBox = new TextBox(); textBox.Width = 150; textBox.BorderThickness = new Thickness(0.2); InputScope inputScope = new InputScope(); InputScopeName inputScopeName = new InputScopeName(); inputScopeName.NameValue = InputScopeNameValue.Digits; inputScope.Names.Add(inputScopeName); textBox.InputScope = inputScope; spH.Children.Add(textBox); spLine.Children.Add(spH); } } } }