/// <summary>
        /// Default class constructor.
        /// </summary>
        public MainPageViewModel()
        {
            MainLabel = new string[KeyLen];

            Array.Copy(LowerCase, MainLabel, MainLabel.Length);

            ShiftStatus       = IMEShiftStates.ShiftOff;
            LayoutType        = IMEKeyboardLayoutType.LayoutEnglish;
            LayoutString      = "?123";
            ShiftImage        = "sample_ime_shift_off.png";
            SymText           = "";
            ShiftImageOpacity = 1;
            ShiftBgImageColor = "Gray";

            this.Backspace = new Command(() =>
            {
                // Send a backspace key event.
                InputMethodEditor.SendKeyEvent(KeyCode.BackSpace, KeyMask.Pressed);
                InputMethodEditor.SendKeyEvent(KeyCode.BackSpace, KeyMask.Released);
            });
            this.PressButton = new Command((value) =>
            {
                string input = value.ToString();
                // Sending input text data.
                InputMethodEditor.CommitString(input);
                if (LayoutType == IMEKeyboardLayoutType.LayoutEnglish && ShiftStatus == IMEShiftStates.ShiftOn)
                {
                    Array.Copy(LowerCase, MainLabel, MainLabel.Length);
                    ShiftStatus = IMEShiftStates.ShiftOff;
                    ShiftImage  = "sample_ime_shift_off.png";
                    UpdateDisplay();
                }
            });
            this.ReturnButton = new Command(() =>
            {
                // Send a return key event.
                InputMethodEditor.SendKeyEvent(KeyCode.Return, KeyMask.Pressed);
                InputMethodEditor.SendKeyEvent(KeyCode.Return, KeyMask.Released);
            });
            this.ShiftButton = new Command(() =>
            {
                if (LayoutType == IMEKeyboardLayoutType.LayoutEnglish)
                {
                    SymText           = "";
                    ShiftImageOpacity = 1;
                    if (ShiftStatus == IMEShiftStates.ShiftOff)
                    {
                        Array.Copy(UpperCase, MainLabel, MainLabel.Length);
                        ShiftStatus       = IMEShiftStates.ShiftOn;
                        ShiftImage        = "sample_ime_shift_on.png";
                        ShiftBgImageColor = "Gray";
                        UpdateDisplay();
                    }
                    else if (ShiftStatus == IMEShiftStates.ShiftOn)
                    {
                        Array.Copy(UpperCase, MainLabel, MainLabel.Length);
                        ShiftStatus       = IMEShiftStates.ShiftLock;
                        ShiftImage        = "sample_ime_shift_loc.png";
                        ShiftBgImageColor = "DeepSkyBlue";
                        UpdateDisplay();
                    }
                    else if (ShiftStatus == IMEShiftStates.ShiftLock)
                    {
                        Array.Copy(LowerCase, MainLabel, MainLabel.Length);
                        ShiftStatus       = IMEShiftStates.ShiftOff;
                        ShiftImage        = "sample_ime_shift_off.png";
                        ShiftBgImageColor = "Gray";
                        UpdateDisplay();
                    }
                }
                else if (LayoutType == IMEKeyboardLayoutType.LayoutSym2)
                {
                    LayoutType = IMEKeyboardLayoutType.LayoutSym1;
                    Array.Copy(Symbol1, MainLabel, MainLabel.Length);
                    SymText           = "1/2";
                    ShiftImageOpacity = 0;
                    ShiftBgImageColor = "Gray";
                    UpdateDisplay();
                }
                else
                {
                    LayoutType = IMEKeyboardLayoutType.LayoutSym2;
                    Array.Copy(Symbol2, MainLabel, MainLabel.Length);
                    SymText           = "2/2";
                    ShiftImageOpacity = 0;
                    ShiftBgImageColor = "Gray";
                    UpdateDisplay();
                }
            });
            this.LayoutButton = new Command(() =>
            {
                if (LayoutType == IMEKeyboardLayoutType.LayoutEnglish)
                {
                    LayoutType = IMEKeyboardLayoutType.LayoutSym1;
                    Array.Copy(Symbol1, MainLabel, MainLabel.Length);
                    LayoutString      = "abc";
                    SymText           = "1/2";
                    ShiftImageOpacity = 0;
                    ShiftBgImageColor = "Gray";
                    UpdateDisplay();
                }
                else if (LayoutType == IMEKeyboardLayoutType.LayoutSym1 || LayoutType == IMEKeyboardLayoutType.LayoutSym2)
                {
                    LayoutType = IMEKeyboardLayoutType.LayoutEnglish;
                    Array.Copy(LowerCase, MainLabel, MainLabel.Length);
                    LayoutString      = "?123";
                    SymText           = "";
                    ShiftBgImageColor = "Gray";
                    ShiftImage        = "sample_ime_shift_off.png";
                    ShiftImageOpacity = 1;
                    UpdateDisplay();
                }
            });
        }
        /// <summary>
        /// Default class constructor
        /// </summary>
        public MainViewModel()
        {
            MainLabel = new string[KeyLen];
            Array.Copy(LowerCase, MainLabel, MainLabel.Length);
            ShiftStatus    = IMEShiftStates.ShiftOff;
            ShiftImage     = ImageURL + "shift_off.png";
            BackSpaceImage = ImageURL + "back_space_normal.png";
            SpaceImage     = ImageURL + "space_normal.png";
            ReturnImage    = ImageURL + "enter_normal.png";
            LayoutString   = "?123";
            SymText        = "";

            /// <summary>
            /// Process text button event
            /// </summary>
            this.PressButton = new Command((value) =>
            {
                string text = value.ToString();
                Log.Info("IMESample", "PressButton: Text : " + text);
                InputMethodEditor.CommitString(text);
                if (LayoutType == IMEKeyboardLayoutType.LayoutEnglish && ShiftStatus == IMEShiftStates.ShiftOn)
                {
                    Array.Copy(LowerCase, MainLabel, MainLabel.Length);
                    ShiftStatus = IMEShiftStates.ShiftOff;
                    ShiftImage  = ImageURL + "shift_off.png";
                    UpdateDisplay();
                }
            });

            /// <summary>
            /// Process shift button event
            /// </summary>
            this.ShiftButton = new Command(() =>
            {
                Log.Info("IMESample", "ShiftButton Clicked.");
                if (LayoutType == IMEKeyboardLayoutType.LayoutEnglish)
                {
                    SymText = "";
                    switch (ShiftStatus)
                    {
                    case IMEShiftStates.ShiftOff:
                        Array.Copy(UpperCase, MainLabel, MainLabel.Length);
                        ShiftStatus = IMEShiftStates.ShiftOn;
                        ShiftImage  = ImageURL + "shift_on.png";
                        break;

                    case IMEShiftStates.ShiftOn:
                        Array.Copy(UpperCase, MainLabel, MainLabel.Length);
                        ShiftStatus = IMEShiftStates.ShiftLock;
                        ShiftImage  = ImageURL + "shift_loc.png";
                        break;

                    case IMEShiftStates.ShiftLock:
                        Array.Copy(LowerCase, MainLabel, MainLabel.Length);
                        ShiftStatus = IMEShiftStates.ShiftOff;
                        ShiftImage  = ImageURL + "shift_off.png";
                        break;
                    }
                }
                else if (LayoutType == IMEKeyboardLayoutType.LayoutSym1)
                {
                    LayoutType = IMEKeyboardLayoutType.LayoutSym2;
                    Array.Copy(Symbol2, MainLabel, MainLabel.Length);
                    SymText = "2/2";
                }
                else
                {
                    LayoutType = IMEKeyboardLayoutType.LayoutSym1;
                    Array.Copy(Symbol1, MainLabel, MainLabel.Length);
                    SymText = "1/2";
                }

                UpdateDisplay();
            });

            /// <summary>
            /// Process backspace button event
            /// </summary>
            this.BackSpaceButton = new Command(() =>
            {
                Log.Info("IMESample", "BackSpaceButton Clicked.");
                InputMethodEditor.SendKeyEvent(KeyCode.BackSpace, KeyMask.Pressed);
                InputMethodEditor.SendKeyEvent(KeyCode.BackSpace, KeyMask.Released);
            });

            /// <summary>
            /// Process layout button event
            /// </summary>
            this.LayoutButton = new Command(() =>
            {
                Log.Info("IMESample", "LayoutButton Clicked.");
                if (LayoutType == IMEKeyboardLayoutType.LayoutEnglish)
                {
                    LayoutType = IMEKeyboardLayoutType.LayoutSym1;
                    Array.Copy(Symbol1, MainLabel, MainLabel.Length);
                    LayoutString = "abc";
                    SymText      = "1/2";
                    ShiftImage   = "";
                }
                else
                {
                    LayoutType = IMEKeyboardLayoutType.LayoutEnglish;
                    Array.Copy(LowerCase, MainLabel, MainLabel.Length);
                    LayoutString = "?123";
                    SymText      = "";
                    ShiftImage   = ImageURL + "shift_off.png";
                }

                UpdateDisplay();
            });

            /// <summary>
            /// Process return button event
            /// </summary>
            this.ReturnButton = new Command(() =>
            {
                Log.Info("IMESample", "ReturnButton Clicked.");
                InputMethodEditor.SendKeyEvent(KeyCode.Return, KeyMask.Pressed);
                InputMethodEditor.SendKeyEvent(KeyCode.Return, KeyMask.Released);
            });
        }