2017-09-13 08:33:12 +02:00
|
|
|
|
/*
|
2024-03-05 18:37:42 +01:00
|
|
|
|
* Copyright (c) 2024 ETH Zürich, IT Services
|
2017-09-13 08:33:12 +02:00
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-03-12 16:18:27 +01:00
|
|
|
|
using System;
|
2017-09-13 08:33:12 +02:00
|
|
|
|
using System.Windows;
|
2023-03-24 18:18:02 +01:00
|
|
|
|
using System.Windows.Automation;
|
2017-09-13 08:33:12 +02:00
|
|
|
|
using System.Windows.Controls;
|
2019-08-30 15:59:51 +02:00
|
|
|
|
using SafeExamBrowser.SystemComponents.Contracts.Keyboard;
|
2017-09-13 08:33:12 +02:00
|
|
|
|
|
2020-03-16 18:29:06 +01:00
|
|
|
|
namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
|
2017-09-13 08:33:12 +02:00
|
|
|
|
{
|
2020-03-16 18:29:06 +01:00
|
|
|
|
internal partial class KeyboardLayoutButton : UserControl
|
2017-09-13 08:33:12 +02:00
|
|
|
|
{
|
2022-04-26 16:45:53 +02:00
|
|
|
|
private readonly IKeyboardLayout layout;
|
2019-03-12 16:18:27 +01:00
|
|
|
|
|
2020-03-16 18:29:06 +01:00
|
|
|
|
internal bool IsCurrent
|
2017-09-13 08:33:12 +02:00
|
|
|
|
{
|
|
|
|
|
set { IsCurrentTextBlock.Visibility = value ? Visibility.Visible : Visibility.Hidden; }
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-16 18:29:06 +01:00
|
|
|
|
internal Guid LayoutId
|
2019-03-12 16:18:27 +01:00
|
|
|
|
{
|
|
|
|
|
get { return layout.Id; }
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-16 18:29:06 +01:00
|
|
|
|
internal event EventHandler LayoutSelected;
|
2019-08-30 15:59:51 +02:00
|
|
|
|
|
2020-03-16 18:29:06 +01:00
|
|
|
|
internal KeyboardLayoutButton(IKeyboardLayout layout)
|
2017-09-13 08:33:12 +02:00
|
|
|
|
{
|
2019-03-12 16:18:27 +01:00
|
|
|
|
this.layout = layout;
|
|
|
|
|
|
2017-09-13 08:33:12 +02:00
|
|
|
|
InitializeComponent();
|
2019-08-30 15:59:51 +02:00
|
|
|
|
InitializeLayoutButton();
|
2019-03-12 16:18:27 +01:00
|
|
|
|
}
|
2017-09-13 08:33:12 +02:00
|
|
|
|
|
2019-08-30 15:59:51 +02:00
|
|
|
|
private void InitializeLayoutButton()
|
2019-03-12 16:18:27 +01:00
|
|
|
|
{
|
2019-08-30 15:59:51 +02:00
|
|
|
|
Button.Click += (o, args) => LayoutSelected?.Invoke(this, EventArgs.Empty);
|
|
|
|
|
CultureCodeTextBlock.Text = layout.CultureCode;
|
2022-04-26 16:45:53 +02:00
|
|
|
|
CultureNameTextBlock.Text = layout.CultureName;
|
|
|
|
|
LayoutNameTextBlock.Text = layout.LayoutName;
|
2023-03-24 18:18:02 +01:00
|
|
|
|
|
|
|
|
|
AutomationProperties.SetName(Button, layout.CultureName);
|
2017-09-13 08:33:12 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|