Esempio n. 1
0
        private void InitialiseKeyboard(IWindowManipulationService windowManipulationService)
        {
            if (Settings.Default.ConversationOnlyMode)
            {
                Keyboard = new ConversationAlpha1(null);
                windowManipulationService.Maximise();
            }
            else if (Settings.Default.ConversationConfirmOnlyMode)
            {
                Keyboard = new ConversationConfirm(null);
                windowManipulationService.Maximise();
            }
            else
            {
                switch (Settings.Default.StartupKeyboard)
                {
                case Enums.Keyboards.ConversationAlpha:
                case Enums.Keyboards.ConversationConfirm:
                case Enums.Keyboards.ConversationNumericAndSymbols:
                    SetKeyboardFromEnum(Settings.Default.StartupKeyboard,
                                        windowManipulationService, () =>
                    {
                        Keyboard = new Menu(() => Keyboard = new Alpha1());
                        windowManipulationService.Restore();
                        windowManipulationService.ResizeDockToFull();
                    });
                    break;

                case Enums.Keyboards.Minimised:
                    SetKeyboardFromEnum(Settings.Default.StartupKeyboard,
                                        windowManipulationService, () =>
                    {
                        Keyboard = new Menu(() => Keyboard = new Alpha1());
                        windowManipulationService.Restore();
                        windowManipulationService.ResizeDockToFull();
                    });
                    break;

                case Enums.Keyboards.CustomKeyboardFile:
                    SetKeyboardFromEnum(Settings.Default.StartupKeyboard,
                                        windowManipulationService, () =>
                    {
                        Keyboard = new Menu(() => Keyboard = new Alpha1());
                    });
                    break;

                default:
                    SetKeyboardFromEnum(Settings.Default.StartupKeyboard,
                                        windowManipulationService, () =>
                    {
                        Keyboard = new Alpha1();
                    });
                    break;
                }
            }
        }
Esempio n. 2
0
        private void SetKeyboardFromEnum(Enums.Keyboards keyboardEnum,
                                         IWindowManipulationService windowManipulationService,
                                         Action backAction)
        {
            // Set up the keyboard
            switch (keyboardEnum)
            {
            case Enums.Keyboards.Alpha:
                Keyboard = new Alpha1();
                break;

            case Enums.Keyboards.ConversationAlpha:
                Keyboard = new ConversationAlpha1(backAction);
                break;

            case Enums.Keyboards.ConversationNumericAndSymbols:
                Keyboard = new ConversationNumericAndSymbols(backAction);
                break;

            case Enums.Keyboards.ConversationConfirm:
                Keyboard = new ConversationConfirm(backAction);
                break;

            case Enums.Keyboards.Currencies1:
                Keyboard = new Currencies1();
                break;

            case Enums.Keyboards.Currencies2:
                Keyboard = new Currencies2();
                break;

            case Enums.Keyboards.CustomKeyboardFile:
                Keyboard = new DynamicKeyboard(backAction, (d) => { }, Settings.Default.StartupKeyboardFile);
                break;

            case Enums.Keyboards.Diacritics1:
                Keyboard = new Diacritics1();
                break;

            case Enums.Keyboards.Diacritics2:
                Keyboard = new Diacritics2();
                break;

            case Enums.Keyboards.Diacritics3:
                Keyboard = new Diacritics3();
                break;

            case Enums.Keyboards.Menu:
                Keyboard = new Menu(backAction);
                break;

            case Enums.Keyboards.Minimised:
                Keyboard = new Minimised(backAction);
                break;

            case Enums.Keyboards.Mouse:
                Keyboard = new Mouse(backAction);
                break;

            case Enums.Keyboards.NumericAndSymbols1:
                Keyboard = new NumericAndSymbols1();
                break;

            case Enums.Keyboards.NumericAndSymbols2:
                Keyboard = new NumericAndSymbols2();
                break;

            case Enums.Keyboards.NumericAndSymbols3:
                Keyboard = new NumericAndSymbols3();
                break;

            case Enums.Keyboards.PhysicalKeys:
                Keyboard = new PhysicalKeys();
                break;

            case Enums.Keyboards.SizeAndPosition:
                Keyboard = new SizeAndPosition(backAction);
                break;

            case Enums.Keyboards.WebBrowsing:
                Keyboard = new WebBrowsing();
                break;
            }

            // Set the window appropriately according to keyboard
            switch (Settings.Default.StartupKeyboard)
            {
            case Enums.Keyboards.ConversationAlpha:
            case Enums.Keyboards.ConversationConfirm:
            case Enums.Keyboards.ConversationNumericAndSymbols:
                windowManipulationService.Maximise();
                break;

            case Enums.Keyboards.Minimised:
                windowManipulationService.Minimise();
                break;

            case Enums.Keyboards.Mouse:
                windowManipulationService.Restore();
                if (Settings.Default.MouseKeyboardDockSize == DockSizes.Full)
                {
                    windowManipulationService.ResizeDockToFull();
                }
                else
                {
                    windowManipulationService.ResizeDockToCollapsed();
                }
                break;

            default:
                windowManipulationService.Restore();
                windowManipulationService.ResizeDockToFull();
                break;
            }
        }
Esempio n. 3
0
        private void SetKeyboardFromEnum(Enums.Keyboards keyboardEnum,
                                         IWindowManipulationService windowManipulationService,
                                         Action backAction)
        {
            if (Keyboard is Minimised && keyboardEnum == Enums.Keyboards.Minimised)
            {
                return;
            }
            // Set up the keyboard
            switch (keyboardEnum)
            {
            case Enums.Keyboards.Alpha:
                Keyboard = new Alpha1();
                break;

            case Enums.Keyboards.ConversationAlpha:
                Keyboard = new ConversationAlpha1(backAction);
                break;

            case Enums.Keyboards.ConversationNumericAndSymbols:
                Keyboard = new ConversationNumericAndSymbols(backAction);
                break;

            case Enums.Keyboards.ConversationConfirm:
                Keyboard = new ConversationConfirm(backAction);
                break;

            case Enums.Keyboards.Currencies1:
                Keyboard = new Currencies1();
                break;

            case Enums.Keyboards.Currencies2:
                Keyboard = new Currencies2();
                break;

            case Enums.Keyboards.CustomKeyboardFile:
                Keyboard = new DynamicKeyboard(backAction, keyStateService, Settings.Default.StartupKeyboardFile);
                break;

            case Enums.Keyboards.Diacritics1:
                Keyboard = new Diacritics1();
                break;

            case Enums.Keyboards.Diacritics2:
                Keyboard = new Diacritics2();
                break;

            case Enums.Keyboards.Diacritics3:
                Keyboard = new Diacritics3();
                break;

            case Enums.Keyboards.DynamicKeyboard:
                Keyboard = new DynamicKeyboardSelector(() => { }, 0);
                break;

            case Enums.Keyboards.Menu:
                Keyboard = new Menu(backAction);
                break;

            case Enums.Keyboards.Minimised:
                mainWindowManipulationService.Minimise();
                var currentKeyboard = Keyboard;
                Keyboard = new Minimised(() =>
                {
                    mainWindowManipulationService.Restore();
                    Keyboard = currentKeyboard != null ? currentKeyboard : new Menu(() => Keyboard = new Alpha1());
                });
                break;

            case Enums.Keyboards.Mouse:
                Keyboard = new Mouse(backAction);
                break;

            case Enums.Keyboards.NumericAndSymbols1:
                Keyboard = new NumericAndSymbols1();
                break;

            case Enums.Keyboards.NumericAndSymbols2:
                Keyboard = new NumericAndSymbols2();
                break;

            case Enums.Keyboards.NumericAndSymbols3:
                Keyboard = new NumericAndSymbols3();
                break;

            case Enums.Keyboards.PhysicalKeys:
                Keyboard = new PhysicalKeys();
                break;

            case Enums.Keyboards.SizeAndPosition:
                Keyboard = new SizeAndPosition(backAction);
                break;

            case Enums.Keyboards.WebBrowsing:
                Keyboard = new WebBrowsing();
                break;

            default:
                Log.ErrorFormat("Cannot load keyboard: {0}, this is not a valid StartupKeyboard",
                                Settings.Default.StartupKeyboard);
                break;
            }

            // Set the window appropriately according to keyboard
            switch (keyboardEnum)
            {
            case Enums.Keyboards.ConversationAlpha:
            case Enums.Keyboards.ConversationConfirm:
            case Enums.Keyboards.ConversationNumericAndSymbols:
                windowManipulationService.Maximise();
                break;

            case Enums.Keyboards.Minimised:
                break;

            case Enums.Keyboards.Mouse:
                windowManipulationService.Restore();
                if (Settings.Default.MouseKeyboardDockSize == DockSizes.Full)
                {
                    windowManipulationService.ResizeDockToFull();
                }
                else
                {
                    windowManipulationService.ResizeDockToCollapsed();
                }
                break;

            default:
                windowManipulationService.Restore();
                windowManipulationService.ResizeDockToFull();
                break;
            }
        }