public ActionCenterKeyboardLayoutButton(IKeyboardLayout layout) { this.layout = layout; InitializeComponent(); InitializeEvents(); }
internal KeyboardLayoutButton(IKeyboardLayout layout) { this.layout = layout; InitializeComponent(); InitializeLayoutButton(); }
public TaskbarKeyboardLayoutButton(IKeyboardLayout layout) { this.layout = layout; InitializeComponent(); InitializeEvents(); }
private IEnumerator SetupKeys() { IKeyboardLayout layout = KeyboardLayoutList.GetLayout(keyboardLayout); // Hide everything before setting up the keys keyboardWrapper.SetActive(false); var keyDict = new Dictionary <string, Key>(); KeyboardRow[] rows = layout.Rows(); for (int i = 0; i < rows.Length; i++) { KeyboardKey[] keys = rows[i].Keys; GameObject row = (GameObject)Instantiate(rowPrefab, keyboardWrapper.transform); for (int j = 0; j < keys.Length; j++) { (Key key, GameObject obj) = (keys[j] is LetterKeyboardKey o1) ? SetupKey(o1, row) : (keys[j] is ShiftKeyboardKey o2) ? SetupKey(o2, row) : (keys[j] is BackSpaceKeyboardKey o3) ? SetupKey(o3, row) : (keys[j] is SpaceKeyboardKey o4) ? SetupKey(o4, row) : (keys[j] is EnterKeyboardKey o5) ? SetupKey(o5, row) : (null, null); keyDict.Add(obj.name, key); obj.SetActive(true); if (i == 0 && j == 0) { firstKey = obj; } } row.SetActive(true); } foreach (var kvp in layout.Navigation()) { var button = keyDict[kvp.Key]; (string top, string bottom, string left, string right) = kvp.Value; if (top != null) { button.Top = keyDict[top]; } if (bottom != null) { button.Bottom = keyDict[bottom]; } if (left != null) { button.Left = keyDict[left]; } if (right != null) { button.Right = keyDict[right]; } } // Reset visibility of canvas and keyboard keyboardWrapper.SetActive(open); yield return(null); }
public void Add(IKeyboardLayout layout) { Dispatcher.Invoke(() => { var button = new ActionCenterKeyboardLayoutButton(layout); button.LayoutSelected += Button_LayoutSelected; button.CultureCode = layout.CultureCode; button.LayoutName = layout.Name; LayoutsStackPanel.Children.Add(button); }); }
public void SetCurrent(IKeyboardLayout layout) { Dispatcher.Invoke(() => { foreach (var child in LayoutsStackPanel.Children) { if (child is ActionCenterKeyboardLayoutButton layoutButton) { layoutButton.IsCurrent = layout.Id == layoutButton.LayoutId; } } Text.Text = layout.Name; }); }
private void SetCurrent(IKeyboardLayout layout) { var tooltip = text.Get(TextKey.SystemControl_KeyboardLayoutTooltip).Replace("%%LAYOUT%%", layout.Name); foreach (var child in LayoutsStackPanel.Children) { if (child is KeyboardLayoutButton layoutButton) { layoutButton.IsCurrent = layout.Id == layoutButton.LayoutId; } } Text.Text = layout.Name; Button.ToolTip = tooltip; }
private void SetCurrent(IKeyboardLayout layout) { var name = layout.Name?.Length > 3 ? String.Join(string.Empty, layout.Name.Split(' ').Where(s => Char.IsLetter(s.First())).Select(s => s.First())) : layout.Name; var tooltip = text.Get(TextKey.SystemControl_KeyboardLayoutTooltip).Replace("%%LAYOUT%%", layout.Name); foreach (var child in LayoutsStackPanel.Children) { if (child is KeyboardLayoutButton layoutButton) { layoutButton.IsCurrent = layout.Id == layoutButton.LayoutId; } } LayoutCultureCode.Text = layout.CultureCode; Button.ToolTip = tooltip; }
private void AddEventHandlers(IKeyboardLayout keybdLayout) { keybdLayout.KeyCapPressed += currentKeybdLayout_KeyCapPressed; keybdLayout.KeyCapReleased += currentKeybdLayout_KeyCapReleased; keybdLayout.KeyCapChecked += keybdLayout_KeyCapChecked; keybdLayout.KeyCapUnchecked += keybdLayout_KeyCapUnchecked; keybdLayout.LanguageKeyCapTap += currentKeybdLayout_LanguageKeyCapTap; keybdLayout.SymbolKeyCapTap += currentKeybdLayout_SymbolKeyCapTap; //펑션키 토글 이벤트 keybdLayout.FunctionKeyCapChecked += currentKeybdLayout_FunctionKeyCapTap; keybdLayout.FunctionKeyCapUnchecked += currentKeybdLayout_FunctionKeyCapTap; //키보드 초기화 이벤트 keybdLayout.KeyboardLayoutReseted += keybdLayout_KeyboardLayoutReseted; }
public void SetCurrent(IKeyboardLayout layout) { Dispatcher.Invoke(() => { var name = layout.Name?.Length > 3 ? String.Join(string.Empty, layout.Name.Split(' ').Where(s => Char.IsLetter(s.First())).Select(s => s.First())) : layout.Name; foreach (var child in LayoutsStackPanel.Children) { if (child is TaskbarKeyboardLayoutButton layoutButton) { layoutButton.IsCurrent = layout.Id == layoutButton.LayoutId; } } LayoutCultureCode.Text = layout.CultureCode; }); }
void currentKeybdLayout_FunctionKeyCapTap(object sender, Key.KeyCapEventArgs e) { int index = indexDict[currentKeyboardLayout.FunctionKeyboard.KeyboardLayoutType]; //키보드 스왑 IKeyboardLayout tmpLayout = currentKeyboardLayout; currentKeyboardLayout = currentKeyboardLayout.FunctionKeyboard; currentKeyboardLayout.FunctionKeyboard = tmpLayout;; //바뀌기 이전 키보드의 언어 및 심볼키 복사 if (currentKeyboardLayout.KeyboardLayoutType == KeyboardLayoutTypes.Function) { currentKeyboardLayout.LanguageKeyboard = tmpLayout.LanguageKeyboard; currentKeyboardLayout.SymbolKeyboard = tmpLayout.SymbolKeyboard; } ((AbstractKeyboardLayout)tmpLayout).Visibility = System.Windows.Visibility.Collapsed; ((AbstractKeyboardLayout)currentKeyboardLayout).Visibility = System.Windows.Visibility.Visible; if (((AbstractKeyboardLayout)currentKeyboardLayout).ActualWidth == 0) { this.UpdateLayout(); } }
void currentKeybdLayout_LanguageKeyCapTap(object sender, Key.KeyCapEventArgs e) { if (currentKeyboardLayout.LanguageKeyboard == null || currentKeyboardLayout.LanguageKeyboard.KeyboardLayoutType == currentKeyboardLayout.KeyboardLayoutType) { //언어가 없거나 하나일때는 버튼처리 무시 return; } int index = indexDict[currentKeyboardLayout.LanguageKeyboard.OriginalKeyboardLayoutType]; //키보드 스왑 IKeyboardLayout tmpLayout = currentKeyboardLayout; currentKeyboardLayout = this.LayoutRoot.Children[index] as IKeyboardLayout; currentKeyboardLayout.SymbolKeyboard = this.LayoutRoot.Children[0] as IKeyboardLayout; currentKeyboardLayout.FunctionKeyboard = this.LayoutRoot.Children[1] as IKeyboardLayout; ((AbstractKeyboardLayout)tmpLayout).Visibility = System.Windows.Visibility.Collapsed; ((AbstractKeyboardLayout)currentKeyboardLayout).Visibility = System.Windows.Visibility.Visible; if (((AbstractKeyboardLayout)currentKeyboardLayout).ActualWidth == 0) { this.UpdateLayout(); } }
private void ActivateLayout(IKeyboardLayout layout) { Popup.IsOpen = false; keyboard.ActivateLayout(layout.Id); }
private void Keyboard_LayoutChanged(IKeyboardLayout layout) { Dispatcher.InvokeAsync(() => SetCurrent(layout)); }
public void LoadKeyboardLayout(List <KeyboardLayoutTypes> keyboardLayoutList) { //현재 키보드 삭제 currentKeyboardLayout = null; //기본 키보드를 제외한 키보드 삭제 if (this.LayoutRoot.Children.Count > 2) { for (int last = this.LayoutRoot.Children.Count - 1; last >= 2; last--) { IKeyboardLayout kbd = this.LayoutRoot.Children[last] as IKeyboardLayout; this.LayoutRoot.Children.RemoveAt(last); this.indexDict.Remove(kbd.OriginalKeyboardLayoutType); } } //새로운 키보드 추가 IKeyboardLayout keybdLayout = null; IKeyboardLayout prevKeybdLayout = null; //bool isDefault = false; KeyboardLayoutTypes keybdLayoutType = KeyboardLayoutTypes.None; foreach (KeyboardLayoutTypes keyboardLayoutType in keyboardLayoutList) { Type type = Type.GetType("Apps.UI.Keyboard.Layout.Language." + keyboardLayoutType.ToString() + "KeyboardLayout"); keybdLayoutType = keyboardLayoutType; if (type == null) { type = Type.GetType("Apps.UI.Keyboard.Layout.Language.EnglishKeyboardLayout"); keybdLayoutType = KeyboardLayoutTypes.English; } keybdLayout = (IKeyboardLayout)Activator.CreateInstance(type); if (keybdLayout != null) { //현재 키보드 설정 if (currentKeyboardLayout == null) { currentKeyboardLayout = keybdLayout; currentKeyboardLayout.SymbolKeyboard = this.LayoutRoot.Children[0] as IKeyboardLayout; currentKeyboardLayout.FunctionKeyboard = this.LayoutRoot.Children[1] as IKeyboardLayout; } else { prevKeybdLayout.LanguageKeyboard = keybdLayout; ((UIElement)keybdLayout).Visibility = System.Windows.Visibility.Collapsed; } //레이아웃에 추가 if (!indexDict.ContainsKey(keyboardLayoutType)) { indexDict.Add(keyboardLayoutType, indexDict.Count); } //원본 키보드 레이아웃값 저장 keybdLayout.OriginalKeyboardLayoutType = keyboardLayoutType; this.LayoutRoot.Children.Add((UIElement)keybdLayout); //이벤트 추가 AddEventHandlers(keybdLayout); //임시 저장 prevKeybdLayout = keybdLayout; } //순환구조 생성 prevKeybdLayout.LanguageKeyboard = currentKeyboardLayout; } //현재 키보드 준비 (IME, 심볼키캡 설정) currentKeyboardLayout.PrepareKeyboardLayout(); }