public void VerifyInputScopePropogates()
        {
            var numberBox = SetupNumberBox();

            RunOnUIThread.Execute(() =>
            {
                Content.UpdateLayout();
                var inputTextBox = TestUtilities.FindDescendents <TextBox>(numberBox).Where(e => e.Name == "InputBox").Single();

                Verify.AreEqual(1, inputTextBox.InputScope.Names.Count);
                Verify.AreEqual(InputScopeNameValue.Number, inputTextBox.InputScope.Names[0].NameValue, "The default InputScope should be 'Number'.");

                var scopeName       = new InputScopeName();
                scopeName.NameValue = InputScopeNameValue.CurrencyAmountAndSymbol;
                var scope           = new InputScope();
                scope.Names.Add(scopeName);

                numberBox.InputScope = scope;
                Content.UpdateLayout();

                Verify.AreEqual(1, inputTextBox.InputScope.Names.Count);
                Verify.AreEqual(InputScopeNameValue.CurrencyAmountAndSymbol, inputTextBox.InputScope.Names[0].NameValue, "The InputScope should be 'CurrencyAmountAndSymbol'.");
            });

            return;
        }
Esempio n. 2
0
        //Application Navigation
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                //Check the set account
                if (!CheckAccount())
                {
                    await CleanupPageResources();

                    return;
                }

                //Register page events
                RegisterPageEvents();

                //Bind list to ListView
                ListView_Items.ItemsSource = List_Feeds;

                //Set the autosuggestbox inputscope
                TextBox        SuggestTextBox = AVFunctions.FindVisualChild <TextBox>(txtbox_AddFeed);
                InputScope     inputScope     = new InputScope();
                InputScopeName inputScopeName = new InputScopeName()
                {
                    NameValue = InputScopeNameValue.Url
                };
                inputScope.Names.Add(inputScopeName);
                SuggestTextBox.InputScope = inputScope;

                //Load all the feeds
                await LoadFeeds();
            }
            catch { }
        }
Esempio n. 3
0
        static void IMEChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var ctrlText = d as System.Windows.Controls.TextBox;
            var ctrlPswd = d as System.Windows.Controls.PasswordBox;

            if (ctrlText == null && ctrlPswd == null)
            {
                return;
            }

            InputScope          scope     = new InputScope();
            InputScopeNameValue value     = (InputScopeNameValue)e.NewValue;
            InputScopeName      scopeName = new InputScopeName(value);

            scope.Names.Add(scopeName);

            if (ctrlText != null)
            {
                ctrlText.InputScope = scope;
            }

            if (ctrlPswd != null)
            {
                ctrlPswd.InputScope = scope;
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e)
        {
            base.OnElementChanged(e);

            var scope = new InputScope();
            var name  = new InputScopeName();

            name.NameValue = InputScopeNameValue.Search;
            scope.Names.Add(name);

            var phoneTextBox = new FormsPhoneTextBox {
                InputScope = scope
            };

            phoneTextBox.KeyUp += PhoneTextBoxOnKeyUp;

            phoneTextBox.TextChanged += PhoneTextBoxOnTextChanged;

            SetNativeControl(phoneTextBox);

            UpdateText();
            UpdatePlaceholder();
            UpdateAlignment();
            UpdateFont();
            UpdatePlaceholderColor();
            UpdateTextColor();
        }
Esempio n. 5
0
        private void DetectSupportedInputScope()
        {
            InputScope     scope     = new InputScope();
            InputScopeName scopeName = new InputScopeName();

            // Check that the ChatWithEmoji value is present.
            // (It's present starting with Windows 10, version 1607,
            //  the Target version for the app. This check returns false on earlier versions.)
            if (ApiInformation.IsEnumNamedValuePresent("Windows.UI.Xaml.Input.InputScopeNameValue", "ChatWithoutEmoji"))
            {
                // Set new ChatWithoutEmoji InputScope if present.
                scopeName.NameValue = InputScopeNameValue.ChatWithoutEmoji;
            }
            else
            {
                // Fall back to Chat InputScope.
                scopeName.NameValue = InputScopeNameValue.Chat;
            }

            // Set InputScope on messaging TextBox.
            scope.Names.Add(scopeName);
            chatBox.InputScope = scope;

            // For this example, set the TextBox text to show the selected InputScope.
            chatBox.Text = chatBox.InputScope.Names[0].NameValue.ToString();
        }
Esempio n. 6
0
        public async Task ShowPicker()
        {
            InputScope     scope     = new InputScope();
            InputScopeName scopeName = new InputScopeName {
                NameValue = InputScopeNameValue.Number
            };

            scope.Names.Add(scopeName);

            TextBox inputTextBox = new TextBox
            {
                AcceptsReturn = false,
                Height        = 32,
                InputScope    = scope
            };

            ContentDialog dialog = new ContentDialog
            {
                Content = inputTextBox,
                Title   = "Hoppa till sida",
                IsSecondaryButtonEnabled = true,
                PrimaryButtonText        = "Ok",
                SecondaryButtonText      = "Avbryt",
            };

            if (await dialog.ShowAsync() == ContentDialogResult.Primary)
            {
                int pageNumer;

                if (int.TryParse(inputTextBox.Text, out pageNumer) && pageNumer > 0 && pageNumer <= ForumThread.MaxPages)
                {
                    await LoadViewModel(ForumThread.Id.GetCleanIdForPage(pageNumer));
                }
            }
        }
Esempio n. 7
0
        private void newCategoryButton_Click(object sender, RoutedEventArgs e)
        {
            TextBlock categoryName = new TextBlock();

            categoryName.Text     = newCategoryTextBox.Text.ToString();
            categoryName.FontSize = 18;

            TextBox setBudgetBox = new TextBox();

            setBudgetBox.Width = 100;
            setBudgetBox.Name  = "setBudgetBox" + counter.ToString();

            InputScope     scope = new InputScope();
            InputScopeName name  = new InputScopeName();

            name.NameValue = InputScopeNameValue.Number;
            scope.Names.Add(name);
            setBudgetBox.InputScope = scope;
            counter += 1;

            TextBoxGrid.Children.Add(categoryName);
            TextBoxGrid.Children.Add(setBudgetBox);

            newCategoryGrid.Visibility = Visibility.Collapsed;
        }
Esempio n. 8
0
        public static void SetKeyboardFlags(this FormsTextBox Control, KeyboardFlags?flags)
        {
            if (flags == null)
            {
                return;
            }
            var result = new InputScope();
            var value  = InputScopeNameValue.Default;

            if (flags.Value.HasFlag(KeyboardFlags.CapitalizeSentence))
            {
                Control.IsSpellCheckEnabled = true;
            }
            else if (flags.Value.HasFlag(KeyboardFlags.CapitalizeWord))
            {
                value = InputScopeNameValue.NameOrPhoneNumber;
                Control.IsSpellCheckEnabled = true;
            }
            else
            {
                return;
            }


            InputScopeName nameValue = new InputScopeName();

            nameValue.NameValue = value;
            result.Names.Add(nameValue);
            Control.InputScope = result;
        }
Esempio n. 9
0
        protected virtual InputScope GetInputScope(InputType inputType)
        {
            var name  = new InputScopeName();
            var scope = new InputScope();

            switch (inputType)
            {
            case InputType.Email:
                name.NameValue = InputScopeNameValue.EmailNameOrAddress;
                break;

            case InputType.Name:
                name.NameValue = InputScopeNameValue.PersonalFullName;
                break;

            case InputType.Number:
                name.NameValue = InputScopeNameValue.Number;
                break;

            case InputType.Phone:
                name.NameValue = InputScopeNameValue.NameOrPhoneNumber;
                break;

            case InputType.Url:
                name.NameValue = InputScopeNameValue.Url;
                break;

            default:
                name.NameValue = InputScopeNameValue.Default;
                break;
            }
            scope.Names.Add(name);
            return(scope);
        }
        /// <summary>
        /// Create a single textbox control
        /// </summary>
        /// <param name="property"></param>
        /// <param name="name"></param>
        /// <param name="value"></param>
        /// <param name="digits"></param>
        /// <returns></returns>
        private TextBox CreateTextBox(PropertyInfo property, string name, object value, bool digits = false)
        {
            var scope     = new InputScope();
            var scopeName = new InputScopeName {
                NameValue = InputScopeNameValue.Number
            };

            scope.Names.Add(scopeName);
            string valueString = digits ? "0.0" : "0";

            if (value != null && value.ToString().Length > 0)
            {
                valueString = value.ToString();
            }

            var box = new TextBox
            {
                Name   = property.Name + name,
                Margin = PropertyInnerMargin,
                Width  = TextBoxWidth,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center,
                InputScope          = scope,
                Text = valueString
            };

            return(box);
        }
Esempio n. 11
0
        private void FilterChange(object sender, RoutedEventArgs e)
        {
            String option = ((RadioButton)sender).Name;

            InputScope     scope     = new InputScope();
            InputScopeName scopeName = new InputScopeName();

            switch (option)
            {
            case "name":
                contactFilterKind   = FilterKind.DisplayName;
                scopeName.NameValue = InputScopeNameValue.Text;
                break;

            case "phone":
                contactFilterKind   = FilterKind.PhoneNumber;
                scopeName.NameValue = InputScopeNameValue.TelephoneNumber;
                break;

            case "email":
                contactFilterKind   = FilterKind.EmailAddress;
                scopeName.NameValue = InputScopeNameValue.EmailSmtpAddress;
                break;

            default:
                contactFilterKind = FilterKind.None;
                break;
            }

            scope.Names.Add(scopeName);
            contactFilterString.InputScope = scope;
            contactFilterString.Focus();
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null && Element != null)
            {
                Element.BackgroundColor = Xamarin.Forms.Color.Transparent;
                Element.TextColor       = Xamarin.Forms.Color.White;
                Control.BorderBrush     = new SolidColorBrush(Colors.White);
                Control.BorderThickness = new Windows.UI.Xaml.Thickness(1);
                Control.Height          = 33;


                Control.GotFocus  += Control_GotFocus;
                Control.LostFocus += Control_LostFocus;
                Control.KeyDown   += Control_KeyDown;
                var scope = new InputScope();
                var name  = new InputScopeName {
                    NameValue = InputScopeNameValue.TelephoneNumber
                };

                scope.Names.Add(name);

                Control.InputScope = scope;
                Control.Focus(FocusState.Programmatic);
            }
        }
Esempio n. 13
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();

            e15.Click += (o, e) => { txtTipPercentage.Text = "15"; };
            e18.Click += (o, e) => { txtTipPercentage.Text = "18"; };
            e20.Click += (o, e) => { txtTipPercentage.Text = "20"; };

            txtTipPercentage.TextChanged += (o, e) => calc();
            txtTaxAmount.TextChanged     += (o, e) => calc();
            btnPeopleNext.Click          += (o, e) => pivot.SelectedIndex++;

            var numericScope     = new InputScope();
            var numericScopeName = new InputScopeName();

            numericScopeName.NameValue = InputScopeNameValue.NumberFullWidth;
            numericScope.Names.Add(numericScopeName);

            txtAmt.InputScope
                        = txtCreditCost.InputScope
                        = txtCreditValue.InputScope
                        = txtTaxAmount.InputScope
                        = txtTipPercentage.InputScope
                        = numericScope;

            // add 2 people by default
            Button_Click(null, null);
            Button_Click(null, null);
        }
Esempio n. 14
0
        protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e)
        {
            if (e.NewElement != null)
            {
                if (Control == null)                 // construct and SetNativeControl and suscribe control event
                {
                    var scope = new InputScope();
                    var name  = new InputScopeName();
                    //name.NameValue = InputScopeNameValue.;
                    scope.Names.Add(name);

                    SetNativeControl(new FormsTextBox {
                        InputScope = scope
                    });
                    Control.KeyUp       += PhoneTextBoxOnKeyUp;
                    Control.TextChanged += PhoneTextBoxOnTextChanged;
                }

                // Update control property
                UpdateText();
                UpdatePlaceholder();
                UpdateHorizontalTextAlignment();
                UpdateVerticalTextAlignment();
                UpdateFont();
                UpdatePlaceholderColor();
                UpdateTextColor();
            }

            base.OnElementChanged(e);
        }
Esempio n. 15
0
        private async void AddToWish_Click(object sender, EventArgs e)
        {
            var attributes = await HasAttributes(SelectedProduct.Id);

            if (!attributes)
            {
                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 " + SelectedProduct.Name + " do you want?",
                    LeftButtonContent  = "Add To Wishlist",
                    Content            = s,
                    RightButtonContent = "Cancel"
                };
                messageBox.Show();
                messageBox.Dismissed += async(s1, e1) =>
                {
                    switch (e1.Result)
                    {
                    case CustomMessageBoxResult.LeftButton:
                        var Customer = await api.GetCustomersByEmail(Helper.CurrentCustomer());

                        if (Quantity.Text == "")
                        {
                            Quantity.Text = "1";
                        }
                        var AddResult = await api.AddToCart(Customer.First().Email, SelectedProduct.Id, Int32.Parse(Quantity.Text), new String[] { "" }, ShoppingCartType.Wishlist);

                        if (AddResult)
                        {
                            CustomMessageBox SuccessToast = new CustomMessageBox()
                            {
                                Caption           = "Added Successfully",
                                Message           = "The product was added to your wishlist sucessfuly",
                                LeftButtonContent = "Dismiss"
                            };
                            SuccessToast.Show();
                            await Task.Delay(2000);

                            SuccessToast.Dismiss();
                        }
                        break;
                    }
                };
            }
            else
            {
                NavigationService.Navigate(new Uri("/Pages/ProductDetails.xaml?ProdId=" + SelectedProduct.Id, UriKind.Relative));
            }
        }
Esempio n. 16
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);


            if (Control != null)
            {
                Element.BackgroundColor = Xamarin.Forms.Color.Transparent;
                Element.TextColor       = Xamarin.Forms.Color.White;
                Control.BorderBrush     = new SolidColorBrush(Colors.White);
                Control.BorderThickness = new Windows.UI.Xaml.Thickness(1);
                Control.Height          = 33;


                Control.VerticalContentAlignment = VerticalAlignment.Center;

                //Control.Padding = new Windows.UI.Xaml.Thickness(5,0, 0, 0);

                //Control.SetTextColor(Android.Graphics.Color.Rgb(255,255,255));

                var entry = Element as HACCPEntry;
                if (entry != null && entry.ShowPlusMinus)
                {
                    Control.KeyDown += Control_KeyDown;

                    var scope = new InputScope();
                    var name  = new InputScopeName();
                    name.NameValue = InputScopeNameValue.TelephoneNumber;
                    scope.Names.Add(name);

                    Control.InputScope = scope;
                }
                else if (entry != null && entry.IsSearchbox)
                {
                    Control.KeyDown += Search_Control_KeyDown;
                    Control.Padding  = new Windows.UI.Xaml.Thickness(30, 0, 0, 0);
                    var scope = new InputScope();
                    var name  = new InputScopeName();
                    name.NameValue = InputScopeNameValue.Search;
                    scope.Names.Add(name);
                    Control.InputScope = scope;
                }

                Control.GotFocus         += Control_GotFocus;
                Control.LostFocus        += Control_LostFocus;
                Control.IsEnabledChanged += Control_IsEnabledChanged;


                if (Element != null && !string.IsNullOrEmpty(Element.Placeholder))
                {
                    var placeHolder = Element.Placeholder;
                    var length      = Device.Idiom == TargetIdiom.Tablet ? 42 : 33;
                    if (placeHolder.Length > length)
                    {
                        Element.Placeholder = string.Format("{0}...", placeHolder.Substring(0, length));
                    }
                }
            }
        }
Esempio n. 17
0
    protected override void OnApplyTemplate()
    {
        base.OnApplyTemplate();
        InputScope     scope     = new InputScope();
        InputScopeName scopeName = new InputScopeName();

        scopeName.NameValue = InputScopeNameValue.NumberFullWidth;
        scope.Names.Add(scopeName);
    }
Esempio n. 18
0
        private void EstableceTecladoAlfaNumerico()
        {
            InputScope     IPNum  = new InputScope();
            InputScopeName IPNNum = new InputScopeName();

            IPNNum.NameValue = InputScopeNameValue.AlphanumericFullWidth;
            IPNum.Names.Add(IPNNum);
            T_Letra.InputScope = IPNum;
        }
Esempio n. 19
0
        void MainPageLoaded(object sender, RoutedEventArgs e)
        {
            var numericScope     = new InputScope();
            var numericScopeName = new InputScopeName();

            numericScopeName.NameValue = InputScopeNameValue.Number;
            numericScope.Names.Add(numericScopeName);
            numberTextBox.InputScope = numericScope;
        }
Esempio n. 20
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var scope     = new InputScope();
            var scopeName = new InputScopeName();

            scopeName.NameValue = (InputScopeNameValue)value;
            scope.Names.Add(scopeName);
            return(scope);
        }
        public static InputScope ToInputScope(this InputScopeNameValue inputScopeNameValue)
        {
            var inputScope     = new InputScope();
            var inputScopeName = new InputScopeName {
                NameValue = inputScopeNameValue
            };

            inputScope.Names.Add(inputScopeName);
            return(inputScope);
        }
Esempio n. 22
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            InputScope     scope = new InputScope();
            InputScopeName name  = new InputScopeName();

            name.NameValue = InputScopeNameValue.Number;
            scope.Names.Add(name);

            textBox1.InputScope = scope;
        }
Esempio n. 23
0
        private void onPageLoaded(object sender, RoutedEventArgs e)
        {
            InputScope     inputScope     = new InputScope();
            InputScopeName inputScopeName = new InputScopeName();

            inputScopeName.NameValue = InputScopeNameValue.Url;

            inputScope.Names.Add(inputScopeName);
            textBox1.InputScope = inputScope;
        }
Esempio n. 24
0
        private void EstableceTecladoNumerico()
        {
            // http://create.msdn.com/en-US/education/quickstarts/Working_with_Text_on_the_Windows_Phone
            InputScope     IPNum  = new InputScope();
            InputScopeName IPNNum = new InputScopeName();

            IPNNum.NameValue = InputScopeNameValue.TelephoneNumber;
            IPNum.Names.Add(IPNNum);
            T_DNI.InputScope = IPNum;
        }
Esempio n. 25
0
 private void setSIPType(InputScopeNameValue isnvSIP)
 {
     if (this.textBox1 != null)
     {
         InputScope     inps = new InputScope();
         InputScopeName isN  = new InputScopeName();
         isN.NameValue = isnvSIP;
         inps.Names.Add(isN);
         this.textBox1.InputScope = inps;
     }
 }
Esempio n. 26
0
        private void TextBoxDemo1_Loaded(object sender, RoutedEventArgs e)
        {
            // 在 CodeBehind 端设置 TextBox 的 InputScope
            InputScope     scope = new InputScope();
            InputScopeName name  = new InputScopeName();

            name.NameValue = InputScopeNameValue.ChineseFullWidth;
            scope.Names.Add(name);

            textBox4.InputScope = scope;
        }
    private InputScope Scope(InputScopeNameValue value)
    {
        InputScope     scope = new InputScope();
        InputScopeName name  = new InputScopeName()
        {
            NameValue = value
        };

        scope.Names.Add(name);
        return(scope);
    }
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            InputScope     scope = new InputScope();
            InputScopeName name  = new InputScopeName();

            name.NameValue = InputScopeNameValue.Number;
            scope.Names.Add(name);

            textBoxBaseRadius.InputScope = scope;
            textBoxHeight.InputScope     = scope;
        }
Esempio n. 29
0
        public Home()
        {
            InitializeComponent();

            var numericScope     = new InputScope();
            var numericScopeName = new InputScopeName();

            numericScopeName.NameValue = InputScopeNameValue.Number;
            numericScope.Names.Add(numericScopeName);
            TextBox_NumCalc.InputScope         = numericScope;
            TextBox_NumHowManyTimes.InputScope = numericScope;
        }
Esempio n. 30
0
        private void SetSmsInputScope()
        {
            InputScope     inputScope      = new InputScope();
            InputScopeName inputScopeName1 = new InputScopeName();
            int            num             = 52;

            inputScopeName1.NameValue = ((InputScopeNameValue)num);
            InputScopeName inputScopeName2 = inputScopeName1;

            inputScope.Names.Add(inputScopeName2);
            this.textBoxConfirmationCode.InputScope = inputScope;
        }