Esempio n. 1
0
        public bool ShowKeyboardInput()
        {
            if (IsXAML)
            {
                // RunAsync all of the UI info.
                dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    // Create a TextBox that will be added to our view but hidden
                    hiddenKeyInput         = new Windows.UI.Xaml.Controls.TextBox();
                    hiddenKeyInput.Opacity = 0;

                    // We will only be generating one character at a time and does not
                    // matter about the font.  All we need is the text.
                    hiddenKeyInput.Width    = 1;
                    hiddenKeyInput.Height   = 1;
                    hiddenKeyInput.MaxWidth = 1;

                    // Create an input scope for us.  Probably not needed
                    var scope = new Windows.UI.Xaml.Input.InputScope();
                    var name  = new Windows.UI.Xaml.Input.InputScopeName();

                    name.NameValue = Windows.UI.Xaml.Input.InputScopeNameValue.Default;
                    scope.Names.Add(name);

                    hiddenKeyInput.InputScope = scope;

                    // Set spell checking off.
                    hiddenKeyInput.IsSpellCheckEnabled = false;

                    // Add our hidden TextBox to our panel
                    content.Children.Add(hiddenKeyInput);


                    // InputPane does not work in this scenario
                    // We need to listen to GotFocus and LostFocus Events
                    hiddenKeyInput.GotFocus  += OnGotFocus;
                    hiddenKeyInput.LostFocus += OnLostFocuc;


                    // Hook up our key delegates
                    hiddenKeyInput.KeyDown += OnKeyDown;
                    hiddenKeyInput.KeyUp   += OnKeyUp;

                    // enable us and set focus
                    hiddenKeyInput.IsEnabled = true;
                    hiddenKeyInput.Focus(Windows.UI.Xaml.FocusState.Programmatic);
                }
                                    );
            }
            else
            {
            }
            return(true);
        }
Esempio n. 2
0
        private static bool FastStringToInputScope(Type outputType, string input, ref object output)
        {
            if (outputType == typeof(Windows.UI.Xaml.Input.InputScope))
            {
                object nameValue = null;
                if (FastEnumConvert(typeof(Windows.UI.Xaml.Input.InputScopeNameValue), input, ref nameValue))
                {
                    output = new Windows.UI.Xaml.Input.InputScope
                    {
                        Names =
                        {
                            new Windows.UI.Xaml.Input.InputScopeName
                            {
                                NameValue = (Windows.UI.Xaml.Input.InputScopeNameValue)nameValue
                            }
                        }
                    };

                    return(true);
                }
            }

            return(false);
        }
        public bool ShowKeyboardInput()
        {

            if (IsXAML)
            {
                // RunAsync all of the UI info.
                dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {

                        // Create a TextBox that will be added to our view but hidden
                        hiddenKeyInput = new Windows.UI.Xaml.Controls.TextBox();
                        hiddenKeyInput.Opacity = 0;

                        // We will only be generating one character at a time and does not
                        // matter about the font.  All we need is the text.
                        hiddenKeyInput.Width = 1;
                        hiddenKeyInput.Height = 1;
                        hiddenKeyInput.MaxWidth = 1;

                        // Create an input scope for us.  Probably not needed
                        var scope = new Windows.UI.Xaml.Input.InputScope();
                        var name = new Windows.UI.Xaml.Input.InputScopeName();

                        name.NameValue = Windows.UI.Xaml.Input.InputScopeNameValue.Default;
                        scope.Names.Add(name);

                        hiddenKeyInput.InputScope = scope;

                        // Set spell checking off.
                        hiddenKeyInput.IsSpellCheckEnabled = false;

                        // Add our hidden TextBox to our panel
                        content.Children.Add(hiddenKeyInput);


                        // InputPane does not work in this scenario
                        // We need to listen to GotFocus and LostFocus Events
                        hiddenKeyInput.GotFocus += OnGotFocus;
                        hiddenKeyInput.LostFocus += OnLostFocuc;


                        // Hook up our key delegates
                        hiddenKeyInput.KeyDown += OnKeyDown;
                        hiddenKeyInput.KeyUp += OnKeyUp;

                        // enable us and set focus
                        hiddenKeyInput.IsEnabled = true;
                        hiddenKeyInput.Focus(Windows.UI.Xaml.FocusState.Programmatic);
                    }
                );
            }
            else
            {

            }
            return true;
        }
Esempio n. 4
0
        public bool ShowKeyboardInput()
        {
            keyboard.Hiding  += OnSofKeyboardHiding;
            keyboard.Showing += OnSofKeyboardShowing;

            // RunAsync all of the UI info.
            dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                // Create a TextBox that will be added to our view but hidden
                hiddenKeyInput         = new Windows.UI.Xaml.Controls.TextBox();
                hiddenKeyInput.Opacity = 0;

                // We will only be generating one character at a time and does not
                // matter about the font.  All we need is the text.
                hiddenKeyInput.Width    = 1;
                hiddenKeyInput.Height   = 1;
                hiddenKeyInput.MaxWidth = 1;

                // Create an input scope for us.  Probably not needed
                var scope = new Windows.UI.Xaml.Input.InputScope();
                var name  = new Windows.UI.Xaml.Input.InputScopeName();

                name.NameValue = Windows.UI.Xaml.Input.InputScopeNameValue.Default;
                scope.Names.Add(name);

                hiddenKeyInput.InputScope = scope;

                // Set spell checking off.
                hiddenKeyInput.IsSpellCheckEnabled = false;

                // Get our Current SwapChainPanel.  This is for our WP8.1 implementation
                var content = Windows.UI.Xaml.Window.Current.Content as Windows.UI.Xaml.Controls.SwapChainBackgroundPanel;
                if (content == null)
                {
                    // Do our detach stuff
                    DetachWithIME();
                    return;
                }

                // Add our hidden TextBox to our panel
                content.Children.Add(hiddenKeyInput);

                // Hook up our key delegates
                hiddenKeyInput.KeyDown += OnKeyDown;
                hiddenKeyInput.KeyUp   += OnKeyUp;

                // enable us and set focus
                hiddenKeyInput.IsEnabled = true;
                hiddenKeyInput.Focus(Windows.UI.Xaml.FocusState.Programmatic);

                // Show the soft keyboard if possible
                var didShow = keyboard.TryShow();
                if (!didShow)
                {
                    DetachWithIME();
                }

                //CCLog.Log("we be in background");
            }
                                );

            return(true);
        }
        public bool ShowKeyboardInput()
        {

            keyboard.Hiding += OnSofKeyboardHiding;
            keyboard.Showing += OnSofKeyboardShowing;

            // RunAsync all of the UI info.
            dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {

                    // Create a TextBox that will be added to our view but hidden
                    hiddenKeyInput = new Windows.UI.Xaml.Controls.TextBox();
                    hiddenKeyInput.Opacity = 0;

                    // We will only be generating one character at a time and does not
                    // matter about the font.  All we need is the text.
                    hiddenKeyInput.Width = 1;
                    hiddenKeyInput.Height = 1;
                    hiddenKeyInput.MaxWidth = 1;

                    // Create an input scope for us.  Probably not needed
                    var scope = new Windows.UI.Xaml.Input.InputScope();
                    var name = new Windows.UI.Xaml.Input.InputScopeName();

                    name.NameValue = Windows.UI.Xaml.Input.InputScopeNameValue.Default;
                    scope.Names.Add(name);

                    hiddenKeyInput.InputScope = scope;

                    // Set spell checking off.
                    hiddenKeyInput.IsSpellCheckEnabled = false;

                    // Get our Current SwapChainPanel.  This is for our WP8.1 implementation
                    var content = Windows.UI.Xaml.Window.Current.Content as Windows.UI.Xaml.Controls.SwapChainBackgroundPanel;
                    if (content == null)
                    {
                        // Do our detach stuff
                        DetachWithIME();
                        return;
                    }

                    // Add our hidden TextBox to our panel
                    content.Children.Add(hiddenKeyInput);
                    
                    // Hook up our key delegates
                    hiddenKeyInput.KeyDown += OnKeyDown;
                    hiddenKeyInput.KeyUp += OnKeyUp;

                    // enable us and set focus
                    hiddenKeyInput.IsEnabled = true;
                    hiddenKeyInput.Focus(Windows.UI.Xaml.FocusState.Programmatic);

                    // Show the soft keyboard if possible
                    var didShow = keyboard.TryShow();
                    if (!didShow)
                    { 
                        DetachWithIME();
                    }

                    //CCLog.Log("we be in background");
            }
                );

            return true;
        }