private void SetLayoutByLanguage(Language currentAppLanguage) { // 1. letters IVirtualKeyboardLayoutProvider lettersLayoutProvider; switch (currentAppLanguage.LanguageTag) { case "ru": lettersLayoutProvider = new RussianLettersProvider(); break; case "uk": lettersLayoutProvider = new UkrainianLettersProvider(); break; case "en": default: lettersLayoutProvider = new UsLettersProvider(); break; } lettersLayoutProvider.InitLayout(currentAppLanguage); var lettersLayout = lettersLayoutProvider.Layout; var lettersRows = lettersLayout.Rows; // 2. space and backspace var spaceRow = new VirtualKeyboardLayoutRow { CreatePlaceholder(), CreatePlaceholder(), new VirtualKey() { Type = VirtualKeyTypeEnum.Special, SpecialKeyType = VirtualSpecialKeyTypeEnum.Space, }, CreatePlaceholder(), new VirtualKey() { Type = VirtualKeyTypeEnum.Special, SpecialKeyType = VirtualSpecialKeyTypeEnum.Backspace, }, }; var layout = new VirtualKeyboardLayout(); layout.Rows.AddRange(lettersRows); layout.Rows.Add(spaceRow); Layout = layout; }
private void SetLayoutByLanguage(Language language) { // 1. numbers and backspace var numberSymbols = "1234567890"; var numbersRow = new VirtualKeyboardLayoutRow(); numbersRow.AddRange(numberSymbols .Select(x => new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = x.ToString(), })); numbersRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Special, SpecialKeyType = VirtualSpecialKeyTypeEnum.Backspace, }); // 2. letters var lettersLayoutProvider = new UsLettersProvider(); lettersLayoutProvider.InitLayout(language); var lettersLayout = lettersLayoutProvider.Layout; var lettersRows = lettersLayout.Rows; // confirm var lastRow = lettersRows.Last(); lastRow.Insert(0, CreatePlaceholder()); lastRow.Insert(0, CreatePlaceholder()); lastRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Control, Value = LanguageManager.Current.GetLocalizedString("VirtualKeyboard_SearchKey_Text"), ControlCommand = CommonControlCommands.Confirm, Icon = KeyboardIcons.Search, } ); var layout = new VirtualKeyboardLayout(); layout.Rows.Add(numbersRow); layout.Rows.AddRange(lettersRows); Layout = layout; }
private void SetLayoutByLanguage(Language language) { _selectedAppLanguage = language; // 1. numbers and backspace var numberSymbols = "1234567890"; var numbersRow = new VirtualKeyboardLayoutRow(); numbersRow.AddRange(numberSymbols .Select(x => new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = x.ToString(), })); numbersRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Special, SpecialKeyType = VirtualSpecialKeyTypeEnum.Backspace, }); // 2. letters IVirtualKeyboardLayoutProvider lettersLayoutProvider; switch (language.LanguageTag) { case "ru": lettersLayoutProvider = new RussianLettersProvider(); break; case "uk": lettersLayoutProvider = new UkrainianLettersProvider(); break; case "en": default: lettersLayoutProvider = new UsLettersProvider(); break; } lettersLayoutProvider.InitLayout(_currentAppLanguage); var lettersLayout = lettersLayoutProvider.Layout; var lettersRows = lettersLayout.Rows; // additional text symbols var _2ndLetterRow = lettersRows[1]; _2ndLetterRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = "-", }); var _3rdLetterRow = lettersRows[2]; _3rdLetterRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = "/", }); _3rdLetterRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = ".", }); // 3. space and languages var lastRow = new VirtualKeyboardLayoutRow { new VirtualKey() { Type = VirtualKeyTypeEnum.Special, SpecialKeyType = VirtualSpecialKeyTypeEnum.Space, }, new VirtualKey() { Type = VirtualKeyTypeEnum.Control, Value = language.NativeName.ToUpper().FirstNSymbols(3), ControlCommand = CommonControlCommands.SwitchLanguage, }, }; if (ShowConfirmCommand) { // confirm lastRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Control, Value = LanguageManager.Current.GetLocalizedString("VirtualKeyboard_SearchKey_Text"), ControlCommand = CommonControlCommands.Confirm, Icon = KeyboardIcons.Search, }); } else { // 1 placeholder between space and language switch lastRow.Insert(1, CreatePlaceholder()); // 3 placeholder at the start lastRow.Insert(0, CreatePlaceholder()); lastRow.Insert(0, CreatePlaceholder()); } var layout = new VirtualKeyboardLayout(); layout.Rows.Add(numbersRow); layout.Rows.AddRange(lettersRows); layout.Rows.Add(new VirtualKeyboardLayoutRow(lastRow)); Layout = layout; }
private void SetLayoutByLanguage(Language currentAppLanguage) { // 1. numbers and backspace var numberSymbols = "1234567890"; var numbersRow = new VirtualKeyboardLayoutRow(); numbersRow.AddRange(numberSymbols .Select(x => new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = x.ToString(), })); numbersRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Special, SpecialKeyType = VirtualSpecialKeyTypeEnum.Backspace, }); // 2. letters IVirtualKeyboardLayoutProvider lettersLayoutProvider; switch (currentAppLanguage.LanguageTag) { case "ru": lettersLayoutProvider = new RussianLettersProvider(); break; case "uk": lettersLayoutProvider = new UkrainianLettersProvider(); break; case "en": default: lettersLayoutProvider = new UsLettersProvider(); break; } lettersLayoutProvider.InitLayout(currentAppLanguage); var lettersLayout = lettersLayoutProvider.Layout; var lettersRows = lettersLayout.Rows; // additional text symbols var _2ndLetterRow = lettersRows[1]; _2ndLetterRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = "-", }); var _3rdLetterRow = lettersRows[2]; _3rdLetterRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = ",", }); _3rdLetterRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = ".", }); // 3. space var spaceRow = new VirtualKeyboardLayoutRow { new VirtualKey() { Type = VirtualKeyTypeEnum.Special, SpecialKeyType = VirtualSpecialKeyTypeEnum.Space, }, }; var layout = new VirtualKeyboardLayout(); layout.Rows.Add(numbersRow); layout.Rows.AddRange(lettersRows); layout.Rows.Add(spaceRow); Layout = layout; }
private void SetLayoutByLanguage(Language language) { _selectedAppLanguage = language; // 1. numbers and backspace var numberSymbols = "1234567890"; var numbersRow = new VirtualKeyboardLayoutRow(); numbersRow.AddRange(numberSymbols .Select(x => new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = x.ToString(), })); numbersRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Special, SpecialKeyType = VirtualSpecialKeyTypeEnum.Backspace, }); // 2. letters IVirtualKeyboardLayoutProvider lettersLayoutProvider; switch (language.LanguageTag) { case "ru": lettersLayoutProvider = new RussianLettersProvider(); break; case "uk": lettersLayoutProvider = new UkrainianLettersProvider(); break; case "en": default: lettersLayoutProvider = new UsLettersProvider(); break; } lettersLayoutProvider.InitLayout(_currentAppLanguage); var lettersLayout = lettersLayoutProvider.Layout; var lettersRows = lettersLayout.Rows; // extra symbols if (language.LanguageTag == "en") { var _2ndLettersRow = lettersRows[1]; _2ndLettersRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = "-", }); var _3rdLettersRow = lettersRows[2]; _3rdLettersRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = "+", }); _3rdLettersRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = "/", }); _3rdLettersRow.Add(new VirtualKey() { Type = VirtualKeyTypeEnum.Text, Value = ".", }); } // 3. space, languages and confirm var lastRow = new VirtualKeyboardLayoutRow { new VirtualKey() { Type = VirtualKeyTypeEnum.Special, SpecialKeyType = VirtualSpecialKeyTypeEnum.Space, }, new VirtualKey() { Type = VirtualKeyTypeEnum.Control, Value = language.NativeName.ToUpper().FirstNSymbols(3), ControlCommand = CommonControlCommands.SwitchLanguage, }, new VirtualKey() { Type = VirtualKeyTypeEnum.Control, Value = LanguageManager.Current.GetLocalizedString("VirtualKeyboard_SearchKey_Text"), ControlCommand = CommonControlCommands.Confirm, Icon = KeyboardIcons.Search, } }; var layout = new VirtualKeyboardLayout(); layout.Rows.Add(numbersRow); layout.Rows.AddRange(lettersRows); layout.Rows.Add(lastRow); Layout = layout; }