示例#1
0
 public static void SetInputScope(this TextBox tb, InputScopeNameValue inputScopeNameValue)
 {
     tb.InputScope = new InputScope
     {
         Names = { new InputScopeName { NameValue = inputScopeNameValue } }
     };
 }
        public static UIKeyboardType ConvertInputScopeToKeyboardType(InputScopeNameValue value)
        {
            switch (value)
            {
            default:
                return(UIKeyboardType.Default);

            case InputScopeNameValue.Number:
                return(UIKeyboardType.NumberPad);

            case InputScopeNameValue.NumberFullWidth:
            case InputScopeNameValue.NumericPin:
                return(UIKeyboardType.NumbersAndPunctuation);

            case InputScopeNameValue.CurrencyAmount:
                return(UIKeyboardType.DecimalPad);

            case InputScopeNameValue.Url:
                return(UIKeyboardType.Url);

            case InputScopeNameValue.TelephoneNumber:
                return(UIKeyboardType.PhonePad);

            case InputScopeNameValue.Search:
                return(UIKeyboardType.Default);

            case InputScopeNameValue.EmailSmtpAddress:
                return(UIKeyboardType.EmailAddress);
            }
        }
示例#3
0
 /// <summary>
 /// </summary>
 /// <param name="question">The text of the question.</param>
 /// <param name="inputScope">
 /// The type of software keyboard to display (if applicable).
 /// </param>
 public TextQuestion(
     string question,
     InputScopeNameValue inputScope = InputScopeNameValue.Default)
 {
     Question   = question;
     InputScope = inputScope;
 }
        ///<summary>
        /// Converts the given value to InputScope type
        ///</summary>
        /// <param name="context">
        /// The conversion context.
        /// </param>
        /// <param name="culture">
        /// The current culture that applies to the conversion.
        /// </param>
        /// <param name="source">
        /// The source object to convert from.
        /// </param>
        /// <returns>
        /// InputScope object with a specified scope name, otherwise InputScope with Default scope.
        /// </returns>

        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object source)
        {
            string stringSource    = source as string;
            InputScopeNameValue sn = InputScopeNameValue.Default;
            InputScope          inputScope;

            if (null != stringSource)
            {
                stringSource = stringSource.Trim();

                if (-1 != stringSource.LastIndexOf('.'))
                {
                    stringSource = stringSource.Substring(stringSource.LastIndexOf('.') + 1);
                }

                if (!stringSource.Equals(String.Empty))
                {
                    sn = (InputScopeNameValue)Enum.Parse(typeof(InputScopeNameValue), stringSource);
                }
            }

            inputScope = new InputScope();
            inputScope.Names.Add(new InputScopeName(sn));
            return(inputScope);
        }
示例#5
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;
            }
        }
        ///<summary>
        /// Converts the given value to InputScope type
        ///</summary>
        /// <param name="context">
        /// The conversion context.
        /// </param>
        /// <param name="culture">
        /// The current culture that applies to the conversion.
        /// </param>
        /// <param name="source">
        /// The source object to convert from.
        /// </param>
        /// <returns>
        /// InputScope object with a specified scope name, otherwise InputScope with Default scope.
        /// </returns>

        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object source)
        {
            string stringSource    = source as string;
            InputScopeNameValue sn = InputScopeNameValue.Default;
            InputScope          inputScope;

            if (null != stringSource)
            {
                ReadOnlySpan <char> spanSource = stringSource;
                spanSource = spanSource.Trim();

                int periodPos = spanSource.LastIndexOf('.');
                if (periodPos != -1)
                {
                    spanSource = spanSource.Slice(periodPos + 1);
                }

                if (!spanSource.IsEmpty)
                {
                    sn = Enum.Parse <InputScopeNameValue>(spanSource);
                }
            }

            inputScope = new InputScope();
            inputScope.Names.Add(new InputScopeName(sn));
            return(inputScope);
        }
示例#7
0
        public Page1()
        {
            InitializeComponent();

            if (!settings.Contains("hostname"))
            {
                settings.Add("hostname", "localhost");
            }

            if (!settings.Contains("port"))
            {
                settings.Add("port", "8080");
            }

            txt_hostname.Text = settings["hostname"].ToString();
            txt_port.Text     = settings["port"].ToString();


            InputScopeNameValue digitInputScopeNameValue = InputScopeNameValue.TelephoneNumber;

            txt_port.InputScope = new InputScope()
            {
                Names = { new InputScopeName()
                          {
                              NameValue = digitInputScopeNameValue
                          } }
            };
        }
        //NativeTextAlignment GetNativeHorizontalTextAlignment(EditorHandler editorHandler) =>
        //	GetNativeEditor(editorHandler).TextAlignment;

        bool IsInputScopeEquals(InputScope inputScope, InputScopeNameValue nameValue)
        {
            if (inputScope == null || inputScope.Names.Count == 0)
            {
                return(false);
            }

            return(inputScope.Names[0].NameValue == nameValue);
        }
 public static void SetInputScope(this TextBox tb, InputScopeNameValue inputScopeNameValue)
 {
     tb.InputScope = new InputScope
     {
         Names = { new InputScopeName {
                       NameValue = inputScopeNameValue
                   } }
     };
 }
示例#10
0
        public InputTypes ToNativeType(InputScopeNameValue value)
        {
            if (lookup.TryGetValue(value, out InputTypes result))
            {
                return(result);
            }

            return(InputTypes.TextVariationNormal);
        }
示例#11
0
        private void UpdateInputScope(InputScopeNameValue inputScopeName)
        {
            if (this.IsTemplateApplied)
            {
                var scope = new InputScope();
                scope.Names.Add(new InputScopeName(inputScopeName));

                this.textBox.InputScope = scope;
            }
        }
        public static InputScope ToInputScope(this InputScopeNameValue inputScopeNameValue)
        {
            var inputScope     = new InputScope();
            var inputScopeName = new InputScopeName {
                NameValue = inputScopeNameValue
            };

            inputScope.Names.Add(inputScopeName);
            return(inputScope);
        }
    private InputScope Scope(InputScopeNameValue value)
    {
        InputScope     scope = new InputScope();
        InputScopeName name  = new InputScopeName()
        {
            NameValue = value
        };

        scope.Names.Add(name);
        return(scope);
    }
示例#14
0
        public static UITextAutocapitalizationType ConvertInputScopeToCapitalization(InputScopeNameValue value)
        {
            switch (value)
            {
            case InputScopeNameValue.PersonalFullName:
                return(UITextAutocapitalizationType.Sentences);

            default:
                return(UITextAutocapitalizationType.None);
            }
        }
示例#15
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;
     }
 }
示例#16
0
 static InputScopeNameValue ParseValue(string s)
 {
     for (int i = (int)InputScopeNameValue.EnumString; i <= (int)InputScopeNameValue.ApplicationEnd; i++)
     {
         InputScopeNameValue isnv = (InputScopeNameValue)i;
         if (String.Compare(s, isnv.ToString(), StringComparison.Ordinal) == 0)
         {
             return(isnv);
         }
     }
     throw new ArgumentException();
 }
示例#17
0
 private string GetNewActiveInputScopeText(InputScopeNameValue currentScope)
 {
     switch (currentScope)
     {
         case InputScopeNameValue.Default:
             return ACTIVE_INPUT_PREFIX_TEXT + " General";
         case InputScopeNameValue.Number:
             return ACTIVE_INPUT_PREFIX_TEXT + " Numbers only";
         default:
             return "";
     }
 }
示例#18
0
        //A method that restricts input to numbers only for a callable textbox control.
        private void SetInputScope(TextBox textBoxControl)
        {
            InputScopeNameValue digitsInputNameValue = InputScopeNameValue.TelephoneNumber;

            textBoxControl.InputScope = new InputScope()
            {
                Names = { new InputScopeName()
                          {
                              NameValue = digitsInputNameValue
                          } }
            };
        }
示例#19
0
        private void SetInputScope()
        {
            InputScopeNameValue digitsInputNameValue = InputScopeNameValue.Digits;

            SliderValueTextBox.InputScope = new InputScope()
            {
                Names = { new InputScopeName()
                          {
                              NameValue = digitsInputNameValue
                          } }
            };
        }
        private InputScope CreateInputScope(InputScopeNameValue value)
        {
            var s = new InputScope
            {
                Names =
                {
                    new InputScopeName()
                    {
                        NameValue = value
                    }
                }
            };

            return(s);
        }
示例#21
0
 private void SetDigitInputScope(TextBox textBoxControl)
 {
     try
     {
         InputScopeNameValue digitalInputNameValue = InputScopeNameValue.TelephoneNumber;
         textBoxControl.InputScope = new InputScope()
         {
             Names = { new InputScopeName()
                       {
                           NameValue = digitalInputNameValue
                       } }
         };
     }
     catch (Exception exception)
     {
         ExceptionHandler.ShowExceptionMessageAndLog(exception, true);
     }
 }
示例#22
0
        /// <summary>
        /// Standard WP7 method which is running always when user navigates to page.
        /// </summary>
        /// <param name="e">NavigationService argument</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if ((Application.Current as App).ApplicationState == App.AplicationStates.Activated)
            {
                // Do what you have to do when application is activated and change state for runing.
                (Application.Current as App).ApplicationState = App.AplicationStates.Runing;
            }
            if (OperationsOnSettings.Instance.IsRegistered())
            {
                NavigationService.GoBack();
            }

            base.OnNavigatedTo(e);
            InputScopeNameValue PhoneKeyboard = InputScopeNameValue.TelephoneNumber;
            InputScopeNameValue UrlKeyboard   = InputScopeNameValue.Url;

            ImeiTextBox.InputScope = new InputScope()
            {
                Names = { new InputScopeName()
                          {
                              NameValue = PhoneKeyboard
                          } }
            };

            PhoneNumberTextBox.InputScope = new InputScope()
            {
                Names = { new InputScopeName()
                          {
                              NameValue = PhoneKeyboard
                          } }
            };

            ServerUrlTextBox.InputScope = new InputScope()
            {
                Names = { new InputScopeName()
                          {
                              NameValue = UrlKeyboard
                          } }
            };
        }
示例#23
0
 ///<summary>
 /// Constructor that takes name 
 ///</summary>
 public InputScopeName(InputScopeNameValue nameValue)
 {
     _nameValue = nameValue; 
 }
        private InputScope CreateInputScope(InputScopeNameValue value)
        {
            var s = new InputScope
                        {
                            Names =
                                {
                                    new InputScopeName() { NameValue = value }
                                }
                        };

            return s;
        }
        private System.Windows.Input.InputScope InputScopeWithName(InputScopeNameValue nameValue)
        {
            InputScope scope = new InputScope();
            InputScopeName name = new InputScopeName();

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

            return scope;
        }
 public InputScopeName(InputScopeNameValue nameValue)
 {
 }
示例#27
0
        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);
        }
示例#28
0
 public InputScopeName(InputScopeNameValue value)
 {
     NameValue = value;
 }
示例#29
0
 public static void SetIME(DependencyObject obj, InputScopeNameValue value)
 {
     obj.SetValue(IMEProperty, value);
 }
示例#30
0
        public void updateUi()
        {
            foreach (string name in EnumHelper.GetEnumStrings <MeasurementType>())
            {
                PanoramaItem mainPanoramaPage = new PanoramaItem()
                {
                    Name = "mainPanoramaPage" + name, Header = name, Foreground = new SolidColorBrush(Colors.Black)
                };

                ScrollViewer scrollViewer = new ScrollViewer()
                {
                    Name = "scrollViewer" + name, VerticalScrollBarVisibility = ScrollBarVisibility.Hidden
                };

                StackPanel innerStackPanel = new StackPanel()
                {
                    Name = "innerStackPanel" + name
                };

                TextBlock fromTextBlock = new TextBlock()
                {
                    Name = "fromTextBlock" + name, Text = "from"
                };

                TextBox inputTextBox = new TextBox()
                {
                    Name = "inputTextBox" + name
                };
                inputTextBox.TextChanged += new TextChangedEventHandler(textChangedHandler);
                InputScopeNameValue numbersOnly = InputScopeNameValue.TelephoneNumber;
                inputTextBox.InputScope = new InputScope()
                {
                    Names = { new InputScopeName()
                              {
                                  NameValue = numbersOnly
                              } }
                };

                DataTemplate fromFullModeItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\" FontSize=\"64\"/></DataTemplate>");
                DataTemplate fromItemTemplate         = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\"/></DataTemplate>");

                ListPicker fromListPicker = new ListPicker {
                    Name = "fromListPicker" + name, FullModeItemTemplate = fromFullModeItemTemplate, ItemTemplate = fromItemTemplate
                };
                foreach (MeasurementUnit measurementUnit in measurementUnits)
                {
                    if (measurementUnit.Type.ToString().Equals(name, StringComparison.OrdinalIgnoreCase))
                    {
                        fromListPicker.Items.Add(measurementUnit);
                    }
                }
                fromListPicker.SelectionChanged += new SelectionChangedEventHandler(selectionChangedHandler);

                TextBlock toTextBlock = new TextBlock()
                {
                    Name = "toTextBlock" + name, Text = "to"
                };

                DataTemplate toFullModeItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\" FontSize=\"64\"/></DataTemplate>");
                DataTemplate toItemTemplate         = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\"/></DataTemplate>");

                ListPicker toListPicker = new ListPicker {
                    Name = "toListPicker" + name, FullModeItemTemplate = toFullModeItemTemplate, ItemTemplate = toItemTemplate
                };
                foreach (MeasurementObject measurementObject in measurementObjects)
                {
                    if (measurementObject.Type.ToString().Equals(name, StringComparison.OrdinalIgnoreCase))
                    {
                        toListPicker.Items.Add(measurementObject);
                    }
                }
                toListPicker.SelectionChanged += new SelectionChangedEventHandler(selectionChangedHandler);

                TextBlock isAboutTextBlock = new TextBlock()
                {
                    Name = "isAboutTextBlock" + name, Text = "is about", Visibility = System.Windows.Visibility.Collapsed
                };

                TextBlock resultTextBlock = new TextBlock()
                {
                    Name = "resultTextBlock" + name, FontSize = 64, TextAlignment = System.Windows.TextAlignment.Center, Visibility = System.Windows.Visibility.Collapsed, TextWrapping = TextWrapping.Wrap
                };

                AdControl ad = new AdControl()
                {
                    ApplicationId = "bb68fbc1-ad47-45b2-b045-0d5699d83b6b", AdUnitId = "10016008", Width = 300, Height = 50, Margin = new Thickness(20)
                };

                innerStackPanel.Children.Add(fromTextBlock);
                innerStackPanel.Children.Add(inputTextBox);
                innerStackPanel.Children.Add(fromListPicker);
                innerStackPanel.Children.Add(toTextBlock);
                innerStackPanel.Children.Add(toListPicker);
                innerStackPanel.Children.Add(isAboutTextBlock);
                innerStackPanel.Children.Add(resultTextBlock);
                innerStackPanel.Children.Add(ad);

                scrollViewer.Content = innerStackPanel;

                mainPanoramaPage.Content = scrollViewer;

                mainView.Items.Add(mainPanoramaPage);
            }
        }
示例#31
0
        public void updateUi()
        {
            IsolatedStorageFileStream file = new IsolatedStorageFileStream("coin.xml", FileMode.Open, IsolatedStorageFile.GetUserStoreForApplication());
            XDocument doc = XDocument.Load(file);

            file.Close();

            XElement root    = (from cur in doc.Descendants("{http://www.ecb.int/vocabulary/2002-08-01/eurofxref}Cube") select cur).FirstOrDefault();
            XElement subroot = root.Elements().FirstOrDefault();

            foreach (XElement currency in subroot.DescendantNodes())
            {
                String name = currency.Attribute("currency").Value;
                if (!filter.Contains(name.ToLower()))
                {
                    continue;
                }

                float value;
                if (float.TryParse(currency.Attribute("rate").Value, out value))
                {
                    currencies.Add(name, value);
                }
            }



            for (int i = 0; i < currencies.Count; i++)
            {
                String fromName  = currencies.ElementAt(i).Key.ToString();
                String fromValue = currencies.ElementAt(i).Value.ToString();

                PanoramaItem temp = new PanoramaItem()
                {
                    Header = fromName, Name = "panoramaItem" + fromName
                };

                Grid innerGrid = new Grid()
                {
                    Name = "innerGrid" + fromName
                };
                innerGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(80)
                });
                innerGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(290)
                });
                innerGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(100, GridUnitType.Auto)
                });


                TextBox tempTextBox = new TextBox()
                {
                    Name = fromName
                };
                tempTextBox.TextChanged += new TextChangedEventHandler(textChangedHandler);
                InputScopeNameValue numbersOnly = InputScopeNameValue.TelephoneNumber;
                tempTextBox.InputScope = new InputScope()
                {
                    Names = { new InputScopeName()
                              {
                                  NameValue = numbersOnly
                              } }
                };


                innerGrid.Children.Add(tempTextBox);
                Grid.SetRow(tempTextBox, 0);

                ScrollViewer tempScroll = new ScrollViewer()
                {
                    Name = "scroll" + fromName
                };
                Grid tempGrid = new Grid();
                int  rowIndex = 0;
                for (int j = 0; j < currencies.Count; j++)
                {
                    if (i != j)
                    {
                        tempGrid.RowDefinitions.Add(new RowDefinition());
                        StackPanel tempStack = new StackPanel()
                        {
                            Orientation = System.Windows.Controls.Orientation.Horizontal
                        };
                        Image tempImage = new Image()
                        {
                            Source  = new BitmapImage(new Uri("../images/" + currencies.ElementAt(j).Key.ToString() + ".png", UriKind.Relative)),
                            Stretch = Stretch.Fill,
                            Width   = 70,
                            Height  = 45,
                            Margin  = new Thickness(10)
                        };
                        tempStack.Children.Add(tempImage);

                        TextBlock tempText = new TextBlock()
                        {
                            Name = "textBlockFrom" + fromName + "For" + currencies.ElementAt(j).Key.ToString(), Text = currencies.ElementAt(j).Key.ToString() + " = ...", FontSize = 42
                        };
                        tempStack.Children.Add(tempText);
                        tempGrid.Children.Add(tempStack);
                        Grid.SetRow(tempStack, rowIndex);

                        rowIndex++;
                    }
                }
                tempScroll.Content = tempGrid;

                innerGrid.Children.Add(tempScroll);
                Grid.SetRow(tempScroll, 1);

                temp.Content = innerGrid;
                RootView.Items.Add(temp);


                AdControl.TestMode = false;
                //ApplicationID = "4fd1b245-b648-44de-add5-1a6408f4618a", AdUnitID = "10016135",
                //AdModel = Contextual, RotationEnabled = true
                AdControl adControl = new AdControl("4fd1b245-b648-44de-add5-1a6408f4618a", // ApplicationID
                                                    "10016135",                             // AdUnitID
                                                    AdModel.Contextual,                     // AdModel
                                                    true);                                  // RotationEnabled
                // Make the AdControl size large enough that it can contain the image
                adControl.Width  = 300;
                adControl.Height = 80;

                innerGrid.Children.Add(adControl);
                Grid.SetRow(adControl, rowIndex++);
            }
        }
示例#32
0
		public InputScopeName (InputScopeNameValue nameValue)
		{
			EnsureInDesign ();
			NameValue = nameValue;
		}
 public InputScopeName(InputScopeNameValue nameValue)
 {
 }
示例#34
0
        ///<summary>
        /// This validates the value for InputScopeName.
        ///</summary>
        private bool IsValidInputScopeNameValue(InputScopeNameValue name)
        {
            switch (name)
            {
            case InputScopeNameValue.Default: break;                        // = 0,  // IS_DEFAULT

            case InputScopeNameValue.Url: break;                            // = 1,  // IS_URL

            case InputScopeNameValue.FullFilePath: break;                   // = 2,  // IS_FILE_FULLFILEPATH

            case InputScopeNameValue.FileName: break;                       // = 3,  // IS_FILE_FILENAME

            case InputScopeNameValue.EmailUserName: break;                  // = 4,  // IS_EMAIL_USERNAME

            case InputScopeNameValue.EmailSmtpAddress: break;               // = 5,  // IS_EMAIL_SMTPEMAILADDRESS

            case InputScopeNameValue.LogOnName: break;                      // = 6,  // IS_LOGINNAME

            case InputScopeNameValue.PersonalFullName: break;               // = 7,  // IS_PERSONALNAME_FULLNAME

            case InputScopeNameValue.PersonalNamePrefix: break;             // = 8,  // IS_PERSONALNAME_PREFIX

            case InputScopeNameValue.PersonalGivenName: break;              // = 9,  // IS_PERSONALNAME_GIVENNAME

            case InputScopeNameValue.PersonalMiddleName: break;             // = 10, // IS_PERSONALNAME_MIDDLENAME

            case InputScopeNameValue.PersonalSurname: break;                // = 11, // IS_PERSONALNAME_SURNAME

            case InputScopeNameValue.PersonalNameSuffix: break;             // = 12, // IS_PERSONALNAME_SUFFIX

            case InputScopeNameValue.PostalAddress: break;                  // = 13, // IS_ADDRESS_FULLPOSTALADDRESS

            case InputScopeNameValue.PostalCode: break;                     // = 14, // IS_ADDRESS_POSTALCODE

            case InputScopeNameValue.AddressStreet: break;                  // = 15, // IS_ADDRESS_STREET

            case InputScopeNameValue.AddressStateOrProvince: break;         // = 16, // IS_ADDRESS_STATEORPROVINCE

            case InputScopeNameValue.AddressCity: break;                    // = 17, // IS_ADDRESS_CITY

            case InputScopeNameValue.AddressCountryName: break;             // = 18, // IS_ADDRESS_COUNTRYNAME

            case InputScopeNameValue.AddressCountryShortName: break;        // = 19, // IS_ADDRESS_COUNTRYSHORTNAME

            case InputScopeNameValue.CurrencyAmountAndSymbol: break;        // = 20, // IS_CURRENCY_AMOUNTANDSYMBOL

            case InputScopeNameValue.CurrencyAmount: break;                 // = 21, // IS_CURRENCY_AMOUNT

            case InputScopeNameValue.Date: break;                           // = 22, // IS_DATE_FULLDATE

            case InputScopeNameValue.DateMonth: break;                      // = 23, // IS_DATE_MONTH

            case InputScopeNameValue.DateDay: break;                        // = 24, // IS_DATE_DAY

            case InputScopeNameValue.DateYear: break;                       // = 25, // IS_DATE_YEAR

            case InputScopeNameValue.DateMonthName: break;                  // = 26, // IS_DATE_MONTHNAME

            case InputScopeNameValue.DateDayName: break;                    // = 27, // IS_DATE_DAYNAME

            case InputScopeNameValue.Digits: break;                         // = 28, // IS_DIGITS

            case InputScopeNameValue.Number: break;                         // = 29, // IS_NUMBER

            case InputScopeNameValue.OneChar: break;                        // = 30, // IS_ONECHAR

            case InputScopeNameValue.Password: break;                       // = 31, // IS_PASSWORD

            case InputScopeNameValue.TelephoneNumber: break;                // = 32, // IS_TELEPHONE_FULLTELEPHONENUMBER

            case InputScopeNameValue.TelephoneCountryCode: break;           // = 33, // IS_TELEPHONE_COUNTRYCODE

            case InputScopeNameValue.TelephoneAreaCode: break;              // = 34, // IS_TELEPHONE_AREACODE

            case InputScopeNameValue.TelephoneLocalNumber: break;           // = 35, // IS_TELEPHONE_LOCALNUMBER

            case InputScopeNameValue.Time: break;                           // = 36, // IS_TIME_FULLTIME

            case InputScopeNameValue.TimeHour: break;                       // = 37, // IS_TIME_HOUR

            case InputScopeNameValue.TimeMinorSec: break;                   // = 38, // IS_TIME_MINORSEC

            case InputScopeNameValue.NumberFullWidth: break;                // = 39, // IS_NUMBER_FULLWIDTH

            case InputScopeNameValue.AlphanumericHalfWidth: break;          // = 40, // IS_ALPHANUMERIC_HALFWIDTH

            case InputScopeNameValue.AlphanumericFullWidth: break;          // = 41, // IS_ALPHANUMERIC_FULLWIDTH

            case InputScopeNameValue.CurrencyChinese: break;                // = 42, // IS_CURRENCY_CHINESE

            case InputScopeNameValue.Bopomofo: break;                       // = 43, // IS_BOPOMOFO

            case InputScopeNameValue.Hiragana: break;                       // = 44, // IS_HIRAGANA

            case InputScopeNameValue.KatakanaHalfWidth: break;              // = 45, // IS_KATAKANA_HALFWIDTH

            case InputScopeNameValue.KatakanaFullWidth: break;              // = 46, // IS_KATAKANA_FULLWIDTH

            case InputScopeNameValue.Hanja: break;                          // = 47, // IS_HANJA

            case InputScopeNameValue.PhraseList: break;                     // = -1, // IS_PHRASELIST

            case InputScopeNameValue.RegularExpression: break;              // = -2, // IS_REGULAREXPRESSION

            case InputScopeNameValue.Srgs: break;                           // = -3, // IS_SRGS

            case InputScopeNameValue.Xml: break;                            // = -4, // IS_XML

            default:
                return(false);
            }

            return(true);
        }
示例#35
0
 ///<summary>
 /// Constructor that takes name
 ///</summary>
 public InputScopeName(InputScopeNameValue nameValue)
 {
     _nameValue = nameValue;
 }
示例#36
0
        public static TextBox TextBoxHint(string hintArg, FormAround around, string nameArg = null)
        {
            if (around == null)
            {
                throw new NullReferenceException($"Controls.TextBoxHint() FormAround around=null");
            }
            var textBox = new TextBox();

            textBox.Margin = new Thickness(MarginBetweenButtons
                                           , MarginBetweenInputs, MarginBetweenButtons, MarginBetweenInputs);
            if (hintArg != null)
            {
                HintAssist.SetHint(textBox, hintArg);
            }
            if (nameArg != null)
            {
                textBox.Text = nameArg;
            }
            textBox.GotFocus += async(s, e) => { for (int i = 0; i < 3; i++)
                                                 {
                                                     await Task.Delay(50); textBox.SelectAll();
                                                 }
            };
            textBox.GotFocus += (s, arg) =>
            {
                Dock dockArg          = Dock.Bottom;
                var  screenHeight     = SystemParameters.PrimaryScreenHeight;
                var  midleScreen      = screenHeight / 2;
                var  strokeHeight     = midleScreen / 3;
                var  kbHeight         = midleScreen - strokeHeight;
                var  control          = s as TextBox;
                var  locationSys      = control.PointToScreen(new Point(0, 0));
                var  yLocationControl = screenHeight - locationSys.Y;
                var  kbviewspace      = kbHeight + control.ActualHeight * 1.29;
                dockArg = (yLocationControl > kbviewspace) ? Dock.Bottom : Dock.Top;

                around.TopFullKeyboard.SetEngLang().Height = kbHeight;
                around.BotFullKeyboard.SetEngLang().Height = kbHeight;

                var inputScope = control.InputScope;
                InputScopeNameValue inputType = InputScopeNameValue.Default;
                try
                {
                    inputType = ((InputScopeName)inputScope.Names[0]).NameValue;
                }
                catch { }

                if (inputType == InputScopeNameValue.Number || inputType == InputScopeNameValue.NumberFullWidth)
                {
                    around.TopFullKeyboard.SetNumericType();
                    around.BotFullKeyboard.SetNumericType();
                }
                else //inputType != InputScopeNameValue.Number
                {
                    around.TopFullKeyboard.SetTextType();
                    around.BotFullKeyboard.SetTextType();
                }

                DrawerHost.OpenDrawerCommand.Execute(dockArg, /*around.drawer1*/ control);
            };
            textBox.LostFocus += (s, arg) =>
            {
                DrawerHost.CloseDrawerCommand.Execute(null, around.drawer1);
            };
            //TextFieldAssist.SetHasClearButton(textBox, true);
            return(textBox);
        }
示例#37
0
 /// <summary>
 /// Set the input scope of the dialog
 /// </summary>
 /// <param name="inputScopeValue">Value to set</param>
 public void SetInputScope(InputScopeNameValue inputScopeValue)
 {
     this.Settings.InputScopeValue = inputScopeValue;
     OnPropertyChanged(nameof(this.InputScope));
 }
 private void setConstraint(TextBox tb, InputScopeNameValue v) {
     InputScope ins = new InputScope();
     InputScopeName insane = new InputScopeName();
     insane.NameValue = v;
     ins.Names.Add(insane);
     tb.InputScope = ins;
 }
示例#39
0
        ///<summary> 
        /// This validates the value for InputScopeName.
        ///</summary>
        private bool IsValidInputScopeNameValue(InputScopeNameValue name)
        { 

            switch (name) 
            { 
                case InputScopeNameValue.Default                   : break; // = 0,  // IS_DEFAULT
                case InputScopeNameValue.Url                       : break; // = 1,  // IS_URL 
                case InputScopeNameValue.FullFilePath              : break; // = 2,  // IS_FILE_FULLFILEPATH
                case InputScopeNameValue.FileName                  : break; // = 3,  // IS_FILE_FILENAME
                case InputScopeNameValue.EmailUserName             : break; // = 4,  // IS_EMAIL_USERNAME
                case InputScopeNameValue.EmailSmtpAddress          : break; // = 5,  // IS_EMAIL_SMTPEMAILADDRESS 
                case InputScopeNameValue.LogOnName                 : break; // = 6,  // IS_LOGINNAME
                case InputScopeNameValue.PersonalFullName          : break; // = 7,  // IS_PERSONALNAME_FULLNAME 
                case InputScopeNameValue.PersonalNamePrefix        : break; // = 8,  // IS_PERSONALNAME_PREFIX 
                case InputScopeNameValue.PersonalGivenName         : break; // = 9,  // IS_PERSONALNAME_GIVENNAME
                case InputScopeNameValue.PersonalMiddleName        : break; // = 10, // IS_PERSONALNAME_MIDDLENAME 
                case InputScopeNameValue.PersonalSurname           : break; // = 11, // IS_PERSONALNAME_SURNAME
                case InputScopeNameValue.PersonalNameSuffix        : break; // = 12, // IS_PERSONALNAME_SUFFIX
                case InputScopeNameValue.PostalAddress             : break; // = 13, // IS_ADDRESS_FULLPOSTALADDRESS
                case InputScopeNameValue.PostalCode                : break; // = 14, // IS_ADDRESS_POSTALCODE 
                case InputScopeNameValue.AddressStreet             : break; // = 15, // IS_ADDRESS_STREET
                case InputScopeNameValue.AddressStateOrProvince    : break; // = 16, // IS_ADDRESS_STATEORPROVINCE 
                case InputScopeNameValue.AddressCity               : break; // = 17, // IS_ADDRESS_CITY 
                case InputScopeNameValue.AddressCountryName        : break; // = 18, // IS_ADDRESS_----NAME
                case InputScopeNameValue.AddressCountryShortName   : break; // = 19, // IS_ADDRESS_COUNTRYSHORTNAME 
                case InputScopeNameValue.CurrencyAmountAndSymbol   : break; // = 20, // IS_CURRENCY_AMOUNTANDSYMBOL
                case InputScopeNameValue.CurrencyAmount            : break; // = 21, // IS_CURRENCY_AMOUNT
                case InputScopeNameValue.Date                      : break; // = 22, // IS_DATE_FULLDATE
                case InputScopeNameValue.DateMonth                 : break; // = 23, // IS_DATE_MONTH 
                case InputScopeNameValue.DateDay                   : break; // = 24, // IS_DATE_DAY
                case InputScopeNameValue.DateYear                  : break; // = 25, // IS_DATE_YEAR 
                case InputScopeNameValue.DateMonthName             : break; // = 26, // IS_DATE_MONTHNAME 
                case InputScopeNameValue.DateDayName               : break; // = 27, // IS_DATE_DAYNAME
                case InputScopeNameValue.Digits                    : break; // = 28, // IS_DIGITS 
                case InputScopeNameValue.Number                    : break; // = 29, // IS_NUMBER
                case InputScopeNameValue.OneChar                   : break; // = 30, // IS_ONECHAR
                case InputScopeNameValue.Password                  : break; // = 31, // IS_PASSWORD
                case InputScopeNameValue.TelephoneNumber           : break; // = 32, // IS_TELEPHONE_FULLTELEPHONENUMBER 
                case InputScopeNameValue.Telephone----Code      : break; // = 33, // IS_TELEPHONE_COUNTRYCODE
                case InputScopeNameValue.TelephoneAreaCode         : break; // = 34, // IS_TELEPHONE_AREACODE 
                case InputScopeNameValue.TelephoneLocalNumber      : break; // = 35, // IS_TELEPHONE_LOCALNUMBER 
                case InputScopeNameValue.Time                      : break; // = 36, // IS_TIME_FULLTIME
                case InputScopeNameValue.TimeHour                  : break; // = 37, // IS_TIME_HOUR 
                case InputScopeNameValue.TimeMinorSec              : break; // = 38, // IS_TIME_MINORSEC
                case InputScopeNameValue.NumberFullWidth           : break; // = 39, // IS_NUMBER_FULLWIDTH
                case InputScopeNameValue.AlphanumericHalfWidth     : break; // = 40, // IS_ALPHANUMERIC_HALFWIDTH
                case InputScopeNameValue.AlphanumericFullWidth     : break; // = 41, // IS_ALPHANUMERIC_FULLWIDTH 
                case InputScopeNameValue.CurrencyChinese           : break; // = 42, // IS_CURRENCY_CHINESE
                case InputScopeNameValue.Bopomofo                  : break; // = 43, // IS_BOPOMOFO 
                case InputScopeNameValue.Hiragana                  : break; // = 44, // IS_HIRAGANA 
                case InputScopeNameValue.KatakanaHalfWidth         : break; // = 45, // IS_KATAKANA_HALFWIDTH
                case InputScopeNameValue.KatakanaFullWidth         : break; // = 46, // IS_KATAKANA_FULLWIDTH 
                case InputScopeNameValue.Hanja                     : break; // = 47, // IS_HANJA
                case InputScopeNameValue.PhraseList                : break; // = -1, // IS_PHRASELIST
                case InputScopeNameValue.RegularExpression         : break; // = -2, // IS_REGULAREXPRESSION
                case InputScopeNameValue.Srgs                      : break; // = -3, // IS_SRGS 
                case InputScopeNameValue.Xml                       : break; // = -4, // IS_XML
                default: 
                    return false; 
            }
 
            return true;
        }
 private void AddTextBox(String title, out TextBox textBox, InputScopeNameValue? inputScopeName = null)
 {
     MainEventStackPanel.Children.Add(new TextBlock() { Text = title });
     textBox = new TextBox();
     textBox.KeyDown += TextBox_KeyDown;
     if (inputScopeName != null && inputScopeName.HasValue)
         textBox.InputScope = InputScopeWithName(inputScopeName.Value);
     textBox.TextChanged += ConfigureEmitButtonIcon;
     MainEventStackPanel.Children.Add(textBox);
 }
示例#41
0
        /// <summary>
        /// Visualizza una finestra di dialogo con TextBox
        /// </summary>
        public static async Task<DialogTextBoxResult> DialogTextBox(string content, string title, string box="", string ok="ok", string cancel="annulla", string sub=null, string header=null, InputScopeNameValue scopename=InputScopeNameValue.Default)
        {
            DialogTextBoxResult risposta = new DialogTextBoxResult();
            risposta.result=false;
            risposta.output=null;



            StackPanel stack = new StackPanel();

            if(content != null)
            {
                TextBlock contenuto = new TextBlock();
                contenuto.Text = content;
                stack.Children.Add(contenuto);
            }

            InputScope scope = new InputScope();
            scope.Names.Add(new InputScopeName(scopename));

            TextBox tb = new TextBox();
            tb.Text=box;
            tb.InputScope = scope;
            tb.Header = header;
            tb.Margin = new Thickness(0,5,0,5);
            stack.Children.Add(tb);

            if(sub!=null)
            {
                TextBlock subba = new TextBlock();
                subba.Text=sub;
                subba.TextWrapping = TextWrapping.Wrap;
                stack.Children.Add(subba);
            }


            ContentDialog cd = new ContentDialog();
            cd.Title = title;
            cd.Content = stack;


            cd.PrimaryButtonText = ok;
            cd.PrimaryButtonClick+= (s, ev) =>
            {
                risposta.result=true;
                risposta.output=tb.Text;
            };

            cd.SecondaryButtonText=cancel;
            cd.SecondaryButtonClick+= (s, ev) =>
            {
                risposta.result=false;
                risposta.output=null;
            };

            cd.Opened+=(s, ev) =>
            {
                tb.Focus(FocusState.Keyboard);
                tb.SelectAll();
            };

            await cd.ShowAsync();

            return risposta;
        }