예제 #1
0
 void SetupPuzzleMode()
 {
     m_Mode = KeyboardMode.Puzzle;
     ResetCurrentNoteSequence();
     EventManager.Instance.Unsubscribe(GameEvents.Keyboard.CheckAnswer, OnCheckNotes);
     EventManager.Instance.Subscribe(GameEvents.Keyboard.CheckAnswer, OnCheckNotes);
 }
예제 #2
0
        public EntryBoxValidationMultiLine(Window pSourceWindow, string pLabelText, KeyboardMode pKeyboardMode, string pRule, bool pRequired, int pMaxLength, int pMaxWords)
            : base(pSourceWindow, pLabelText)
        {
            //Parameters
            _initialLabelText = pLabelText;

            _entryMultiline = new EntryMultiline(pSourceWindow, pKeyboardMode)
            {
                BorderWidth = 2
            };
            _entryMultiline.TextView.WrapMode = WrapMode.WordChar;
            _entryMultiline.TextView.ModifyFont(_fontDescription);

            _rule     = pRule;
            _required = pRequired;
            if (pMaxLength > 0)
            {
                _maxLength = pMaxLength;
            }
            if (pMaxWords > 0)
            {
                _maxWords = pMaxWords;
            }

            //Pack It
            _hbox.PackStart(_entryMultiline, true, true, 0);
            //Init Keyboard
            InitKeyboard(_entryMultiline);
            //Started Validate
            Validate();

            //Event here to have access to Label
            _entryMultiline.Value.Changed += Value_Changed;
        }
        /// <summary>
        /// Shows the software keyboard, if one is available.
        /// </summary>
        /// <param name="mode">The display mode of the software keyboard.</param>
        public void ShowSoftwareKeyboard(KeyboardMode mode)
        {
            switch (mode)
            {
            case KeyboardMode.Text:
                MCurrentInputType = (int)global::Android.Text.InputTypes.ClassText;
                break;

            case KeyboardMode.Number:
                MCurrentInputType = (int)global::Android.Text.InputTypes.ClassNumber;
                break;

            case KeyboardMode.Phone:
                MCurrentInputType = (int)global::Android.Text.InputTypes.ClassPhone;
                break;

            case KeyboardMode.Datetime:
                MCurrentInputType = (int)global::Android.Text.InputTypes.ClassDatetime;
                break;

            default:
                throw new ArgumentOutOfRangeException("mode");
            }
            SDL.StartTextInput();
        }
예제 #4
0
 public EntryTouch(Window pSourceWindow, KeyboardMode pKeyboardMode, string pRule, bool pRequired)
 {
     _sourceWindow = pSourceWindow;
     _keyboardMode = pKeyboardMode;
     _rule         = pRule;
     _required     = pRequired;
 }
예제 #5
0
        public AddEditItemDialog(KeyboardMode keyboardMode, string id, ItemType itemType, bool isEditing, string name, string amount)
            : base()
        {
            ViewModel = new AddEditItemViewModel(keyboardMode, id, itemType, isEditing)
            {
                Name   = name,
                Amount = amount,
            };

            Content = new AddEditItem()
            {
                BindingContext = ViewModel,
            };

            if (isEditing)
            {
                AddButton(new ContentDialogButton()
                {
                    Icon = Icons.TrashAltSolid, Color = Color.Red, Result = AddEditItemResult.Delete
                });
            }
            AddButton(new ContentDialogButton()
            {
                Icon = Icons.TimesCircleRegular, Color = Color.White, Result = AddEditItemResult.Cancel, IsBack = true,
            });
            AddButton(new ContentDialogButton()
            {
                Icon = Icons.CheckCircleRegular, Color = Color.Lime, Result = AddEditItemResult.Ok, CloseDialog = false
            });
        }
예제 #6
0
        public EntryBoxValidationButton(Window pSourceWindow, String pLabelText, KeyboardMode pKeyboardMode, string pRule, bool pRequired, string pIconFile = "")
            : base(pSourceWindow, pLabelText)
        {
            //Settings
            string iconSelectRecord = FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], @"Icons/Windows/icon_window_select_record.png"));
            string iconFile         = (pIconFile != string.Empty) ? pIconFile : iconSelectRecord;

            //Init Button
            _button = GetButton(iconFile);

            //EntryValidation
            _entryValidation = new EntryValidation(pSourceWindow, pKeyboardMode, pRule, pRequired)
            {
                Label = _label, LabelText = _label.Text
            };
            _entryValidation.ModifyFont(_fontDescription);
            //Started Validate
            _entryValidation.Validate();

            //Pack Hbox
            _hbox.PackStart(_entryValidation, true, true, 0);
            _hbox.PackStart(_button, false, false, 0);
            //Init Keyboard
            InitKeyboard(_entryValidation);
        }
예제 #7
0
        /// <inheritdoc/>
        public override Boolean ShowSoftwareKeyboard(KeyboardMode mode)
        {
            var activity = UltravioletApplication.Instance;

            if (activity == null)
            {
                return(false);
            }

            switch (mode)
            {
            case KeyboardMode.Text:
                /* NOTE: We use TextVariationVisiblePassword here to match SDL's default behavior.
                 * This is done to disable text suggestions due to the fact that some keyboards implement
                 * them in a way which is difficult to handle properly. */
                activity.KeyboardInputType = InputTypes.ClassText | InputTypes.TextVariationVisiblePassword;
                break;

            case KeyboardMode.Number:
                activity.KeyboardInputType = InputTypes.ClassNumber;
                break;

            case KeyboardMode.Phone:
                activity.KeyboardInputType = InputTypes.ClassPhone;
                break;

            case KeyboardMode.Datetime:
                activity.KeyboardInputType = InputTypes.ClassDatetime;
                break;
            }

            OnShowingSoftwareKeyboard();

            return(true);
        }
        /// <inheritdoc/>
        public override Boolean ShowSoftwareKeyboard(KeyboardMode mode)
        {
            var controller = (SDL_uikitviewcontroller)UIApplication.SharedApplication?.KeyWindow?.RootViewController;
            if (controller == null)
                return false;

            var textField = (UITextField)controller.View.Subviews[0];
            switch (mode)
            {
                case KeyboardMode.Number:
                    textField.KeyboardType = UIKeyboardType.DecimalPad;
                    textField.ReloadInputViews();
                    break;

                case KeyboardMode.Phone:
                    textField.KeyboardType = UIKeyboardType.PhonePad;
                    textField.ReloadInputViews();
                    break;

                case KeyboardMode.Datetime:
                    textField.KeyboardType = UIKeyboardType.NumbersAndPunctuation;
                    textField.ReloadInputViews();
                    break;

                default:
                    textField.KeyboardType = UIKeyboardType.Default;
                    textField.ReloadInputViews();
                    break;
            }

            controller.ShowKeyboard();
            OnShowingSoftwareKeyboard();

            return true;
        }
        /// <inheritdoc/>
        public override Boolean ShowSoftwareKeyboard(KeyboardMode mode)
        {
            if (Activity == null)
                return false;

            switch (mode)
            {
                case KeyboardMode.Text:
                    /* NOTE: We use TextVariationVisiblePassword here to match SDL's default behavior.
                     * This is done to disable text suggestions due to the fact that some keyboards implement
                     * them in a way which is difficult to handle properly. */
                    Activity.KeyboardInputType = InputTypes.ClassText | InputTypes.TextVariationVisiblePassword;
                    break;

                case KeyboardMode.Number:
                    Activity.KeyboardInputType = InputTypes.ClassNumber;
                    break;

                case KeyboardMode.Phone:
                    Activity.KeyboardInputType = InputTypes.ClassPhone;
                    break;

                case KeyboardMode.Datetime:
                    Activity.KeyboardInputType = InputTypes.ClassDatetime;
                    break;
            }

            OnShowingSoftwareKeyboard();

            return true;
        }
예제 #10
0
    // Keyboard Related Methods ----------------------------------------------------------
    public void ToggleSpellKeyboard(bool toggle)
    {
        KeyMode = KeyboardMode.SpellMode;
        UIManager.Instance.CloseInvalidEntry();
        baybayinKeyboard.SetActive(toggle);
        UIManager.Instance.Blur(toggle);
        UIManager.Instance.ResetGuideText();
        UIManager.Instance.DeactivateSpellUnlockAlert();
        PausePlayerInput(toggle);
        keyboardIntegrator.enable = toggle;

        if (toggle)
        {
            SlowMo();
            MouseMovementActive = false;

            if (AreAllKeyboardTutorialsDone())
            {
                return;
            }

            UIManager.Instance.KeyboardTutorial(KeyMode);
        }
        else
        {
            MouseMovementActive = true;
            NormalTime();
            ClearKeyboard();
            UIManager.Instance.ResetGuideText();
        }
    }
예제 #11
0
        //Update the keyboard mode
        async Task UpdateKeyboardMode()
        {
            try
            {
                await AVActions.ActionDispatcherInvokeAsync(async delegate
                {
                    //Check keyboard mode
                    KeyboardMode keyboardMode = (KeyboardMode)Convert.ToInt32(Setting_Load(vConfigurationDirectXInput, "KeyboardMode"));
                    if (keyboardMode == KeyboardMode.Media)
                    {
                        //Update help bar
                        stackpanel_DPad.Visibility     = Visibility.Visible;
                        textblock_ButtonLeft.Text      = "Media Prev";
                        textblock_ButtonRight.Text     = "Media Next";
                        textblock_ButtonUp.Text        = "Play/Pause";
                        textblock_ThumbRightOff.Text   = "Move";
                        textblock_LeftTriggerOff.Text  = string.Empty;
                        textblock_RightTriggerOff.Text = "Volume";
                        textblock_ThumbPress.Text      = "Mute";
                        textblock_BackOff.Text         = "Fullscreen";
                        image_Mode.Source = vImagePreloadIconKeyboardMedia;

                        //Play sound
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);

                        //Show notification
                        NotificationDetails notificationDetails = new NotificationDetails();
                        notificationDetails.Icon = "Keyboard";
                        notificationDetails.Text = "Switched to media mode";
                        await App.vWindowOverlay.Notification_Show_Status(notificationDetails);
                    }
                    else if (keyboardMode == KeyboardMode.Scroll)
                    {
                        //Update help bar
                        stackpanel_DPad.Visibility     = Visibility.Collapsed;
                        textblock_ButtonLeft.Text      = "Backspace";
                        textblock_ButtonRight.Text     = "Enter";
                        textblock_ButtonUp.Text        = "Space";
                        textblock_ThumbRightOff.Text   = "Scroll";
                        textblock_LeftTriggerOff.Text  = "Caps";
                        textblock_RightTriggerOff.Text = "Tab";
                        textblock_ThumbPress.Text      = "Arrows";
                        textblock_BackOff.Text         = "Emoji/Text";
                        image_Mode.Source = vImagePreloadIconKeyboardScroll;

                        //Play sound
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);

                        //Show notification
                        NotificationDetails notificationDetails = new NotificationDetails();
                        notificationDetails.Icon = "Keyboard";
                        notificationDetails.Text = "Switched to scroll mode";
                        await App.vWindowOverlay.Notification_Show_Status(notificationDetails);
                    }
                });
            }
            catch { }
        }
        /// <inheritdoc/>
        public override Boolean ShowSoftwareKeyboard(KeyboardMode mode)
        {
            if (Activity == null)
                return false;

            Activity.ShowSoftwareKeyboard(mode);

            return true;
        }
예제 #13
0
        void Awake()
        {
            m_AudioSource = GetComponent <AudioSource>();

            m_CurrentNoteSequence = new int[m_NoteSequenceToCheck.Length];
            ResetCurrentNoteSequence();

            m_Mode = KeyboardMode.Free;
        }
예제 #14
0
        public AddEditItemViewModel(KeyboardMode keyboardMode, string id, ItemType itemType, bool isEditing)
        {
            NameValidationErrors   = new ObservableCollection <ValidationError>();
            AmountValidationErrors = new ObservableCollection <ValidationError>();

            KeyboardMode = keyboardMode;
            Id           = id;
            ItemType     = itemType;
            IsEditing    = isEditing;
        }
예제 #15
0
    void instantiateKeys(KeyboardMode mode)
    {
        string[] alphabet = keyAlphabet[mode];
        keys = new GameObject[alphabet.Length];

        for (int i = 0; i < alphabet.Length; i++)
        {
            keys[i] = setupKey(alphabet[i]);
        }
    }
예제 #16
0
 void OnChangeMode(KeyboardMode keyboardMode)
 {
     if (keyboardMode == KeyboardMode.Puzzle)
     {
         m_Material.SetColor("_Color", Color.white);
     }
     else
     {
         m_Material.SetColor("_Color", m_Color);// Color.black);
     }
 }
        /// <inheritdoc/>
        public override Boolean ShowSoftwareKeyboard(KeyboardMode mode)
        {
            if (Activity == null)
            {
                return(false);
            }

            Activity.ShowSoftwareKeyboard(mode);

            return(true);
        }
예제 #18
0
 public static KeyboardMode Instance()
 {
     if (instance == null)
     {
         instance = new KeyboardMode();
         manager  = SL.Get <GameManager>();
         control  = SL.Get <IVRControl>();
         shared   = SL.Get <WorldBuilderMain>();
         keyboard = SL.Get <Keyboard>();
     }
     return(instance);
 }
예제 #19
0
        /// <summary>
        /// Takes the position of a touch and determines which key, if any was pressed
        /// </summary>
        /// <param name="position">The position of the touch</param>
        /// <param name="gameTime">XNA object containing current game time properties</param>
        private void processTouch(Vector2 position, GameTime gameTime)
        {
            double lastTouchDelta = gameTime.TotalGameTime.TotalSeconds - lastTouchTime.TotalSeconds;

            if (touchKeys != null)
            {
                foreach (TouchKey key in touchKeys.Values)
                {
                    Vector2 trasform = new Vector2((float)Manager.InternalWidth / (float)Manager.GraphicsDevice.Viewport.Width,
                                                   (float)Manager.InternalHeight / (float)Manager.GraphicsDevice.Viewport.Height);
                    if (key.boundingBox.Contains(position * trasform))
                    {
                        //indicate the key was pressed this cycle
                        key.pressed = true;

                        //reset the highlight color if this is the initial touch
                        if (key.pressedElapsed == 0)
                        {
                            key.activeColor = buttonColor2;
                        }

                        //reset the highlight cooldown
                        key.highlightRemaining = highlightDuration;

                        //Apply shift modes
                        if ((key.key == Keys.RightShift || key.key == Keys.LeftShift) && key.pressedElapsed == 0)
                        {
                            switch (mode)
                            {
                            case KeyboardMode.Default:
                                mode = KeyboardMode.Shift;
                                break;

                            case KeyboardMode.Shift:
                                mode = (lastTouchDelta < .3) ? KeyboardMode.CapsLock : KeyboardMode.Default;
                                break;

                            case KeyboardMode.CapsLock:
                                mode = KeyboardMode.Default;
                                break;
                            }
                        }

                        //Check if the keyboard was collapsed
                        if (key.key == Keys.Escape)
                        {
                            Enabled = false;
                        }
                    }
                }
            }
        }
예제 #20
0
    private void ActivateNode()
    {
        Node n = activeNode.GetComponent <Node>();

        if (keyboard.gameObject.activeInHierarchy)
        {
            KeyboardMode.Instance().ButtonActivate(n, control.LSH());
        }
        else
        {
            mode.ButtonActivate(n, control.LSH());
        }
    }
예제 #21
0
    void Start()
    {
        hostiles = new List <Enemy>();
        ToggleTutorialMode(Tutorial);
        UIManager.Instance.UpdateGold(Gold);
        checkpoint     = Player.transform;
        KeyMode        = KeyboardMode.SpellMode;
        EndTimeCounter = EndTimer;

        KeyboardCharacters.ResetConsonants();
        spells.ResetAll();
        InventoryManager.Instance.Reset();
        UIManager.Instance.ShowControls(true);
        // KeyboardCharacters.UnlockAllConsonants();
        // spells.UnlockAll();
    }
예제 #22
0
        void OnChangeMode()
        {
            // TODO: Put a switch model on the keyboard so the player can choose between "unlock" (puzzle mode) and "play" (free mode).
            // For now, I'm only changing the keyboard tab shader color.

            if (m_Mode == KeyboardMode.Free)
            {
                SetupPuzzleMode();
            }
            else
            {
                m_Mode = KeyboardMode.Free;
                EventManager.Instance.Unsubscribe(GameEvents.Keyboard.CheckAnswer, OnCheckNotes);
            }

            EventManager.Instance.Notify(GameEvents.Keyboard.AfterChangeMode, m_Mode);
        }
예제 #23
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Keyboard

        public void InitKeyboard(object pBoxObject)
        {
            KeyboardMode keyboardMode = KeyboardMode.None;

            if (pBoxObject.GetType() == typeof(EntryValidation))
            {
                keyboardMode = (pBoxObject as EntryValidation).KeyboardMode;
            }
            else if (pBoxObject.GetType() == typeof(EntryMultiline))
            {
                keyboardMode = (pBoxObject as EntryMultiline).KeyboardMode;
            }

            //Prepare KeyBoard
            if (keyboardMode != KeyboardMode.None)
            {
                string iconKeyboard = FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], @"Icons/Windows/icon_window_keyboard.png"));
                _buttonKeyBoard = GetButton(iconKeyboard);
                _hbox.PackStart(_buttonKeyBoard, false, false, 0);
                _buttonKeyBoard.Clicked += delegate
                {
                    CallKeyboard(pBoxObject);
                };
                //Required to assign true, used only with custom buttons, when we inited widget without Keyboard, and Init it after, first time is assigned false
                if (pBoxObject.GetType() == typeof(EntryValidation))
                {
                    (pBoxObject as EntryValidation).IsEditable = true;
                }
                else if (pBoxObject.GetType() == typeof(EntryMultiline))
                {
                    (pBoxObject as EntryMultiline).TextView.Editable = true;
                }
            }
            //Make input Text ReadOnly
            else
            {
                if (pBoxObject.GetType() == typeof(EntryValidation))
                {
                    (pBoxObject as EntryValidation).IsEditable = false;
                }
                else if (pBoxObject.GetType() == typeof(EntryMultiline))
                {
                    (pBoxObject as EntryMultiline).TextView.Editable = false;
                }
            }
        }
예제 #24
0
        public EntryBoxValidation(Window pSourceWindow, String pLabelText, KeyboardMode pKeyboardMode, string pRule, bool pRequired)
            : base(pSourceWindow, pLabelText)
        {
            //EntryValidation
            _entryValidation = new EntryValidation(pSourceWindow, pKeyboardMode, pRule, pRequired)
            {
                Label = _label, LabelText = _label.Text
            };
            _entryValidation.ModifyFont(_fontDescription);
            //Started Validate
            _entryValidation.Validate();

            //Pack
            _hbox.PackStart(_entryValidation, true, true, 0);
            //Init Keyboard
            InitKeyboard(_entryValidation);
        }
예제 #25
0
        public EntryValidation(Window pSourceWindow, KeyboardMode pKeyboardMode, string pRule, bool pRequired, int pMaxLength, int pMaxWords)
            : this()
        {
            _sourceWindow = pSourceWindow;
            _keyboardMode = pKeyboardMode;
            _rule         = pRule;
            _required     = pRequired;
            _maxLength    = pMaxLength;
            _maxWords     = pMaxWords;

            //Assign MaxLength to Be Entry MaxLength
            if (pMaxLength > 0)
            {
                MaxLength = pMaxLength;
            }
            //Events
            this.Changed += EntryValidation_Changed;
        }
예제 #26
0
 //Switch between keyboard modes
 async Task SwitchKeyboardMode()
 {
     try
     {
         //Check keyboard mode
         KeyboardMode keyboardMode = (KeyboardMode)Convert.ToInt32(Setting_Load(vConfigurationDirectXInput, "KeyboardMode"));
         if (keyboardMode == KeyboardMode.Media)
         {
             Setting_Save(vConfigurationDirectXInput, "KeyboardMode", Convert.ToInt32(KeyboardMode.Scroll).ToString());
             await UpdateKeyboardMode();
         }
         else if (keyboardMode == KeyboardMode.Scroll)
         {
             Setting_Save(vConfigurationDirectXInput, "KeyboardMode", Convert.ToInt32(KeyboardMode.Media).ToString());
             await UpdateKeyboardMode();
         }
     }
     catch { }
 }
예제 #27
0
        //Constructor
        public PosKeyboardDialog(Window pSourceWindow, DialogFlags pDialogFlags, KeyboardMode pKeyboardMode, String pTextEntry, String pValidationRule) : base(pSourceWindow, pDialogFlags)
        {
            //Init Local Vars
            String windowTitle           = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_virtual_keyboard");
            Size   windowSize            = new Size(916, 358);
            String fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_keyboard.png");
            String fileKeyboardXML       = FrameworkUtils.OSSlash(GlobalFramework.Path["keyboards"] + @"163.xml");

            //Init Content
            Fixed fixedContent = new Fixed();

            //Initialize Virtual Keyboard
            _keyboardPad = new KeyBoardPad(fileKeyboardXML);

            //Pack It
            fixedContent.Put(_keyboardPad, 0, 10);

            //Assign dialog to keyboard ParentDialog Public Properties
            _keyboardPad.ParentDialog = this;
            _keyboardPad.KeyboardMode = pKeyboardMode;

            //Assign Parameters
            if (pTextEntry != string.Empty)
            {
                _keyboardPad.TextEntry.Text = pTextEntry;
            }
            if (pValidationRule != string.Empty)
            {
                _keyboardPad.TextEntry.Rule = pValidationRule;
            }
            _keyboardPad.TextEntry.Validate();

            if (pKeyboardMode == KeyboardMode.AlfaPassword)
            {
                _keyboardPad.TextEntry.InvisibleChar = '*';
                _keyboardPad.TextEntry.Visibility    = false;
            }

            //Init Object
            this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, windowSize, fixedContent, null);
        }
예제 #28
0
        public static string RequestAlfaNumericValue(Window pSourceWindow, KeyboardMode pKeyboardMode, string pDefaultValue, bool pUseDefaultValue = true)
        {
            string result;
            String regexAlfaNumeric = SettingsApp.RegexAlfaNumeric;
            String defaultValue     = (pUseDefaultValue) ? pDefaultValue : string.Empty;

            PosKeyboardDialog dialog = new PosKeyboardDialog(pSourceWindow, DialogFlags.DestroyWithParent, pKeyboardMode, defaultValue, regexAlfaNumeric);
            int response             = dialog.Run();

            if (response == (int)ResponseType.Ok)
            {
                result = dialog.Text;
            }
            else
            {
                result = string.Empty;
            }
            dialog.Destroy();

            return(result);
        }
예제 #29
0
        /// <inheritdoc/>
        public override Boolean ShowSoftwareKeyboard(KeyboardMode mode)
        {
            var controller = (SDL_uikitviewcontroller)UIApplication.SharedApplication?.KeyWindow?.RootViewController;

            if (controller == null)
            {
                return(false);
            }

            var textField = (UITextField)controller.View.Subviews[0];

            switch (mode)
            {
            case KeyboardMode.Number:
                textField.KeyboardType = UIKeyboardType.DecimalPad;
                textField.ReloadInputViews();
                break;

            case KeyboardMode.Phone:
                textField.KeyboardType = UIKeyboardType.PhonePad;
                textField.ReloadInputViews();
                break;

            case KeyboardMode.Datetime:
                textField.KeyboardType = UIKeyboardType.NumbersAndPunctuation;
                textField.ReloadInputViews();
                break;

            default:
                textField.KeyboardType = UIKeyboardType.Default;
                textField.ReloadInputViews();
                break;
            }

            controller.ShowKeyboard();
            OnShowingSoftwareKeyboard();

            return(true);
        }
 public IKeyboardMode ObtainMode( string modes )
 {
     if ( modes == null || modes.Length == 0 ) return _empty;
     modes = modes.Normalize();
     KeyboardMode m;
     if ( !_modes.TryGetValue( modes, out m ) )
     {
         int modeCount;
         string[] splitModes = SplitMultiMode( modes, out modeCount );
         if ( modeCount <= 0 ) return _empty;
         if ( modeCount == 1 )
         {
             modes = splitModes[0];
             if ( !_modes.TryGetValue( modes, out m ) )
             {
                 m = new KeyboardMode( this, modes );
                 _modes.Add( modes, m );
             }
             Debug.Assert( m.IsAtomic, "Special construction for atomic modes." );
         }
         else
         {
             modes = String.Join( "+", splitModes, 0, modeCount );
             if ( !_modes.TryGetValue( modes, out m ) )
             {
                 IKeyboardMode[] atomics = new IKeyboardMode[modeCount];
                 for ( int i = 0; i < modeCount; ++i )
                 {
                     atomics[i] = ObtainMode( splitModes[i] );
                 }
                 m = new KeyboardMode( this, modes, new CKReadOnlyListOnIList<IKeyboardMode>( atomics ) );
                 _modes.Add( modes, m );
             }
             Debug.Assert( !m.IsAtomic && m.AtomicModes.Count == modeCount, "Combined mode." );
         }
     }
     return m;
 }
예제 #31
0
    void ChangeMode(KeyboardMode newMode)
    {
        _currentMode = newMode;

        string[,] chars = null;
        switch(newMode)
        {
            case KeyboardMode.Lowercase:
                chars = _lowerChars;
                break;
            case KeyboardMode.Uppercase:
                chars = _upperChars;
                break;
        }

        for(int i = 0; i < _rows; i++)
        {
            for(int j = 0; j < _columns; j++)
            {
                _alphaButtons[i * _columns + j].SetText( chars[i, j] );
            }
        }
    }
예제 #32
0
        public EntryMultiline(Window pSourceWindow, KeyboardMode pKeyboardMode)
        {
            _sourceWindow = pSourceWindow;
            _keyboardMode = pKeyboardMode;

            //Init
            _textView          = new TextView();
            _textView.WrapMode = WrapMode.WordChar;
            //ScrolledWindow
            _scrolledWindow             = new ScrolledWindow();
            _scrolledWindow.BorderWidth = 2;
            _scrolledWindow.SetPolicy(PolicyType.Never, PolicyType.Automatic);
            _scrolledWindow.Add(_textView);

            //Init Value Reference
            _value = _textView.Buffer;

            //Pack
            Add(_scrolledWindow);

            //Events
            _textView.Buffer.Changed  += Buffer_Changed;
            _textView.KeyReleaseEvent += _textView_KeyReleaseEvent;
        }
 /// <inheritdoc/>
 public override Boolean ShowSoftwareKeyboard(KeyboardMode mode)
 {
     return(false);
 }
예제 #34
0
 public EntryValidation(Window pSourceWindow, KeyboardMode pKeyboardMode, string pRule, bool pRequired)
     : this(pSourceWindow, pKeyboardMode, pRule, pRequired, 0, 0)
 {
 }
        /// <summary>
        /// Obtains a mode from a list of atomic (already sorted) modes.
        /// Used by fall back generation.
        /// </summary>
        public IKeyboardMode ObtainMode( IKeyboardMode[] atomicModes, int count )
        {
            Debug.Assert( count > 1, "Atomic modes are handled directly." );

            Debug.Assert( !Array.Exists( atomicModes, delegate( IKeyboardMode mA ) { return mA.Context != this || mA.AtomicModes.Count != 1; } ),
                "Modes are from this Context and they are atomic and not empty." );

            StringBuilder b = new StringBuilder( atomicModes[0].ToString() );
            for ( int i = 1; i < count; ++i )
            {
                Debug.Assert( StringComparer.Ordinal.Compare( atomicModes[i - 1].ToString(), atomicModes[i].ToString() ) < 0,
                    "Modes are already sorted and NO DUPLICATE exists." );
                b.Append( '+' ).Append( atomicModes[i].ToString() );
            }
            string modes = b.ToString();
            KeyboardMode m;
            if ( !_modes.TryGetValue( modes, out m ) )
            {
                if ( atomicModes.Length != count )
                {
                    IKeyboardMode[] subArray = new IKeyboardMode[count];
                    Array.Copy( atomicModes, subArray, count );
                    atomicModes = subArray;
                }
                else atomicModes = (IKeyboardMode[])atomicModes.Clone();
                m = new KeyboardMode( this, modes, new CKReadOnlyListOnIList<IKeyboardMode>( atomicModes ) );
                _modes.Add( modes, m );
            }
            return m;
        }
 /// <inheritdoc/>
 public override Boolean ShowSoftwareKeyboard(KeyboardMode mode)
 {
     return false;
 }
예제 #37
0
 /// <inheritdoc/>
 public void ShowSoftwareKeyboard(KeyboardMode mode)
 {
     Contract.EnsureNotDisposed(this, Disposed);
 }
예제 #38
0
 /// <summary>
 /// Shows the software keyboard, if one is available.
 /// </summary>
 /// <param name="mode">The display mode of the software keyboard.</param>
 /// <returns><see langword="true"/> if the software keyboard was shown; otherwise, <see langword="false"/>.</returns>
 public abstract Boolean ShowSoftwareKeyboard(KeyboardMode mode);
예제 #39
0
 /// <inheritdoc/>
 public void ShowSoftwareKeyboard(KeyboardMode mode)
 {
     Contract.EnsureNotDisposed(this, Disposed);
 }
 /// <summary>
 /// Obtains a mode from a list of atomic (already sorted) modes.
 /// Used by the Add, Toggle, Remove, Intersect methods.
 /// </summary>
 public IKeyboardMode ObtainMode( List<IKeyboardMode> atomicModes )
 {
     if ( atomicModes.Count == 0 ) return _empty;
     Debug.Assert( atomicModes[0].Context == this, "This is one of our modes." );
     Debug.Assert( atomicModes[0].AtomicModes.Count == 1, "This is an atomic mode and not the empty one." );
     if ( atomicModes.Count == 1 ) return atomicModes[0];
     StringBuilder b = new StringBuilder( atomicModes[0].ToString() );
     for ( int i = 1; i < atomicModes.Count; ++i )
     {
         Debug.Assert( atomicModes[i].Context == this, "This is one of our modes." );
         Debug.Assert( atomicModes[i].AtomicModes.Count == 1, "This is an atomic mode and not the empty one." );
         Debug.Assert( StringComparer.Ordinal.Compare( atomicModes[i - 1].ToString(), atomicModes[i].ToString() ) < 0,
             "Modes are already sorted and NO DUPLICATES exist." );
         b.Append( '+' ).Append( atomicModes[i].ToString() );
     }
     string modes = b.ToString();
     KeyboardMode m;
     if ( !_modes.TryGetValue( modes, out m ) )
     {
         m = new KeyboardMode( this, modes, new CKReadOnlyListOnIList<IKeyboardMode>( atomicModes.ToArray() ) );
         _modes.Add( modes, m );
     }
     return m;
 }