示例#1
0
        private string ShowKeyboardInput()
        {

            UIApplication.SharedApplication.InvokeOnMainThread (delegate {

                AddObservers();

                // Create an instance of our custom UITextField that will be added to our view but hidden
                hiddenKeyInput = new HiddenInput(new CGRect(0,0,1,1));
                hiddenKeyInput.Hidden = true;

                hiddenKeyInput.AutocorrectionType = UITextAutocorrectionType.No;
                hiddenKeyInput.SpellCheckingType = UITextSpellCheckingType.No;


                if (TextFieldInFocus.CharacterCount > 0)
                    hiddenKeyInput.Text = TextFieldInFocus.Text;

                gameViewController.Add(hiddenKeyInput);

                hiddenKeyInput.BecomeFirstResponder();

            }
            );
            return contentText;
        }
示例#2
0
        public void HiddenInputRenderTest()
        {
            var target = new HiddenInput();

            Assert.AreEqual("<input type=\"hidden\" name=\"test\" />", target.Render("test", null));
            Assert.AreEqual("<input type=\"hidden\" name=\"test\" value=\"test1\" />", target.Render("test", "test1"));
        }
示例#3
0
        private string ShowKeyboardInput()
        {
            UIApplication.SharedApplication.InvokeOnMainThread(delegate {
                AddObservers();

                // Create an instance of our custom UITextField that will be added to our view but hidden
                hiddenKeyInput        = new HiddenInput(new CGRect(0, 0, 1, 1));
                hiddenKeyInput.Hidden = true;

                hiddenKeyInput.AutocorrectionType = UITextAutocorrectionType.No;
                hiddenKeyInput.SpellCheckingType  = UITextSpellCheckingType.No;


                if (TextFieldInFocus.CharacterCount > 0)
                {
                    hiddenKeyInput.Text = TextFieldInFocus.Text;
                }

                //hiddenKeyInput.Delegate = this;

                gameViewController.Add(hiddenKeyInput);

                hiddenKeyInput.BecomeFirstResponder();
            }
                                                               );
            return(contentText);
        }
示例#4
0
        public static HiddenInput GetHiddenInputStruct(PropertyMap map)
        {
            var hiddenInput = new HiddenInput();

            if (null != map)
            {
                int defaultVlaue = 0;
                hiddenInput.Mode = (HiddenInputModeType)GetIntFromMap(map, 0, defaultVlaue);

                int?substituteCharacter = GetNullableIntFromMap(map, 1);
                if (substituteCharacter != null)
                {
                    hiddenInput.SubstituteCharacter = Convert.ToChar(substituteCharacter);
                }

                hiddenInput.SubstituteCount           = GetNullableIntFromMap(map, 2);
                hiddenInput.ShowLastCharacterDuration = GetNullableIntFromMap(map, 3);
            }

            return(hiddenInput);
        }
示例#5
0
        public static PropertyMap GetHiddenInputMap(HiddenInput hiddenInput)
        {
            var map = new PropertyMap();

            map.Add(0, (int)hiddenInput.Mode);

            if (hiddenInput.SubstituteCharacter != null)
            {
                map.Add(1, Convert.ToInt32(hiddenInput.SubstituteCharacter));
            }

            if (hiddenInput.SubstituteCount != null)
            {
                map.Add(2, (int)hiddenInput.SubstituteCount);
            }

            if (hiddenInput.ShowLastCharacterDuration != null)
            {
                map.Add(3, (int)hiddenInput.ShowLastCharacterDuration);
            }

            return(map);
        }
示例#6
0
        public void CreateAttributes(Tuple <XModule, XModuleAttribute, bool> modulePack, IHTMLElement node)
        {
            switch (node.tagName)
            {
            case "INPUT":
                string type = node.getAttribute("type", 0);
                switch (type)
                {
                case "text":
                case "password":
                    var textfield = new Textfield();
                    textfield.SetupAttributes(modulePack, node);
                    break;

                case "checkbox":
                    var checkbox = new Checkbox();
                    checkbox.SetupAttributes(modulePack, node);
                    break;

                case "hidden":
                    var hidden = new HiddenInput();
                    hidden.SetupAttributes(modulePack, node);
                    break;

                case "submit":
                case "reset":
                case "button":
                    var newButton = new InternalObjects.Button();
                    newButton.SetupAttributes(modulePack, node);
                    break;
                }
                break;

            case "select":
                var combobox = new Combobox();
                combobox.SetupAttributes(modulePack, node);
                break;

            case "A":
                var newLink = new Link();
                newLink.SetupAttributes(modulePack, node);
                break;

            case "table":
                var newTable = new Table();
                newTable.SetupAttributes(modulePack, node);

                /*var subAttributeRow = mainModule.CreateModuleAttribute();
                 * newTable.SetupRowAttributes(subAttributeRow, node);
                 *
                 * var subAttributeCellforRow = subAttributeRow.CreateModuleAttribute();
                 * newTable.SetupCellAttributes(subAttributeCellforRow, node);
                 *
                 * var subAttributeCol = mainModule.CreateModuleAttribute();
                 * newTable.SetupColAttributes(subAttributeCol, node);
                 *
                 * var subAttributeCellforCol = subAttributeCol.CreateModuleAttribute();
                 * newTable.SetupCellAttributes(subAttributeCellforCol, node);*/
                break;
            }
        }
        /// <summary>
        /// Generates DesignTime HTML if no properties set.
        /// </summary>
        /// <returns>HTML string</returns>
        protected override string GetEmptyDesignTimeHtml()
        {
            HiddenInput H = (HiddenInput)Component;

            return("<table><tr><td style='" + Style + "'><b>" + H.GetType().Name + "</b></td></tr></table>");
        }
示例#8
0
        void AddObservers()
        {
            keyboardWillShowObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillShowNotification, 
                (notification) => 
                {

                    // In iOS when there is a change of keyboard the WillShow and DidShow events are fired again without
                    // the HideXXXX events.
                    // If we are already visible then this is probably a change of keyboard so we will
                    // not attach our event handlers again or we will get multiple events on key input.
                    if (!IsVisible)
                    {
                        hiddenKeyInput.DeleteBackwardEvent += OnDeleteBackwardEvent;
                        hiddenKeyInput.InsertTextEvent += OnInsertTextEvent;
                    }

                    OnKeyboardWillShow();


                }
            );

            keyboardDidShowObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, 
                (notification) => 
                {
                    IsVisible = true;
                    OnKeyboardDidShow();
                }
            );

            keyboardWillHideObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, 
                (notification) => 
                {
                    UIApplication.EnsureUIThread();
                    OnKeyboardWillHide();
                }
            );

            keyboardDidHideObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidHideNotification, 
                (notification) => 
                {
                    UIApplication.EnsureUIThread();

                    // Remove our hiddenKeyInput event listeners.
                    hiddenKeyInput.DeleteBackwardEvent -= OnDeleteBackwardEvent;
                    hiddenKeyInput.InsertTextEvent -= OnInsertTextEvent;

                    // Remove it from it's view
                    hiddenKeyInput.RemoveFromSuperview();

                    hiddenKeyInput = null;

                    // Remove the notifications
                    NSNotificationCenter.DefaultCenter.RemoveObserver(keyboardWillShowObserver);
                    NSNotificationCenter.DefaultCenter.RemoveObserver(keyboardDidShowObserver);
                    NSNotificationCenter.DefaultCenter.RemoveObserver(keyboardWillHideObserver);
                    NSNotificationCenter.DefaultCenter.RemoveObserver(keyboardDidHideObserver);


                    IsVisible = false;
                    OnKeyboardDidHide();
                }
            );
        }
示例#9
0
 public void HiddenInputConstructorTest()
 {
     var target = new HiddenInput();
 }
示例#10
0
        public void IsHiddenTest()
        {
            var target = new HiddenInput(); // TODO: Initialize to an appropriate value

            Assert.IsTrue(target.IsHidden);
        }
示例#11
0
        void AddObservers()
        {
            keyboardWillShowObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillShowNotification,
                                                                                      (notification) =>
            {
                // In iOS when there is a change of keyboard the WillShow and DidShow events are fired again without
                // the HideXXXX events.
                // If we are already visible then this is probably a change of keyboard so we will
                // not attach our event handlers again or we will get multiple events on key input.
                if (!IsVisible)
                {
                    hiddenKeyInput.DeleteBackwardEvent += OnDeleteBackwardEvent;
                    hiddenKeyInput.InsertTextEvent     += OnInsertTextEvent;
                }

                OnKeyboardWillShow();
            }
                                                                                      );

            keyboardDidShowObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification,
                                                                                     (notification) =>
            {
                IsVisible = true;
                OnKeyboardDidShow();
            }
                                                                                     );

            keyboardWillHideObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification,
                                                                                      (notification) =>
            {
                UIApplication.EnsureUIThread();
                OnKeyboardWillHide();
            }
                                                                                      );

            keyboardDidHideObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidHideNotification,
                                                                                     (notification) =>
            {
                UIApplication.EnsureUIThread();

                // Remove our hiddenKeyInput event listeners.
                hiddenKeyInput.DeleteBackwardEvent -= OnDeleteBackwardEvent;
                hiddenKeyInput.InsertTextEvent     -= OnInsertTextEvent;

                // Remove it from it's view
                hiddenKeyInput.RemoveFromSuperview();

                hiddenKeyInput = null;

                // Remove the notifications
                NSNotificationCenter.DefaultCenter.RemoveObserver(keyboardWillShowObserver);
                NSNotificationCenter.DefaultCenter.RemoveObserver(keyboardDidShowObserver);
                NSNotificationCenter.DefaultCenter.RemoveObserver(keyboardWillHideObserver);
                NSNotificationCenter.DefaultCenter.RemoveObserver(keyboardDidHideObserver);


                IsVisible = false;
                OnKeyboardDidHide();
            }
                                                                                     );
        }