public void Add(IKeyboardLayout layout) { Dispatcher.Invoke(() => { var button = new TaskbarKeyboardLayoutButton(layout); button.LayoutSelected += Button_LayoutSelected; button.CultureCode = layout.CultureCode; button.LayoutName = layout.Name; LayoutsStackPanel.Children.Add(button); }); }
private void InitializeLayouts() { foreach (var layout in keyboard.GetLayouts()) { var button = new TaskbarKeyboardLayoutButton(layout); button.LayoutSelected += (o, args) => ActivateLayout(layout); LayoutsStackPanel.Children.Add(button); if (layout.IsCurrent) { SetCurrent(layout); } } }