inital
This commit is contained in:
691
FasdDesktopUi/Pages/SettingsPage/M42SettingsPageView.xaml
Normal file
691
FasdDesktopUi/Pages/SettingsPage/M42SettingsPageView.xaml
Normal file
@@ -0,0 +1,691 @@
|
||||
<settingspagebase:SettingsPageBase
|
||||
xmlns:settingspagebase="clr-namespace:FasdDesktopUi.Pages.SettingsPage"
|
||||
x:Class="FasdDesktopUi.Pages.SettingsPage.M42SettingsPageView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
mc:Ignorable="d"
|
||||
Title="PhoneSettingsPage"
|
||||
ResizeMode="NoResize"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
MinHeight="50"
|
||||
MinWidth="400"
|
||||
ShowInTaskbar="False"
|
||||
Topmost="True"
|
||||
SizeToContent="WidthAndHeight"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
x:Name="M42SettingsWindows"
|
||||
Loaded="M42SettingsWindows_Loaded" Closed="M42SettingsWindows_Closed" IsVisibleChanged="M42SettingsWindows_IsVisibleChanged">
|
||||
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="40" />
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<settingspagebase:SettingsPageBase.Resources>
|
||||
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
<BlurEffect x:Key="BlurEffecStyle" Radius="4" KernelType="Gaussian"/>
|
||||
<Style x:Key="BlurableBorder" TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=M42SettingsWindows, Path=IsMethodBlurred}" Value="True">
|
||||
<Setter Property="Effect" Value="{StaticResource BlurEffecStyle}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="BlurMaskBoarder" TargetType="Border">
|
||||
<Setter Property="Background" Value="{DynamicResource Color.BlurBorder}"/>
|
||||
<Setter Property="Opacity" Value="0.2"/>
|
||||
<Setter Property="CornerRadius" Value="7.5"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="Margin" Value="-10 -5"/>
|
||||
<Setter Property="Visibility" Value="{Binding ElementName=M42SettingsWindows, Path=IsMethodBlurred, Converter={StaticResource BoolToVisibility}}"/>
|
||||
<Setter Property="Grid.RowSpan" Value="999"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="999"/>
|
||||
</Style>
|
||||
<Style x:Key="BlurMaskBoarderAuto" TargetType="Border" BasedOn="{StaticResource BlurableBorder}">
|
||||
<Setter Property="Visibility" Value="{Binding ElementName=M42SettingsWindows, Path=IsMethodAuto, Converter={StaticResource BoolToVisibility}}"/>
|
||||
</Style>
|
||||
<Style x:Key="DefaultText" TargetType="TextBlock">
|
||||
<Setter Property="FontSize"
|
||||
Value="14" />
|
||||
<Setter Property="FontFamily"
|
||||
Value="Calibri" />
|
||||
<Setter Property="FontWeight"
|
||||
Value="Bold" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource FontColor.Menu.Categories}" />
|
||||
<Setter Property="VerticalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="Margin"
|
||||
Value="0 0 0 0" />
|
||||
</Style>
|
||||
<Style x:Key="BlurableText" TargetType="TextBlock" BasedOn="{StaticResource DefaultText}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=M42SettingsWindows, Path=IsMethodAuto}" Value="True">
|
||||
<Setter Property="Effect" Value="{StaticResource BlurEffecStyle}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="BlurableRadioButton" TargetType="RadioButton" BasedOn="{StaticResource RadioButtonStyle}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=M42SettingsWindows, Path=IsMethodAuto}" Value="True">
|
||||
<Setter Property="IsEnabled" Value="False"/>
|
||||
<Setter Property="Effect" Value="{StaticResource BlurEffecStyle}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style TargetType="ico:AdaptableIcon"
|
||||
BasedOn="{StaticResource Menu.MenuBar.PinnedIcon.Pinned}">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource FontColor.Menu.Categories}"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Border}, Path=IsMouseOver}"
|
||||
Value="True">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource FontColor.Menu.Categories.Hover}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</settingspagebase:SettingsPageBase.Resources>
|
||||
|
||||
<Border
|
||||
CornerRadius="10"
|
||||
Background="{DynamicResource BackgroundColor.Menu.Categories}"
|
||||
Padding="10"
|
||||
>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.SystemTray}"
|
||||
x:Name="txtHeader"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
FontSize="18"
|
||||
Margin="15,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Calibri"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource FontColor.SlimPage.WidgetCollection.Header}"
|
||||
Grid.Row="0"
|
||||
Grid.ColumnSpan="3"
|
||||
/>
|
||||
|
||||
<ico:AdaptableIcon x:Name="CloseButton"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{DynamicResource SettingsPage.Close.Icon}"
|
||||
MouseLeftButtonUp="CloseButton_MouseLeftButtonUp"
|
||||
TouchDown="CloseButton_TouchDown"
|
||||
SelectedInternIcon="window_close" Grid.Column="2" Margin="335,0,0,0" />
|
||||
|
||||
<Border Grid.Row="1"
|
||||
CornerRadius="7.5"
|
||||
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
|
||||
Margin="5,5,5,5"
|
||||
Padding="10 5"
|
||||
SizeChanged="borderLogon_SizeChanged"
|
||||
Grid.ColumnSpan="3"
|
||||
>
|
||||
<TextBlock Text="You are not currently logged in to Matrix42 WPM."
|
||||
x:Name="txtCurrentUser"
|
||||
Margin="0,0,0,0"
|
||||
FontStyle="Italic"
|
||||
FontWeight="Normal"
|
||||
Grid.Row="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="2"
|
||||
x:Name="borderLogonActive"
|
||||
CornerRadius="7.5"
|
||||
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
|
||||
Margin="5,5,5,5"
|
||||
Padding="10 5"
|
||||
SizeChanged="borderLogon_SizeChanged"
|
||||
Grid.ColumnSpan="3"
|
||||
>
|
||||
<Grid Grid.IsSharedSizeScope="True">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonActive.Header}"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonActive.No}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="8 0 0 0"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonActive.Always}"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Margin="8 0 0 0"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonActive.Auto}"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Margin="8 0 0 0"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<RadioButton x:Name="radioButtonLogonActiveNo"
|
||||
Style="{DynamicResource RadioButtonStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="4 5" Checked="radioButtonLogonActive_Checked"
|
||||
/>
|
||||
|
||||
<RadioButton x:Name="radioButtonLogonActiveYes"
|
||||
Style="{DynamicResource RadioButtonStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="4 5" Checked="radioButtonLogonActive_Checked"
|
||||
/>
|
||||
<RadioButton x:Name="radioButtonLogonActiveAuto"
|
||||
Style="{DynamicResource RadioButtonStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Margin="4 5" Checked="radioButtonLogonActive_Checked"
|
||||
/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="3"
|
||||
x:Name="borderLogonMethod"
|
||||
CornerRadius="7.5"
|
||||
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
|
||||
Margin="5,5,5,5"
|
||||
Padding="10 5"
|
||||
SizeChanged="borderLogon_SizeChanged" Grid.ColumnSpan="3"
|
||||
Style="{StaticResource BlurableBorder}"
|
||||
IsEnabled="{Binding ElementName=M42SettingsWindows, Path=IsNotMethodBlurred}"
|
||||
>
|
||||
<Grid Grid.IsSharedSizeScope="True">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.AuthenticationMethod}"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
FontWeight="Bold"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<TextBlock x:Name="labelPassthough"
|
||||
Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Passthough}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="8 0 0 0"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Basic}"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Margin="8 0 0 0"
|
||||
Style="{StaticResource BlurableText}"
|
||||
/>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Token}"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Margin="8 0 0 0"
|
||||
Style="{StaticResource BlurableText}"
|
||||
/>
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.WebForm}"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Margin="8 0 0 0"
|
||||
Style="{StaticResource BlurableText}"
|
||||
/>
|
||||
<RadioButton x:Name="radioButtonLogonMethodPassthrough"
|
||||
Style="{DynamicResource RadioButtonStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="4 5"
|
||||
Checked="radioButtonLogonMethod_Checked"
|
||||
/>
|
||||
|
||||
<RadioButton x:Name="radioButtonLogonMethodBasic"
|
||||
Style="{StaticResource BlurableRadioButton}"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="4 5"
|
||||
Checked="radioButtonLogonMethod_Checked"
|
||||
/>
|
||||
|
||||
<RadioButton x:Name="radioButtonLogonMethodToken"
|
||||
Style="{StaticResource BlurableRadioButton}"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Margin="4 5"
|
||||
Checked="radioButtonLogonMethod_Checked"
|
||||
/>
|
||||
<RadioButton x:Name="radioButtonLogonMethodForms"
|
||||
Style="{StaticResource BlurableRadioButton}"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
Margin="4 5"
|
||||
Checked="radioButtonLogonMethod_Checked"
|
||||
/>
|
||||
<Border Style="{StaticResource BlurMaskBoarder}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border x:Name="additionalBlockLogonMethodBasic"
|
||||
Grid.Row="4"
|
||||
CornerRadius="7.5"
|
||||
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
|
||||
Margin="5,5,5,5"
|
||||
Padding="10 5" Grid.ColumnSpan="3"
|
||||
Style="{StaticResource BlurableBorder}"
|
||||
IsEnabled="{Binding ElementName=M42SettingsWindows, Path=IsNotMethodBlurred}"
|
||||
>
|
||||
<Grid Grid.IsSharedSizeScope="True">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Basic.Header}"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
FontWeight="Bold"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Basic.Username}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="4 0 0 0"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Basic.Password}"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="4 0 0 0"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="8 5"
|
||||
CornerRadius="2"
|
||||
BorderThickness="0.5"
|
||||
BorderBrush="Gray"
|
||||
VerticalAlignment="Center"
|
||||
Padding="3 2"
|
||||
>
|
||||
<TextBox
|
||||
x:Name="BasicUserName"
|
||||
BorderThickness="0"
|
||||
BorderBrush="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Text="imagoverum\vvogel"
|
||||
/>
|
||||
</Border>
|
||||
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Margin="8 5"
|
||||
CornerRadius="2"
|
||||
BorderThickness="0.5"
|
||||
BorderBrush="Gray"
|
||||
VerticalAlignment="Center"
|
||||
Height="21"
|
||||
Padding="3 2"
|
||||
>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<PasswordBox Grid.Column="0"
|
||||
x:Name="pwBoxPasswordBasicShow"
|
||||
BorderThickness="0"
|
||||
BorderBrush="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Password="Matrix42"
|
||||
PasswordChanged="pwBoxPasswordBasicShow_PasswordChanged"
|
||||
/>
|
||||
<TextBox Grid.Column="0"
|
||||
x:Name="txtBoxPasswordBasicShow"
|
||||
BorderThickness="0"
|
||||
BorderBrush="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="Collapsed"
|
||||
TextChanged="txtBoxPasswordBasicShow_TextChanged"
|
||||
/>
|
||||
<ico:AdaptableIcon
|
||||
x:Name="iconPasswordBasicShow"
|
||||
Grid.Column="1"
|
||||
SelectedMaterialIcon="ic_visibility"
|
||||
BorderPadding="0"
|
||||
IconWidth="17" IconHeight="17"
|
||||
Tag="PwBasicOn"
|
||||
MouseLeftButtonDown="iconPasswordShow_MouseLeftButtonDown"
|
||||
/>
|
||||
<ico:AdaptableIcon
|
||||
x:Name="iconPasswordBasicHide"
|
||||
Grid.Column="1"
|
||||
SelectedMaterialIcon="ic_visibility_off"
|
||||
Visibility="Collapsed"
|
||||
BorderPadding="0"
|
||||
IconWidth="17" IconHeight="17"
|
||||
Tag="PwBasicOff"
|
||||
MouseLeftButtonDown="iconPasswordShow_MouseLeftButtonDown"
|
||||
/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Style="{StaticResource BlurMaskBoarder}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border x:Name="additionalBlockLogonMethodToken"
|
||||
Grid.Row="5"
|
||||
CornerRadius="7.5"
|
||||
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
|
||||
Margin="5,5,5,5"
|
||||
Padding="10 5" Grid.ColumnSpan="3"
|
||||
Style="{StaticResource BlurableBorder}"
|
||||
IsEnabled="{Binding ElementName=M42SettingsWindows, Path=IsNotMethodBlurred}"
|
||||
>
|
||||
<Grid Grid.IsSharedSizeScope="True">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Token.Header}"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Token.Token}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="4 0 0 0"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="8 5"
|
||||
CornerRadius="2"
|
||||
BorderThickness="0.5"
|
||||
BorderBrush="Gray"
|
||||
VerticalAlignment="Center"
|
||||
Padding="3 2"
|
||||
>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<PasswordBox Grid.Column="0"
|
||||
x:Name="pwBoxPasswordTokenShow"
|
||||
BorderThickness="0"
|
||||
BorderBrush="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0 0 3 0"
|
||||
Password="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1"
|
||||
PasswordChanged="pwBoxPasswordTokenShow_PasswordChanged"
|
||||
/>
|
||||
<TextBox Grid.Column="0"
|
||||
x:Name="txtBoxPasswordTokenShow"
|
||||
BorderThickness="0"
|
||||
BorderBrush="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="Collapsed"
|
||||
Margin="0 0 3 0"
|
||||
TextChanged="pwBoxPasswordTokenHide_TextChanged"
|
||||
/>
|
||||
<ico:AdaptableIcon
|
||||
x:Name="iconTokenShow"
|
||||
Grid.Column="1"
|
||||
SelectedMaterialIcon="ic_visibility"
|
||||
BorderPadding="0"
|
||||
IconWidth="17" IconHeight="17"
|
||||
Tag="TokenOn"
|
||||
MouseLeftButtonDown="iconPasswordShow_MouseLeftButtonDown"
|
||||
/>
|
||||
<ico:AdaptableIcon
|
||||
x:Name="iconTokenHide"
|
||||
Grid.Column="1"
|
||||
SelectedMaterialIcon="ic_visibility_off"
|
||||
Visibility="Collapsed"
|
||||
BorderPadding="0"
|
||||
IconWidth="17" IconHeight="17"
|
||||
Tag="TokenOff"
|
||||
MouseLeftButtonDown="iconPasswordShow_MouseLeftButtonDown"
|
||||
/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Style="{StaticResource BlurMaskBoarder}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border x:Name="additionalBlockLogonMethodForms"
|
||||
Grid.Row="6"
|
||||
CornerRadius="7.5"
|
||||
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
|
||||
Margin="5,5,5,5"
|
||||
Padding="10 5" Grid.ColumnSpan="3"
|
||||
Style="{StaticResource BlurableBorder}"
|
||||
IsEnabled="{Binding ElementName=M42SettingsWindows, Path=IsNotMethodBlurred}"
|
||||
>
|
||||
<Grid Grid.IsSharedSizeScope="True">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Forms.Header}"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="8 5"
|
||||
CornerRadius="2"
|
||||
BorderThickness="0.5"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Height="21"
|
||||
Padding="4 2" MouseLeftButtonDown="DoFormsAuthentication_MouseLeftButtonDown"
|
||||
>
|
||||
<Border.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource Background.Menu.Icon.Hover}" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="Gray" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#FFD8E6FF" />
|
||||
<Setter Property="BorderBrush" Value="#FF5593FF" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.LogonMethod.Forms.Logon}"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="8 0 8 0"
|
||||
IsHitTestVisible="False"
|
||||
Style="{StaticResource DefaultText}"
|
||||
/>
|
||||
</Border>
|
||||
<Border Style="{StaticResource BlurMaskBoarder}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<TextBlock Grid.Row="7" Grid.ColumnSpan="3"
|
||||
x:Name="txtAuthenticationError"
|
||||
Text="Sie konnten nicht angemeldet werden. Bitte ändern Sie ihre Angaben für eine gültige Anmeldung."
|
||||
Grid.Column="0"
|
||||
Margin="10 3 0 3"
|
||||
Foreground="Red"
|
||||
/>
|
||||
|
||||
<Grid Grid.Row="8" Grid.ColumnSpan="3">
|
||||
|
||||
<Grid.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon">
|
||||
<Setter Property="Margin"
|
||||
Value="0 10 0 0" />
|
||||
<Setter Property="IconWidth"
|
||||
Value="125" />
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Menu.Icon}" />
|
||||
<Setter Property="BorderPadding"
|
||||
Value="2.5" />
|
||||
<Setter Property="HorizontalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="Cursor"
|
||||
Value="Hand" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="7*" />
|
||||
<ColumnDefinition Width="31*"/>
|
||||
<ColumnDefinition Width="38*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ico:AdaptableIcon x:Name="ConfirmButton"
|
||||
Grid.Column="0"
|
||||
SelectedMaterialIcon="ic_check" Grid.ColumnSpan="2" HorizontalAlignment="Left" Margin="32,10,0,0" MouseDown="ConfirmButton_MouseDown" TouchDown="ConfirmButton_TouchDown">
|
||||
<ico:AdaptableIcon.Tag>
|
||||
<sys:Boolean>True</sys:Boolean>
|
||||
</ico:AdaptableIcon.Tag>
|
||||
<ico:AdaptableIcon.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon"
|
||||
BasedOn="{StaticResource {x:Type ico:AdaptableIcon}}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Green}" />
|
||||
<Setter Property="IconBackgroundColor"
|
||||
Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ico:AdaptableIcon.Resources>
|
||||
|
||||
</ico:AdaptableIcon>
|
||||
|
||||
<ico:AdaptableIcon x:Name="CancelButton"
|
||||
Grid.Column="2"
|
||||
SelectedMaterialIcon="ic_close" Margin="0,10,0,0" MouseLeftButtonUp="CloseButton_MouseLeftButtonUp" TouchDown="CloseButton_TouchDown">
|
||||
<ico:AdaptableIcon.Tag>
|
||||
<sys:Boolean>False</sys:Boolean>
|
||||
</ico:AdaptableIcon.Tag>
|
||||
<ico:AdaptableIcon.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon"
|
||||
BasedOn="{StaticResource {x:Type ico:AdaptableIcon}}">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Menu.Icon}" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Red}" />
|
||||
<Setter Property="IconBackgroundColor"
|
||||
Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ico:AdaptableIcon.Resources>
|
||||
</ico:AdaptableIcon>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
</settingspagebase:SettingsPageBase>
|
||||
588
FasdDesktopUi/Pages/SettingsPage/M42SettingsPageView.xaml.cs
Normal file
588
FasdDesktopUi/Pages/SettingsPage/M42SettingsPageView.xaml.cs
Normal file
@@ -0,0 +1,588 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
using C4IT.Logging;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using C4IT.MultiLanguage;
|
||||
using C4IT.FASD.Base;
|
||||
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using C4IT.FASD.Cockpit.Communication;
|
||||
using FasdDesktopUi.Basics;
|
||||
using FasdDesktopUi.Pages.M42AuthenticationPage;
|
||||
using FasdDesktopUi.Pages.DetailsPage;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SettingsPage
|
||||
{
|
||||
public partial class M42SettingsPageView : SettingsPageBase
|
||||
{
|
||||
private static M42SettingsPageView _Instance = null;
|
||||
|
||||
public static M42SettingsPageView Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Instance ?? (_Instance = new M42SettingsPageView());
|
||||
}
|
||||
}
|
||||
|
||||
private double borderWidth = double.MaxValue;
|
||||
|
||||
private enumM42AuthenticationMethod authenticationMethod;
|
||||
|
||||
private enumM42AuthenticationControl authenticationControl;
|
||||
|
||||
private bool formsAuthenticated = false;
|
||||
|
||||
private bool IsTemporaryDisabled = false;
|
||||
|
||||
private bool _isMethodBlurred = false;
|
||||
public bool IsNotMethodBlurred
|
||||
{
|
||||
get { return !_isMethodBlurred; }
|
||||
}
|
||||
public bool IsMethodBlurred
|
||||
{
|
||||
get { return _isMethodBlurred; }
|
||||
set
|
||||
{
|
||||
if (value != _isMethodBlurred)
|
||||
{
|
||||
_isMethodBlurred = value;
|
||||
OnPropertyChanged(nameof(IsMethodBlurred));
|
||||
OnPropertyChanged(nameof(IsNotMethodBlurred));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMethodAuto = false;
|
||||
public bool IsNotMethodAuto { get { return !_isMethodAuto; } }
|
||||
public bool IsMethodAuto
|
||||
{
|
||||
get { return _isMethodAuto; }
|
||||
set
|
||||
{
|
||||
if (value != _isMethodAuto)
|
||||
{
|
||||
_isMethodAuto = value;
|
||||
OnPropertyChanged(nameof(IsMethodAuto));
|
||||
OnPropertyChanged(nameof(IsNotMethodAuto));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private M42SettingsPageView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void M42SettingsWindows_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (e.NewValue is bool isVisible)
|
||||
{
|
||||
if (isVisible && !IsTemporaryDisabled)
|
||||
{
|
||||
App.HideAllSettingViews();
|
||||
|
||||
if (this.IsLoaded)
|
||||
InitializeControlValues();
|
||||
}
|
||||
}
|
||||
|
||||
BlurInvoker_IsActiveChanged(sender, e);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
#region DialogButton_Click
|
||||
|
||||
public void DialogButton_Click(object sender)
|
||||
{
|
||||
if (!(sender is FrameworkElement senderElement))
|
||||
return;
|
||||
|
||||
if (!(senderElement.Tag is bool tagValue))
|
||||
return;
|
||||
|
||||
if (tagValue)
|
||||
{
|
||||
}
|
||||
|
||||
Close();
|
||||
|
||||
if (tagValue)
|
||||
{
|
||||
var _h = Dispatcher.Invoke(async () =>
|
||||
{
|
||||
await Task.Delay(300);
|
||||
|
||||
var dialogResult = CustomMessageBox.CustomMessageBox.Show(cMultiLanguageSupport.GetItem("M42Settings.ChangedInfoDialog.Text"), cMultiLanguageSupport.GetItem("M42Settings.RestartDialog.Caption"), enumHealthCardStateLevel.Info, null, true);
|
||||
|
||||
if (dialogResult == true)
|
||||
{
|
||||
System.Windows.Forms.Application.Restart();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CloseButton_Click
|
||||
|
||||
private void CloseButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CloseButton_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private async void M42SettingsWindows_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
try
|
||||
{
|
||||
// initialize the window title
|
||||
var _ServerDisplayName = cCockpitConfiguration.Instance?.m42ServerConfiguration?.DisplayName;
|
||||
if (!string.IsNullOrEmpty(_ServerDisplayName))
|
||||
{
|
||||
var _strTitle = cMultiLanguageSupport.GetItem("M42Settings.Header");
|
||||
_strTitle = string.Format(_strTitle, _ServerDisplayName);
|
||||
txtHeader.Text = _strTitle;
|
||||
}
|
||||
|
||||
// get the current logon user info
|
||||
var _currUserInfo = await cFasdCockpitCommunicationBase.Instance.GetAdditionalUserInfo(enumAdditionalAuthentication.M42WinLogon);
|
||||
if (_currUserInfo != null)
|
||||
{
|
||||
var _txt = cMultiLanguageSupport.GetItem("M42Settings.LogonMethod.CurrentUserValid");
|
||||
var _ci = new CultureInfo(cMultiLanguageSupport.CurrentLanguage);
|
||||
var _dt = _currUserInfo.ValidUntil.ToLocalTime().ToString(_ci);
|
||||
_txt = string.Format(_txt, _currUserInfo.Name, _dt);
|
||||
txtCurrentUser.Text = _txt;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtCurrentUser.Text = cMultiLanguageSupport.GetItem("M42Settings.LogonMethod.CurrentUserInvalid");
|
||||
}
|
||||
|
||||
// get user name for passthrough label
|
||||
string userName;
|
||||
string userAccount;
|
||||
lock (cFasdCockpitCommunicationBase.CockpitUserInfoLock)
|
||||
{
|
||||
userName = cFasdCockpitCommunicationBase.CockpitUserInfo?.Name;
|
||||
userAccount = cFasdCockpitCommunicationBase.CockpitUserInfo?.AdAccount;
|
||||
}
|
||||
string str = null;
|
||||
if (string.IsNullOrEmpty(userName))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(userAccount))
|
||||
str = userAccount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(userAccount))
|
||||
str = userName;
|
||||
else
|
||||
str = $"{userName}({userAccount})";
|
||||
}
|
||||
|
||||
|
||||
if (str != null)
|
||||
{
|
||||
var s = cMultiLanguageSupport.GetItem("M42Settings.LogonMethod.PassthoughUser");
|
||||
str = string.Format(s, str);
|
||||
labelPassthough.Text = str;
|
||||
}
|
||||
|
||||
txtAuthenticationError.Visibility = Visibility.Hidden;
|
||||
|
||||
InitializeControlValues();
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
LogMethodEnd(CM);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void InitializeControlValues()
|
||||
{
|
||||
// set the initial input control values
|
||||
BasicUserName.Text = cFasdCockpitConfig.Instance?.M42Config?.BasicUser ?? "";
|
||||
|
||||
var _pw = PrivateSecurePassword.Instance.Decode(cFasdCockpitConfig.Instance?.M42Config.BasicPassword) ?? "";
|
||||
pwBoxPasswordBasicShow.Password = _pw;
|
||||
|
||||
_pw = PrivateSecurePassword.Instance.Decode(cFasdCockpitConfig.Instance?.M42Config.ApiToken) ?? "";
|
||||
pwBoxPasswordTokenShow.Password = _pw;
|
||||
|
||||
txtBoxPasswordBasicShow.Text = pwBoxPasswordBasicShow?.Password;
|
||||
txtBoxPasswordTokenShow.Text = pwBoxPasswordTokenShow?.Password;
|
||||
|
||||
// set the initial radio button values
|
||||
switch (cFasdCockpitConfig.Instance?.M42Config?.Control)
|
||||
{
|
||||
case enumM42AuthenticationControl.always:
|
||||
radioButtonLogonActiveYes.IsChecked = true;
|
||||
break;
|
||||
case enumM42AuthenticationControl.never:
|
||||
radioButtonLogonActiveNo.IsChecked = true;
|
||||
break;
|
||||
default:
|
||||
radioButtonLogonActiveAuto.IsChecked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
authenticationMethod = cFasdCockpitConfig.Instance?.M42Config?.Method ?? enumM42AuthenticationMethod.passthrough;
|
||||
switch (cFasdCockpitConfig.Instance?.M42Config?.Method)
|
||||
{
|
||||
case enumM42AuthenticationMethod.basic:
|
||||
radioButtonLogonMethodBasic.IsChecked = true;
|
||||
break;
|
||||
case enumM42AuthenticationMethod.token:
|
||||
radioButtonLogonMethodToken.IsChecked = true;
|
||||
break;
|
||||
case enumM42AuthenticationMethod.forms:
|
||||
radioButtonLogonMethodForms.IsChecked = true;
|
||||
break;
|
||||
default:
|
||||
radioButtonLogonMethodPassthrough.IsChecked = true;
|
||||
break;
|
||||
}
|
||||
LogonActiveChanged();
|
||||
}
|
||||
|
||||
private void logonMethodChanged()
|
||||
{
|
||||
if (radioButtonLogonMethodBasic.IsChecked == true)
|
||||
{
|
||||
authenticationMethod = enumM42AuthenticationMethod.basic;
|
||||
additionalBlockLogonMethodBasic.Visibility = Visibility.Visible;
|
||||
additionalBlockLogonMethodToken.Visibility = Visibility.Collapsed;
|
||||
additionalBlockLogonMethodForms.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else if (radioButtonLogonMethodToken.IsChecked == true)
|
||||
{
|
||||
authenticationMethod = enumM42AuthenticationMethod.token;
|
||||
additionalBlockLogonMethodBasic.Visibility = Visibility.Collapsed;
|
||||
additionalBlockLogonMethodToken.Visibility = Visibility.Visible;
|
||||
additionalBlockLogonMethodForms.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else if (radioButtonLogonMethodForms.IsChecked == true)
|
||||
{
|
||||
authenticationMethod = enumM42AuthenticationMethod.forms;
|
||||
additionalBlockLogonMethodBasic.Visibility = Visibility.Collapsed;
|
||||
additionalBlockLogonMethodToken.Visibility = Visibility.Collapsed;
|
||||
additionalBlockLogonMethodForms.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
authenticationMethod = enumM42AuthenticationMethod.passthrough;
|
||||
additionalBlockLogonMethodBasic.Visibility = Visibility.Collapsed;
|
||||
additionalBlockLogonMethodToken.Visibility = Visibility.Collapsed;
|
||||
additionalBlockLogonMethodForms.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
private void radioButtonLogonMethod_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
logonMethodChanged();
|
||||
}
|
||||
|
||||
private void LogonActiveChanged()
|
||||
{
|
||||
if (radioButtonLogonActiveNo.IsChecked == true)
|
||||
{
|
||||
authenticationControl = enumM42AuthenticationControl.never;
|
||||
IsMethodBlurred = true;
|
||||
IsMethodAuto = false;
|
||||
}
|
||||
else if (radioButtonLogonActiveYes.IsChecked == true)
|
||||
{
|
||||
authenticationControl = enumM42AuthenticationControl.always;
|
||||
IsMethodBlurred = false;
|
||||
IsMethodAuto = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
authenticationControl = enumM42AuthenticationControl.auto;
|
||||
IsMethodBlurred = false;
|
||||
IsMethodAuto = true;
|
||||
radioButtonLogonMethodPassthrough.IsChecked = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void radioButtonLogonActive_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LogonActiveChanged();
|
||||
}
|
||||
|
||||
private void borderLogon_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
var _w = e.NewSize.Width;
|
||||
if (_w < borderWidth)
|
||||
{
|
||||
borderWidth = _w;
|
||||
additionalBlockLogonMethodBasic.MaxWidth = _w;
|
||||
additionalBlockLogonMethodForms.MaxWidth = _w;
|
||||
additionalBlockLogonMethodToken.MaxWidth = _w;
|
||||
}
|
||||
}
|
||||
|
||||
private void pwBoxPasswordBasicShow_PasswordChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (txtBoxPasswordBasicShow != null && txtBoxPasswordBasicShow.Visibility != Visibility.Visible)
|
||||
txtBoxPasswordBasicShow.Text = pwBoxPasswordBasicShow?.Password;
|
||||
}
|
||||
|
||||
private void txtBoxPasswordBasicShow_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (pwBoxPasswordBasicShow != null && pwBoxPasswordBasicShow.Visibility != Visibility.Visible)
|
||||
pwBoxPasswordBasicShow.Password = txtBoxPasswordBasicShow?.Text;
|
||||
}
|
||||
|
||||
private void pwBoxPasswordTokenShow_PasswordChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (txtBoxPasswordTokenShow != null && txtBoxPasswordTokenShow.Visibility != Visibility.Visible)
|
||||
txtBoxPasswordTokenShow.Text = pwBoxPasswordTokenShow?.Password;
|
||||
}
|
||||
|
||||
private void pwBoxPasswordTokenHide_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (pwBoxPasswordTokenShow != null && pwBoxPasswordTokenShow.Visibility != Visibility.Visible)
|
||||
pwBoxPasswordTokenShow.Password = txtBoxPasswordBasicShow?.Text;
|
||||
}
|
||||
|
||||
private void iconPasswordShow_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!(sender is FrameworkElement _fr))
|
||||
return;
|
||||
|
||||
switch (_fr.Tag.ToString())
|
||||
{
|
||||
case "PwBasicOn":
|
||||
iconPasswordBasicHide.Visibility = Visibility.Visible;
|
||||
iconPasswordBasicShow.Visibility = Visibility.Collapsed;
|
||||
txtBoxPasswordBasicShow.Visibility = Visibility.Visible;
|
||||
pwBoxPasswordBasicShow.Visibility = Visibility.Collapsed;
|
||||
return;
|
||||
case "PwBasicOff":
|
||||
iconPasswordBasicShow.Visibility = Visibility.Visible;
|
||||
iconPasswordBasicHide.Visibility = Visibility.Collapsed;
|
||||
pwBoxPasswordBasicShow.Visibility = Visibility.Visible;
|
||||
txtBoxPasswordBasicShow.Visibility = Visibility.Collapsed;
|
||||
return;
|
||||
case "TokenOn":
|
||||
iconTokenHide.Visibility = Visibility.Visible;
|
||||
iconTokenShow.Visibility = Visibility.Collapsed;
|
||||
txtBoxPasswordTokenShow.Visibility = Visibility.Visible;
|
||||
pwBoxPasswordTokenShow.Visibility = Visibility.Collapsed;
|
||||
return;
|
||||
case "TokenOff":
|
||||
iconTokenShow.Visibility = Visibility.Visible;
|
||||
iconTokenHide.Visibility = Visibility.Collapsed;
|
||||
pwBoxPasswordTokenShow.Visibility = Visibility.Visible;
|
||||
txtBoxPasswordTokenShow.Visibility = Visibility.Collapsed;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfirmButton_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
ConfirmButton_Click(sender);
|
||||
}
|
||||
|
||||
private void ConfirmButton_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
ConfirmButton_Click(sender);
|
||||
}
|
||||
|
||||
private async void ConfirmButton_Click(object sender)
|
||||
{
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
try
|
||||
{
|
||||
this.IsEnabled = false;
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
|
||||
cFasdCockpitConfig.Instance.M42Config.Control = authenticationControl;
|
||||
cFasdCockpitConfig.Instance.Save("M42Config\\Control");
|
||||
|
||||
if (authenticationControl == enumM42AuthenticationControl.never)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
bool isAuthenticated = false;
|
||||
cF4sdCockpitM42BearerTokenInfo TokenInfo = null;
|
||||
bool HasChanged = false;
|
||||
HasChanged |= authenticationMethod != cFasdCockpitConfig.Instance.M42Config.Method;
|
||||
switch (authenticationMethod)
|
||||
{
|
||||
case enumM42AuthenticationMethod.passthrough:
|
||||
TokenInfo = await cFasdCockpitCommunicationBase.Instance.M42.ValidateLogonPassthrough();
|
||||
if (TokenInfo?.Token != null)
|
||||
isAuthenticated = true;
|
||||
break;
|
||||
case enumM42AuthenticationMethod.basic:
|
||||
var _user = BasicUserName.Text;
|
||||
var _pw = pwBoxPasswordBasicShow.Password;
|
||||
HasChanged |= _user != cFasdCockpitConfig.Instance.M42Config.BasicUser;
|
||||
HasChanged |= PrivateSecurePassword.Instance.Decode(cFasdCockpitConfig.Instance.M42Config.BasicPassword) != _pw;
|
||||
TokenInfo = await cFasdCockpitCommunicationBase.Instance.M42.ValidateLogonBasic(_user, _pw);
|
||||
if (TokenInfo?.Token != null)
|
||||
{
|
||||
isAuthenticated = true;
|
||||
if (HasChanged)
|
||||
{
|
||||
cFasdCockpitConfig.Instance.M42Config.BasicUser = _user;
|
||||
cFasdCockpitConfig.Instance.M42Config.BasicPassword = PrivateSecurePassword.Instance.Encode(_pw);
|
||||
cFasdCockpitConfig.Instance.Save("M42Config\\BasicUser");
|
||||
cFasdCockpitConfig.Instance.Save("M42Config\\BasicPassword");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case enumM42AuthenticationMethod.token:
|
||||
var _token = pwBoxPasswordTokenShow.Password;
|
||||
HasChanged |= PrivateSecurePassword.Instance.Decode(cFasdCockpitConfig.Instance.M42Config.ApiToken) != _token;
|
||||
TokenInfo = await cFasdCockpitCommunicationBase.Instance.M42.ValidateLogonToken(_token);
|
||||
if (TokenInfo?.Token != null)
|
||||
{
|
||||
isAuthenticated = true;
|
||||
if (HasChanged)
|
||||
{
|
||||
cFasdCockpitConfig.Instance.M42Config.ApiToken = PrivateSecurePassword.Instance.Encode(_token);
|
||||
cFasdCockpitConfig.Instance.Save("M42Config\\ApiToken");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case enumM42AuthenticationMethod.forms:
|
||||
if (formsAuthenticated)
|
||||
isAuthenticated = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (isAuthenticated)
|
||||
{
|
||||
cFasdCockpitConfig.Instance.M42Config.Method = authenticationMethod;
|
||||
cFasdCockpitConfig.Instance.Save("M42Config\\Method");
|
||||
|
||||
txtAuthenticationError.Visibility = Visibility.Hidden;
|
||||
if (HasChanged)
|
||||
{
|
||||
var _tsk = Dispatcher.Invoke(async () =>
|
||||
{
|
||||
await Task.Delay(100);
|
||||
|
||||
var dialogResult = CustomMessageBox.CustomMessageBox.Show(cMultiLanguageSupport.GetItem("M42Settings.ChangedInfoDialog.Text"), cMultiLanguageSupport.GetItem("M42Settings.RestartDialog.Caption"), enumHealthCardStateLevel.Info, null, true);
|
||||
|
||||
if (dialogResult == true)
|
||||
{
|
||||
System.Windows.Forms.Application.Restart();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
txtAuthenticationError.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Mouse.OverrideCursor = null; ;
|
||||
this.IsEnabled = true;
|
||||
LogMethodEnd(CM);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void DoFormsAuthentication_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
try
|
||||
{
|
||||
if (cFasdCockpitCommunicationBase.CockpitUserInfo == null)
|
||||
return;
|
||||
|
||||
IsTemporaryDisabled = true;
|
||||
this.IsEnabled = false;
|
||||
|
||||
var logonPage = new F4sdM42FormsAuthentication(Reauthenticate: false);
|
||||
var _ret = logonPage.ShowDialog();
|
||||
logonPage = null;
|
||||
|
||||
if (_ret == true)
|
||||
{
|
||||
formsAuthenticated = true;
|
||||
txtAuthenticationError.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.IsEnabled = true;
|
||||
IsTemporaryDisabled = false;
|
||||
LogMethodEnd(CM);
|
||||
}
|
||||
}
|
||||
|
||||
private void M42SettingsWindows_Closed(object sender, EventArgs e)
|
||||
{
|
||||
_Instance = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
313
FasdDesktopUi/Pages/SettingsPage/PhoneSettingsPage.xaml
Normal file
313
FasdDesktopUi/Pages/SettingsPage/PhoneSettingsPage.xaml
Normal file
@@ -0,0 +1,313 @@
|
||||
<settingspagebase:SettingsPageBase
|
||||
xmlns:settingspagebase="clr-namespace:FasdDesktopUi.Pages.SettingsPage"
|
||||
x:Class="FasdDesktopUi.Pages.PhoneSettingsPage.PhoneSettingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:FasdDesktopUi.Pages.PhoneSettingsPage"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
mc:Ignorable="d"
|
||||
Title="PhoneSettingsPage"
|
||||
ResizeMode="NoResize"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
MinHeight="100"
|
||||
MinWidth="400"
|
||||
ShowInTaskbar="False"
|
||||
Topmost="True"
|
||||
SizeToContent="WidthAndHeight"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
x:Name="PhoneSettingsWindow"
|
||||
Closed="PhoneSettingsWindow_Closed" IsVisibleChanged="PhoneSettingsWindow_IsVisibleChanged"
|
||||
>
|
||||
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="40" />
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<settingspagebase:SettingsPageBase.Resources>
|
||||
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
|
||||
<SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/>
|
||||
<SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA"/>
|
||||
<SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5"/>
|
||||
<Style x:Key="TextBoxStyle1" TargetType="{x:Type TextBox}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="AllowDrop" Value="true"/>
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="10">
|
||||
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" Width="58"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Opacity" TargetName="border" Value="0.56"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.MouseOver.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocused" Value="true">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.Focus.Border}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true"/>
|
||||
<Condition Property="IsSelectionActive" Value="false"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
|
||||
</MultiTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</settingspagebase:SettingsPageBase.Resources>
|
||||
|
||||
<Border CornerRadius="10"
|
||||
Background="{DynamicResource BackgroundColor.Menu.Categories}"
|
||||
Padding="10">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=PhoneSettings.SystemTray}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
FontSize="18"
|
||||
Margin="30 0 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Calibri"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource FontColor.SlimPage.WidgetCollection.Header}" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="CloseButton"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{DynamicResource SettingsPage.Close.Icon}"
|
||||
MouseLeftButtonUp="CloseButton_MouseLeftButtonUp"
|
||||
TouchDown="CloseButton_TouchDown"
|
||||
SelectedInternIcon="window_close" />
|
||||
|
||||
<Border Grid.Row="1"
|
||||
CornerRadius="7.5"
|
||||
Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
|
||||
Margin="5"
|
||||
Padding="10 5">
|
||||
<Grid Grid.IsSharedSizeScope="True">
|
||||
<Grid.Resources>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Margin"
|
||||
Value="0, 0, 20, 0" />
|
||||
<Setter Property="FontSize"
|
||||
Value="14" />
|
||||
<Setter Property="FontFamily"
|
||||
Value="Calibri" />
|
||||
<Setter Property="FontWeight"
|
||||
Value="Bold" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource FontColor.Menu.Categories}" />
|
||||
<Setter Property="VerticalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="Margin"
|
||||
Value="0 7.5 15 7.5" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
<RowDefinition SharedSizeGroup="RowsHeight" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=PhoneSettings.PhoneSupport.Disable}"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0" />
|
||||
<CheckBox x:Name="PhoneSupportCheck"
|
||||
Style="{DynamicResource ToggleSwitch}"
|
||||
IsChecked="{Binding ElementName=PhoneSettingsWindow, Path=IsPhoneSupportDisabled}"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0 7.5" />
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=PhoneSettings.SwyxIt.PreferNative}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0" />
|
||||
<CheckBox x:Name="SwyxNativeCheck"
|
||||
IsChecked="{Binding ElementName=PhoneSettingsWindow, Path=IsNativeSwyxItPreferred}"
|
||||
Style="{DynamicResource ToggleSwitch}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0 7.5"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=PhoneSettings.Tapi.PreferredLine}"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0" />
|
||||
|
||||
<ComboBox x:Name="PreferredTapiLineComboBox"
|
||||
MinWidth="150"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
Margin="0 5" />
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=PhoneSettings.Tapi.BitMode32}"
|
||||
Grid.Row="3"
|
||||
Grid.Column="0" />
|
||||
<CheckBox x:Name="UseTapi32BitCheck"
|
||||
IsChecked="{Binding ElementName=PhoneSettingsWindow, Path=UseTapi32Bit}"
|
||||
Style="{DynamicResource ToggleSwitch}"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0 7.5"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=PhoneSettings.Tapi.SignalOutgoingCalls}"
|
||||
Grid.Row="4"
|
||||
Grid.Column="0" />
|
||||
<CheckBox x:Name="SignalOutgoingCalls"
|
||||
IsChecked="{Binding ElementName=PhoneSettingsWindow, Path=boolSignalOutgoingCalls}"
|
||||
Style="{DynamicResource ToggleSwitch}"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0 7.5"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=PhoneSettings.Tapi.ShowUnresolvedPhoneNumbers}"
|
||||
Grid.Row="5"
|
||||
Grid.Column="0" />
|
||||
<CheckBox x:Name="ShowUnresolvedPhoneNumbers"
|
||||
IsChecked="{Binding ElementName=PhoneSettingsWindow, Path=boolShowUnresolvedPhoneNumbers}"
|
||||
Style="{DynamicResource ToggleSwitch}"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0 7.5"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=PhoneSettings.Tapi.ExternalCallPrefix}"
|
||||
Grid.Row="6"
|
||||
Grid.Column="0" />
|
||||
<TextBox x:Name="ExternalCallPrefix"
|
||||
Grid.Row="6" Grid.Column="1"
|
||||
Style="{DynamicResource TextBoxStyle1}"
|
||||
Text="{Binding ElementName=PhoneSettingsWindow, Path=strExternalCallPrefix, Mode=TwoWay}"
|
||||
MaxLength="4"
|
||||
FontSize="14"
|
||||
Width="60"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0 5"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
|
||||
<Grid.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon">
|
||||
<Setter Property="Margin"
|
||||
Value="0 10 0 0" />
|
||||
<Setter Property="IconWidth"
|
||||
Value="125" />
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Menu.Icon}" />
|
||||
<Setter Property="BorderPadding"
|
||||
Value="2.5" />
|
||||
<Setter Property="HorizontalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="Cursor"
|
||||
Value="Hand" />
|
||||
|
||||
<EventSetter Event="MouseLeftButtonUp"
|
||||
Handler="DialogButton_MouseLeftButtonUp" />
|
||||
<EventSetter Event="TouchDown"
|
||||
Handler="DialogButton_TouchDown" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ico:AdaptableIcon x:Name="ConfirmButton"
|
||||
Grid.Column="0"
|
||||
SelectedMaterialIcon="ic_check">
|
||||
<ico:AdaptableIcon.Tag>
|
||||
<sys:Boolean>True</sys:Boolean>
|
||||
</ico:AdaptableIcon.Tag>
|
||||
<ico:AdaptableIcon.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon"
|
||||
BasedOn="{StaticResource {x:Type ico:AdaptableIcon}}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Green}" />
|
||||
<Setter Property="IconBackgroundColor"
|
||||
Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ico:AdaptableIcon.Resources>
|
||||
|
||||
</ico:AdaptableIcon>
|
||||
|
||||
<ico:AdaptableIcon x:Name="CancelButton"
|
||||
Grid.Column="1"
|
||||
SelectedMaterialIcon="ic_close">
|
||||
<ico:AdaptableIcon.Tag>
|
||||
<sys:Boolean>False</sys:Boolean>
|
||||
</ico:AdaptableIcon.Tag>
|
||||
<ico:AdaptableIcon.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon"
|
||||
BasedOn="{StaticResource {x:Type ico:AdaptableIcon}}">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Menu.Icon}" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Red}" />
|
||||
<Setter Property="IconBackgroundColor"
|
||||
Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ico:AdaptableIcon.Resources>
|
||||
</ico:AdaptableIcon>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
</settingspagebase:SettingsPageBase>
|
||||
348
FasdDesktopUi/Pages/SettingsPage/PhoneSettingsPage.xaml.cs
Normal file
348
FasdDesktopUi/Pages/SettingsPage/PhoneSettingsPage.xaml.cs
Normal file
@@ -0,0 +1,348 @@
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.Logging;
|
||||
using C4IT.MultiLanguage;
|
||||
using C4IT.F4SD.TAPI;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Pages.CustomMessageBox;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using FasdDesktopUi.Pages.SettingsPage;
|
||||
|
||||
namespace FasdDesktopUi.Pages.PhoneSettingsPage
|
||||
{
|
||||
public partial class PhoneSettingsPage : SettingsPageBase
|
||||
{
|
||||
#region Properties
|
||||
|
||||
private static PhoneSettingsPage _Instance = null;
|
||||
|
||||
public static PhoneSettingsPage Instance { get
|
||||
{
|
||||
return _Instance ?? (_Instance = new PhoneSettingsPage());
|
||||
}
|
||||
}
|
||||
|
||||
#region IsPhoneSupportDisabled
|
||||
private bool _IsPhoneSupportDisabled = false;
|
||||
|
||||
public bool IsPhoneSupportDisabled
|
||||
{
|
||||
get { return _IsPhoneSupportDisabled; }
|
||||
set
|
||||
{
|
||||
if (_IsPhoneSupportDisabled != value)
|
||||
{
|
||||
_IsPhoneSupportDisabled = value;
|
||||
OnPropertyChanged(nameof(IsPhoneSupportDisabled));
|
||||
UpdateEnableStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IsNativeSwyxItPreferred
|
||||
private bool _IsNativeSwyxItPreferred = false;
|
||||
|
||||
public bool IsNativeSwyxItPreferred
|
||||
{
|
||||
get { return _IsNativeSwyxItPreferred; }
|
||||
set
|
||||
{
|
||||
if (_IsNativeSwyxItPreferred != value)
|
||||
{
|
||||
_IsNativeSwyxItPreferred = value;
|
||||
OnPropertyChanged(nameof(IsNativeSwyxItPreferred));
|
||||
UpdateEnableStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsBitMode32
|
||||
private bool _UseTapi32Bit = false;
|
||||
|
||||
public bool UseTapi32Bit
|
||||
{
|
||||
get { return _UseTapi32Bit; }
|
||||
set
|
||||
{
|
||||
if (_UseTapi32Bit != value)
|
||||
{
|
||||
_UseTapi32Bit = value;
|
||||
OnPropertyChanged(nameof(UseTapi32Bit));
|
||||
UpdateEnableStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SignalOutgoingCalls
|
||||
private bool _boolSignalOutgoingCalls = false;
|
||||
|
||||
public bool boolSignalOutgoingCalls
|
||||
{
|
||||
get { return _boolSignalOutgoingCalls; }
|
||||
set
|
||||
{
|
||||
if (_boolSignalOutgoingCalls != value)
|
||||
{
|
||||
_boolSignalOutgoingCalls = value;
|
||||
OnPropertyChanged(nameof(boolSignalOutgoingCalls));
|
||||
UpdateEnableStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ShowUnresolvedPhoneNumbers
|
||||
private bool _boolShowUnresolvedPhoneNumbers = false;
|
||||
|
||||
public bool boolShowUnresolvedPhoneNumbers
|
||||
{
|
||||
get { return _boolShowUnresolvedPhoneNumbers; }
|
||||
set
|
||||
{
|
||||
if (_boolShowUnresolvedPhoneNumbers != value)
|
||||
{
|
||||
_boolShowUnresolvedPhoneNumbers = value;
|
||||
OnPropertyChanged(nameof(boolShowUnresolvedPhoneNumbers));
|
||||
UpdateEnableStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ExternalCallPrefix
|
||||
private string _strExternalCallPrefix = string.Empty;
|
||||
|
||||
public string strExternalCallPrefix
|
||||
{
|
||||
get { return _strExternalCallPrefix; }
|
||||
set
|
||||
{
|
||||
if (_strExternalCallPrefix != value)
|
||||
{
|
||||
_strExternalCallPrefix = value;
|
||||
OnPropertyChanged(nameof(strExternalCallPrefix));
|
||||
UpdateEnableStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
private PhoneSettingsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnInitialized(EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
IsPhoneSupportDisabled = cFasdCockpitConfig.Instance.PhoneSupport.DisablePhoneSupport;
|
||||
IsNativeSwyxItPreferred = cFasdCockpitConfig.Instance.PhoneSupport.PreferSwyxitNative;
|
||||
UseTapi32Bit = cFasdCockpitConfig.Instance.PhoneSupport.UseTapi32Bit;
|
||||
boolSignalOutgoingCalls = cFasdCockpitConfig.Instance.PhoneSupport.SignalOutgoingCalls;
|
||||
strExternalCallPrefix = cFasdCockpitConfig.Instance.PhoneSupport.ExternalCallPrefix;
|
||||
boolShowUnresolvedPhoneNumbers = cFasdCockpitConfig.Instance.PhoneSupport.ShowUnresolvedPhoneNumbers;
|
||||
|
||||
UpdateTapiLines();
|
||||
UpdateEnableStatus();
|
||||
|
||||
base.OnInitialized(e);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void PhoneSettingsWindow_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
UpdateEnableStatus();
|
||||
BlurInvoker_IsActiveChanged(sender, e);
|
||||
}
|
||||
|
||||
private void UpdateTapiLines()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (PreferredTapiLineComboBox.Items?.Count > 0)
|
||||
return;
|
||||
|
||||
var tapiLines = C4TapiHelper.Lines;
|
||||
|
||||
if (tapiLines?.Count > 0)
|
||||
{
|
||||
foreach (var line in tapiLines)
|
||||
{
|
||||
var comboBoxItem = new ComboBoxItem() { Content = line };
|
||||
|
||||
if (tapiLines?.First() == line && tapiLines?.Last() == line)
|
||||
comboBoxItem.SetResourceReference(StyleProperty, "ComboBoxSingleItem");
|
||||
else if (tapiLines?.First() == line)
|
||||
comboBoxItem.SetResourceReference(StyleProperty, "ComboBoxFirstItem");
|
||||
else if (tapiLines?.Last() == line)
|
||||
comboBoxItem.SetResourceReference(StyleProperty, "ComboBoxLastItem");
|
||||
|
||||
PreferredTapiLineComboBox.Items.Add(comboBoxItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PreferredTapiLineComboBox.IsEnabled = false;
|
||||
}
|
||||
|
||||
var currentLineIndex = tapiLines.IndexOf(cFasdCockpitConfig.Instance.PhoneSupport.PreferedTapiLine);
|
||||
PreferredTapiLineComboBox.SelectedIndex = currentLineIndex;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateEnableStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
UpdateTapiLines();
|
||||
|
||||
SwyxNativeCheck.ClearValue(ToolTipProperty);
|
||||
UseTapi32BitCheck.ClearValue(ToolTipProperty);
|
||||
PreferredTapiLineComboBox.ClearValue(ToolTipProperty);
|
||||
|
||||
|
||||
SwyxNativeCheck.IsEnabled = true;
|
||||
|
||||
PreferredTapiLineComboBox.IsEnabled = !IsNativeSwyxItPreferred;
|
||||
|
||||
if (IsNativeSwyxItPreferred)
|
||||
PreferredTapiLineComboBox.ToolTip = cMultiLanguageSupport.GetItem("PhoneSettings.Tapi.Disabled.SwyxItNativeEnabled");
|
||||
|
||||
if (IsPhoneSupportDisabled)
|
||||
{
|
||||
SwyxNativeCheck.IsEnabled = false;
|
||||
SwyxNativeCheck.ToolTip = cMultiLanguageSupport.GetItem("PhoneSettings.Tapi.Disabled.PhoneSupportDisabled");
|
||||
|
||||
UseTapi32BitCheck.IsEnabled = false;
|
||||
PreferredTapiLineComboBox.IsEnabled = false;
|
||||
PreferredTapiLineComboBox.ToolTip = cMultiLanguageSupport.GetItem("PhoneSettings.Tapi.Disabled.PhoneSupportDisabled");
|
||||
UseTapi32BitCheck.ToolTip = cMultiLanguageSupport.GetItem("PhoneSettings.Tapi.Disabled.PhoneSupportDisabled");
|
||||
}
|
||||
|
||||
if (C4TapiHelper.Lines?.Count <= 0)
|
||||
{
|
||||
UseTapi32BitCheck.IsEnabled = false;
|
||||
PreferredTapiLineComboBox.IsEnabled = false;
|
||||
PreferredTapiLineComboBox.ToolTip = cMultiLanguageSupport.GetItem("PhoneSettings.Tapi.Disabled.NoLine");
|
||||
UseTapi32BitCheck.ToolTip = cMultiLanguageSupport.GetItem("PhoneSettings.Tapi.Disabled.NoLine");
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
#region DialogButton_Click
|
||||
|
||||
public void DialogButton_Click(object sender)
|
||||
{
|
||||
if (!(sender is FrameworkElement senderElement))
|
||||
return;
|
||||
|
||||
if (!(senderElement.Tag is bool tagValue))
|
||||
return;
|
||||
|
||||
if (tagValue)
|
||||
{
|
||||
cFasdCockpitConfig.Instance.PhoneSupport.DisablePhoneSupport = IsPhoneSupportDisabled;
|
||||
cFasdCockpitConfig.Instance.PhoneSupport.PreferSwyxitNative = IsNativeSwyxItPreferred;
|
||||
cFasdCockpitConfig.Instance.PhoneSupport.UseTapi32Bit = UseTapi32Bit;
|
||||
cFasdCockpitConfig.Instance.PhoneSupport.SignalOutgoingCalls = boolSignalOutgoingCalls;
|
||||
cFasdCockpitConfig.Instance.PhoneSupport.ExternalCallPrefix = ExternalCallPrefix.Text;
|
||||
cFasdCockpitConfig.Instance.PhoneSupport.ShowUnresolvedPhoneNumbers = boolShowUnresolvedPhoneNumbers;
|
||||
|
||||
if (PreferredTapiLineComboBox.SelectedItem is ComboBoxItem selectedItem)
|
||||
cFasdCockpitConfig.Instance.PhoneSupport.PreferedTapiLine = selectedItem.Content?.ToString();
|
||||
|
||||
cFasdCockpitConfig.Instance.Save("PhoneSupport\\DisablePhoneSupport");
|
||||
cFasdCockpitConfig.Instance.Save("PhoneSupport\\PreferSwyxitNative");
|
||||
cFasdCockpitConfig.Instance.Save("PhoneSupport\\UseTapi32Bit");
|
||||
cFasdCockpitConfig.Instance.Save("PhoneSupport\\PreferedTapiLine");
|
||||
cFasdCockpitConfig.Instance.Save("PhoneSupport\\SignalOutgoingCalls");
|
||||
cFasdCockpitConfig.Instance.Save("PhoneSupport\\ExternalCallPrefix");
|
||||
cFasdCockpitConfig.Instance.Save("PhoneSupport\\ShowUnresolvedPhoneNumbers");
|
||||
}
|
||||
|
||||
Close();
|
||||
|
||||
if (tagValue)
|
||||
{
|
||||
var _h = Dispatcher.Invoke(async () =>
|
||||
{
|
||||
await Task.Delay(300);
|
||||
|
||||
var dialogResult = CustomMessageBox.CustomMessageBox.Show(cMultiLanguageSupport.GetItem("PhoneSettings.RestartDialog.Text"), cMultiLanguageSupport.GetItem("PhoneSettings.RestartDialog.Caption"), enumHealthCardStateLevel.Info, null, true);
|
||||
|
||||
if (dialogResult == true)
|
||||
{
|
||||
System.Windows.Forms.Application.Restart();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void DialogButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
DialogButton_Click(sender);
|
||||
}
|
||||
|
||||
private void DialogButton_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
DialogButton_Click(sender);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CloseButton_Click
|
||||
|
||||
private void CloseButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CloseButton_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void PhoneSettingsWindow_Closed(object sender, EventArgs e)
|
||||
{
|
||||
_Instance = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
15
FasdDesktopUi/Pages/SettingsPage/SettingsPageBase.cs
Normal file
15
FasdDesktopUi/Pages/SettingsPage/SettingsPageBase.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SettingsPage
|
||||
{
|
||||
public class SettingsPageBase : CustomPopupBase, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string name = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
475
FasdDesktopUi/Pages/SettingsPage/SettingsPageView.xaml
Normal file
475
FasdDesktopUi/Pages/SettingsPage/SettingsPageView.xaml
Normal file
@@ -0,0 +1,475 @@
|
||||
<settingspagebase:SettingsPageBase
|
||||
xmlns:settingspagebase="clr-namespace:FasdDesktopUi.Pages.SettingsPage"
|
||||
x:Class="FasdDesktopUi.Pages.SettingsPage.SettingsPageView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:FasdDesktopUi.Pages.SettingsPage"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
mc:Ignorable="d"
|
||||
Title="SettingsPageView"
|
||||
ResizeMode="NoResize"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
MinHeight="100"
|
||||
MinWidth="400"
|
||||
ShowInTaskbar="False"
|
||||
Topmost="True"
|
||||
SizeToContent="WidthAndHeight"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Initialized="Window_Initialized"
|
||||
x:Name="SettingsWindow"
|
||||
KeyDown="SettingsWindow_KeyDown" Closed="SettingsWindow_Closed" IsVisibleChanged="SettingsWindow_IsVisibleChanged">
|
||||
|
||||
<settingspagebase:SettingsPageBase.Resources>
|
||||
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
|
||||
<Style TargetType="ico:AdaptableIcon"
|
||||
x:Key="ApplyButton"
|
||||
BasedOn="{StaticResource SettingsPage.Close.Icon}">
|
||||
<Setter Property="Margin"
|
||||
Value="0 -7.5" />
|
||||
<Setter Property="IconHeight"
|
||||
Value="22.5" />
|
||||
<Setter Property="BorderPadding"
|
||||
Value="0 0 0 5" />
|
||||
<Setter Property="Visibility"
|
||||
Value="Collapsed" />
|
||||
<EventSetter Event="MouseLeftButtonUp"
|
||||
Handler="ApplyZoomButton_MouseLeftButtonUp" />
|
||||
<EventSetter Event="TouchDown"
|
||||
Handler="ApplyZoomButton_TouchDown" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Green}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</settingspagebase:SettingsPageBase.Resources>
|
||||
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="40" />
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<Border CornerRadius="10"
|
||||
Background="{DynamicResource BackgroundColor.Menu.Categories}"
|
||||
Padding="10">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ico:AdaptableIcon x:Name="CloseButton"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{DynamicResource SettingsPage.Close.Icon}"
|
||||
MouseLeftButtonUp="CloseButton_MouseUp"
|
||||
TouchDown="CloseButton_TouchDown"
|
||||
SelectedInternIcon="window_close" />
|
||||
|
||||
<StackPanel Grid.Row="1">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="CornerRadius"
|
||||
Value="7.5" />
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
|
||||
<Setter Property="Margin"
|
||||
Value="5" />
|
||||
<Setter Property="Padding"
|
||||
Value="10,5" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Margin"
|
||||
Value="0, 0, 20, 0" />
|
||||
<Setter Property="FontSize"
|
||||
Value="14" />
|
||||
<Setter Property="FontFamily"
|
||||
Value="Calibri" />
|
||||
<Setter Property="FontWeight"
|
||||
Value="Bold" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource FontColor.Menu.Categories}" />
|
||||
<Setter Property="VerticalAlignment"
|
||||
Value="Center" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Settings.Global}" />
|
||||
<Border>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Settings.Global.ColorTheme}" />
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon">
|
||||
<Setter Property="BorderPadding"
|
||||
Value="0" />
|
||||
<Setter Property="Margin"
|
||||
Value="0, 5, 10, 0" />
|
||||
<Setter Property="Cursor"
|
||||
Value="Hand" />
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Menu.Icon}" />
|
||||
<Setter Property="IconHeight"
|
||||
Value="20" />
|
||||
<Setter Property="IconWidth"
|
||||
Value="20" />
|
||||
|
||||
<EventSetter Event="MouseUp"
|
||||
Handler="ColorModeIcon_MouseUp" />
|
||||
<EventSetter Event="TouchDown"
|
||||
Handler="ColorModeIcon_TouchDown" />
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Menu.Icon.Hover}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<ico:AdaptableIcon x:Name="LightModeIcon"
|
||||
Tag="LightMode"
|
||||
IconHeight="25"
|
||||
IconWidth="25"
|
||||
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Settings.Global.ColorTheme.LightMode}"
|
||||
SelectedInternIcon="style_sunFilled" />
|
||||
|
||||
<ico:AdaptableIcon x:Name="DarkModeIcon"
|
||||
Tag="DarkMode"
|
||||
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Settings.Global.ColorTheme.DarkMode}"
|
||||
SelectedInternIcon="style_moonFilled" />
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Menu.SelectLanguage}" />
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon">
|
||||
<Setter Property="Margin"
|
||||
Value="5 0" />
|
||||
<Setter Property="Cursor"
|
||||
Value="Hand" />
|
||||
<Setter Property="IconBackgroundColor"
|
||||
Value="{DynamicResource Color.Menu.Icon}" />
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Menu.Icon}" />
|
||||
<Setter Property="BorderPadding"
|
||||
Value="2.5" />
|
||||
<Setter Property="IconHeight"
|
||||
Value="22.5" />
|
||||
<Setter Property="IconWidth"
|
||||
Value="22.5" />
|
||||
<EventSetter Event="MouseLeftButtonUp"
|
||||
Handler="Flag_MouseLeftButtonUp" />
|
||||
<EventSetter Event="TouchDown"
|
||||
Handler="Flag_TouchDown" />
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="PrimaryIconColor"
|
||||
Value="{DynamicResource Color.Menu.Icon.Hover}" />
|
||||
<Setter Property="IconBackgroundColor"
|
||||
Value="{DynamicResource Color.Menu.Icon.Hover}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<ico:AdaptableIcon IconBackgroundColor="Transparent"
|
||||
IconWidth="30"
|
||||
IconHeight="30"
|
||||
Margin="-2.5 0 5 0"
|
||||
SelectedMaterialIcon="ic_language" />
|
||||
|
||||
<ico:AdaptableIcon Tag="DE"
|
||||
SelectedCountryCode="DE" />
|
||||
|
||||
<ico:AdaptableIcon Tag="US"
|
||||
SelectedCountryCode="GB" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="ShouldSkipSlimViewLabel" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Menu.ShouldSkipSlimView}" />
|
||||
<ico:AdaptableIcon x:Name="ShouldSkipSlimViewPolicy" SelectedInternIcon="lock_closed" Margin="-25,-5,0,0" IconWidth="23" IconHeight="23" Visibility="Collapsed"/>
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox x:Name="ShouldSkipSlimViewCheckBox"
|
||||
Style="{DynamicResource ToggleSwitch}"
|
||||
IsChecked="{Binding ElementName=SettingsWindow, Path=ShouldSkipSlimView}"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,3,0,10"
|
||||
>
|
||||
</CheckBox>
|
||||
|
||||
<StackPanel x:Name="PositionOfSmallViewsLabel" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Menu.PositionOfSmallViews}" />
|
||||
<ico:AdaptableIcon x:Name="PositionOfSmallViewsPolicy" SelectedInternIcon="lock_closed" Margin="-25,-5,0,0" IconWidth="23" IconHeight="23" Visibility="Collapsed"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid x:Name="PositionOfSmallViewsInput" Grid.IsSharedSizeScope="True"
|
||||
HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="Label" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="Label" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock x:Name="SmallViewLeftTextBlock"
|
||||
Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.Direction.Left}"
|
||||
Grid.Column="0"
|
||||
FontWeight="Regular"
|
||||
Cursor="Hand"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="2.5 -0 2.5 0"
|
||||
Tag="0"
|
||||
TouchDown="SmallViewTextBlock_TouchDown"
|
||||
MouseLeftButtonUp="SmallViewTextBlock_MouseLeftButtonUp" />
|
||||
|
||||
<Border Grid.Column="1"
|
||||
Padding="5 0">
|
||||
<Slider x:Name="SmallViewPositionSlider"
|
||||
Minimum="0"
|
||||
Maximum="2"
|
||||
MinWidth="75"
|
||||
IsSnapToTickEnabled="True"
|
||||
Ticks="0 2"
|
||||
TickPlacement="TopLeft"
|
||||
TickFrequency="2"
|
||||
Value="{Binding ElementName=SettingsWindow, Path=PositionOfSmallViews}" />
|
||||
|
||||
</Border>
|
||||
|
||||
<TextBlock x:Name="SmallViewRightTextBlock"
|
||||
Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.Direction.Right}"
|
||||
Grid.Column="2"
|
||||
FontWeight="Regular"
|
||||
Cursor="Hand"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="2.5 -0 2.5 0"
|
||||
Tag="2"
|
||||
TouchDown="SmallViewTextBlock_TouchDown"
|
||||
MouseLeftButtonUp="SmallViewTextBlock_MouseLeftButtonUp" />
|
||||
|
||||
</Grid>
|
||||
|
||||
<StackPanel x:Name="PositionOfFavouriteBarLabel" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Menu.PositionOfFavouriteBar}" />
|
||||
<ico:AdaptableIcon x:Name="PositionOfFavouriteBarPolicy" SelectedInternIcon="lock_closed" Margin="-25,-5,0,0" IconWidth="23" IconHeight="23" Visibility="Collapsed"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid x:Name="PositionOfFavouriteBarInput" Grid.IsSharedSizeScope="True"
|
||||
HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="Label" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="Label" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock x:Name="FavouritePositionLeftTextBlock"
|
||||
Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.Direction.Left}"
|
||||
Grid.Column="0"
|
||||
FontWeight="Regular"
|
||||
Cursor="Hand"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="2.5 -0 2.5 0"
|
||||
Tag="0"
|
||||
TouchDown="FavouritePositionTextBlock_TouchDown"
|
||||
MouseLeftButtonUp="FavouritePositionTextBlock_MouseLeftButtonUp" />
|
||||
|
||||
<Border Grid.Column="1"
|
||||
Padding="5 0">
|
||||
<Slider x:Name="FavouritePositionSlider"
|
||||
Minimum="0"
|
||||
Maximum="2"
|
||||
MinWidth="75"
|
||||
IsSnapToTickEnabled="True"
|
||||
Ticks="0 1 2"
|
||||
TickPlacement="TopLeft"
|
||||
TickFrequency="1"
|
||||
Value="{Binding ElementName=SettingsWindow, Path=PositionOfFavouriteBar}" />
|
||||
|
||||
</Border>
|
||||
|
||||
<TextBlock x:Name="FavouritePositionRightTextBlock"
|
||||
Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.Direction.Right}"
|
||||
Grid.Column="2"
|
||||
FontWeight="Regular"
|
||||
Cursor="Hand"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="2.5 -0 2.5 0"
|
||||
Tag="2"
|
||||
TouchDown="FavouritePositionTextBlock_TouchDown"
|
||||
MouseLeftButtonUp="FavouritePositionTextBlock_MouseLeftButtonUp" />
|
||||
|
||||
</Grid>
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<StackPanel x:Name="SlimPageSection"
|
||||
Visibility="{Binding ElementName=SettingsWindow, Path=IsSlimPageVisibile, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Settings.SlimPage}" />
|
||||
<Border>
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Settings.ZoomFactor}" />
|
||||
<TextBox x:Name="SlimPageScaleValueTextBox"
|
||||
Tag="SlimPageZoom"
|
||||
Text="{Binding ElementName=SettingsWindow, Path=ZoomSlimPageInPercent, Mode=TwoWay, UpdateSourceTrigger=LostFocus, TargetNullValue={x:Static sys:String.Empty}}"
|
||||
Foreground="{DynamicResource FontColor.DetailsPage.DataHistory.Value}"
|
||||
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.TitleColumn}"
|
||||
BorderBrush="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
|
||||
Width="28"
|
||||
TextChanged="ScaleValueTextBox_TextChanged">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="CornerRadius"
|
||||
Value="2.5" />
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
|
||||
<ico:AdaptableIcon x:Name="ApplySlimPageZoomButton"
|
||||
Style="{DynamicResource ApplyButton}"
|
||||
Tag="SlimPageZoom"
|
||||
SelectedInternIcon="misc_check" />
|
||||
</StackPanel>
|
||||
|
||||
<Slider x:Name="SizeSliderSlimPage"
|
||||
Orientation="Horizontal"
|
||||
Minimum="50"
|
||||
Maximum="250"
|
||||
Value="{Binding ElementName=SettingsWindow, Path=ZoomSlimPageInPercent, Mode=TwoWay}"
|
||||
Margin="0,3"
|
||||
TickFrequency="1" />
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="DetailsPageSection"
|
||||
Visibility="{Binding ElementName=SettingsWindow, Path=IsDetailsPageVisibile, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Settings.DetailPage}" />
|
||||
<Border>
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Settings.ZoomFactor}" />
|
||||
<TextBox x:Name="ScaleValueTextBox"
|
||||
Tag="DetailsPageZoom"
|
||||
Text="{Binding ElementName=SettingsWindow, Path=ZoomDetailsPageInPecent, Mode=TwoWay, UpdateSourceTrigger=LostFocus, TargetNullValue={x:Static sys:String.Empty}}"
|
||||
Foreground="{DynamicResource FontColor.DetailsPage.DataHistory.Value}"
|
||||
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.TitleColumn}"
|
||||
BorderBrush="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
|
||||
Width="28"
|
||||
TextChanged="ScaleValueTextBox_TextChanged">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="CornerRadius"
|
||||
Value="2.5" />
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
|
||||
<ico:AdaptableIcon x:Name="ApplyDetailsPageZoomButton"
|
||||
Style="{DynamicResource ApplyButton}"
|
||||
Tag="DetailsPageZoom"
|
||||
SelectedInternIcon="misc_check" />
|
||||
</StackPanel>
|
||||
|
||||
<Slider x:Name="SizeSlider"
|
||||
Orientation="Horizontal"
|
||||
Minimum="50"
|
||||
Maximum="250"
|
||||
Value="{Binding ElementName=SettingsWindow, Path=ZoomDetailsPageInPecent, Mode=TwoWay}"
|
||||
Margin="0,3"
|
||||
TickFrequency="1" />
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Settings.DetailPage.HighlightColors}" />
|
||||
|
||||
<StackPanel x:Name="HighlightColorStack"
|
||||
Orientation="Horizontal"
|
||||
Margin="-5,0,0,0">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Cursor"
|
||||
Value="Hand" />
|
||||
<Setter Property="CornerRadius"
|
||||
Value="5" />
|
||||
<Setter Property="Height"
|
||||
Value="25" />
|
||||
<Setter Property="Width"
|
||||
Value="25" />
|
||||
<Setter Property="Margin"
|
||||
Value="5" />
|
||||
<Setter Property="BorderThickness"
|
||||
Value="2.5" />
|
||||
|
||||
<EventSetter Event="MouseEnter"
|
||||
Handler="HightlightColorBorder_MouseEnter" />
|
||||
<EventSetter Event="MouseLeave"
|
||||
Handler="HightlightColorBorder_MouseLeave" />
|
||||
<EventSetter Event="MouseUp"
|
||||
Handler="HighlightColorBorder_MouseUp" />
|
||||
<EventSetter Event="TouchDown"
|
||||
Handler="HighlightColorBorder_TouchDown" />
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="Height"
|
||||
Value="30" />
|
||||
<Setter Property="Width"
|
||||
Value="30" />
|
||||
<Setter Property="Margin"
|
||||
Value="2.5" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<Border x:Name="HighlightBlue"
|
||||
Background="{DynamicResource Color.Blue}"
|
||||
BorderBrush="{DynamicResource Color.Menu.Icon}"
|
||||
Tag="Blue" />
|
||||
<Border x:Name="HighlightGreen"
|
||||
Background="{DynamicResource Color.Green}"
|
||||
BorderBrush="{DynamicResource Color.Menu.Icon}"
|
||||
Tag="Green" />
|
||||
<Border x:Name="HighlightOrange"
|
||||
Background="{DynamicResource Color.Orange}"
|
||||
BorderBrush="{DynamicResource Color.Menu.Icon}"
|
||||
Tag="Orange" />
|
||||
<Border x:Name="HighlightRed"
|
||||
Background="{DynamicResource Color.Red}"
|
||||
BorderBrush="{DynamicResource Color.Menu.Icon}"
|
||||
Tag="Red" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</settingspagebase:SettingsPageBase>
|
||||
886
FasdDesktopUi/Pages/SettingsPage/SettingsPageView.xaml.cs
Normal file
886
FasdDesktopUi/Pages/SettingsPage/SettingsPageView.xaml.cs
Normal file
@@ -0,0 +1,886 @@
|
||||
using C4IT.MultiLanguage;
|
||||
using C4IT.FASD.Base;
|
||||
using FasdDesktopUi.Basics.Enums;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Basics.UserControls.AdaptableIcon;
|
||||
using FasdDesktopUi.Pages.DetailsPage;
|
||||
using FasdDesktopUi.Pages.SlimPage;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using System.Reflection;
|
||||
using C4IT.Logging;
|
||||
using System.Windows.Navigation;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
using FasdDesktopUi.Basics;
|
||||
using System.Diagnostics;
|
||||
using C4IT.Configuration;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SettingsPage
|
||||
{
|
||||
public partial class SettingsPageView : SettingsPageBase
|
||||
{
|
||||
#region Properties
|
||||
|
||||
private static SettingsPageView _Instance = null;
|
||||
public static SettingsPageView Instance { get
|
||||
{
|
||||
return _Instance ?? (_Instance = new SettingsPageView());
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<enumHighlightColor, bool> highlightColorActivationStatus;
|
||||
|
||||
#region ZoomInPercent
|
||||
|
||||
public int ZoomDetailsPageInPecent
|
||||
{
|
||||
get { return cFasdCockpitConfig.Instance.DetailsPageZoom; }
|
||||
set
|
||||
{
|
||||
if (value < 50)
|
||||
value = 50;
|
||||
else if (value > 250)
|
||||
value = 250;
|
||||
|
||||
cFasdCockpitConfig.Instance.SetDetailsPageZoom(value);
|
||||
OnPropertyChanged(nameof(ZoomDetailsPageInPecent));
|
||||
}
|
||||
}
|
||||
public int ZoomSlimPageInPercent
|
||||
{
|
||||
get { return cFasdCockpitConfig.Instance.SlimPageZoom; }
|
||||
set
|
||||
{
|
||||
if (value < 50)
|
||||
value = 50;
|
||||
else if (value > 250)
|
||||
value = 250;
|
||||
|
||||
cFasdCockpitConfig.Instance.SetSlimPageZoom(value);
|
||||
OnPropertyChanged(nameof(ZoomSlimPageInPercent));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SlimPageVisibility
|
||||
|
||||
public bool IsSlimPageVisibile
|
||||
{
|
||||
get
|
||||
{
|
||||
return cSupportCaseDataProvider.slimPage?.Visibility == Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsDetailsPageVisible
|
||||
|
||||
public bool IsDetailsPageVisibile
|
||||
{
|
||||
get
|
||||
{
|
||||
return cSupportCaseDataProvider.detailsPage?.Visibility == Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public int PositionOfSmallViews
|
||||
{
|
||||
get {
|
||||
return cF4sdGlobalConfig.ConvertHorizontalAlignmentToPosition(cFasdCockpitConfig.Instance.Global.SmallViewAlignment, 0);
|
||||
}
|
||||
set
|
||||
{
|
||||
var _algn = cF4sdGlobalConfig.ConvertPositionToHorizontalAlignment(value, enumF4sdHorizontalAlignment.Right);
|
||||
UpdatePositionOfSmallViewTextBlock(value);
|
||||
if (_algn != cFasdCockpitConfig.Instance.Global.SmallViewAlignment)
|
||||
{
|
||||
cFasdCockpitConfig.Instance.Global.SmallViewAlignment = _algn;
|
||||
cFasdCockpitConfig.Instance.Global.Save("SmallViewAlignment");
|
||||
cFasdCockpitConfig.Instance.OnUiSettingsChanged();
|
||||
}
|
||||
OnPropertyChanged(nameof(PositionOfSmallViews));
|
||||
}
|
||||
}
|
||||
|
||||
public int PositionOfFavouriteBar
|
||||
{
|
||||
get
|
||||
{
|
||||
return cF4sdGlobalConfig.ConvertHorizontalAlignmentToPosition(cFasdCockpitConfig.Instance.Global.FavouriteBarAlignment, 0);
|
||||
}
|
||||
set
|
||||
{
|
||||
var _algn = cF4sdGlobalConfig.ConvertPositionToHorizontalAlignment(value, enumF4sdHorizontalAlignment.Right);
|
||||
UpdatePositionOfFavouriteBarTextBlock(value);
|
||||
if (cFasdCockpitConfig.Instance.Global.FavouriteBarAlignment != _algn)
|
||||
{
|
||||
cFasdCockpitConfig.Instance.Global.FavouriteBarAlignment = _algn;
|
||||
cFasdCockpitConfig.Instance.Global.Save("FavouriteBarAlignment");
|
||||
cFasdCockpitConfig.Instance.OnUiSettingsChanged();
|
||||
}
|
||||
OnPropertyChanged(nameof(PositionOfFavouriteBar));
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShouldSkipSlimView
|
||||
{
|
||||
get => cFasdCockpitConfig.Instance.Global.ShouldSkipSlimView;
|
||||
set
|
||||
{
|
||||
cFasdCockpitConfig.Instance.Global.ShouldSkipSlimView = value;
|
||||
cFasdCockpitConfig.Instance.Global.Save("ShouldSkipSlimView");
|
||||
OnPropertyChanged(nameof(ShouldSkipSlimView));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static SettingsPageView Create()
|
||||
{
|
||||
if (Instance == null)
|
||||
return new SettingsPageView();
|
||||
return Instance;
|
||||
}
|
||||
|
||||
private SettingsPageView()
|
||||
{
|
||||
InitializeComponent();
|
||||
UpdatePositionOfSmallViewTextBlock(PositionOfSmallViews);
|
||||
UpdatePositionOfFavouriteBarTextBlock(PositionOfFavouriteBar);
|
||||
cFasdCockpitConfig.Instance.UiSettingsChanged += CockpitConfig_UiSettingsChanged;
|
||||
}
|
||||
|
||||
private void UpdatePositionOfFavouriteBarTextBlock(int positionIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
FavouritePositionSlider.ClearValue(BackgroundProperty);
|
||||
|
||||
switch (positionIndex)
|
||||
{
|
||||
case 1:
|
||||
FavouritePositionLeftTextBlock.ClearValue(ForegroundProperty);
|
||||
FavouritePositionRightTextBlock.ClearValue(ForegroundProperty);
|
||||
FavouritePositionSlider.SetResourceReference(BackgroundProperty, "Color.FunctionMarker");
|
||||
break;
|
||||
case 2:
|
||||
FavouritePositionRightTextBlock.SetResourceReference(ForegroundProperty, "Color.FunctionMarker");
|
||||
FavouritePositionLeftTextBlock.ClearValue(ForegroundProperty);
|
||||
break;
|
||||
default:
|
||||
FavouritePositionLeftTextBlock.SetResourceReference(ForegroundProperty, "Color.FunctionMarker");
|
||||
FavouritePositionRightTextBlock.ClearValue(ForegroundProperty);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdatePositionOfSmallViewTextBlock(int positionIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
switch (positionIndex)
|
||||
{
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
SmallViewRightTextBlock.SetResourceReference(ForegroundProperty, "Color.FunctionMarker");
|
||||
SmallViewLeftTextBlock.ClearValue(ForegroundProperty);
|
||||
break;
|
||||
default:
|
||||
SmallViewLeftTextBlock.SetResourceReference(ForegroundProperty, "Color.FunctionMarker");
|
||||
SmallViewRightTextBlock.ClearValue(ForegroundProperty);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void CockpitConfig_UiSettingsChanged(object sender, EventArgs e)
|
||||
{
|
||||
ZoomDetailsPageInPecent = cFasdCockpitConfig.Instance.DetailsPageZoom;
|
||||
ZoomSlimPageInPercent = cFasdCockpitConfig.Instance.SlimPageZoom;
|
||||
|
||||
// hide or deactivate ShouldSkipSlimView options due to the policies
|
||||
var _policy = cFasdCockpitConfig.Instance.Global.GetPropertyPolicy("ShouldSkipSlimView");
|
||||
if (_policy == enumConfigPolicy.Hidden)
|
||||
{
|
||||
ShouldSkipSlimViewLabel.Visibility = Visibility.Collapsed;
|
||||
ShouldSkipSlimViewCheckBox.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
ShouldSkipSlimViewLabel.Visibility = Visibility.Visible;
|
||||
ShouldSkipSlimViewCheckBox.Visibility = Visibility.Visible;
|
||||
}
|
||||
if (_policy == enumConfigPolicy.Default)
|
||||
{
|
||||
ShouldSkipSlimViewCheckBox.IsEnabled = true;
|
||||
ShouldSkipSlimViewPolicy.Visibility = Visibility.Collapsed;
|
||||
ShouldSkipSlimViewCheckBox.ToolTip = null;
|
||||
ShouldSkipSlimViewPolicy.ToolTip = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
ShouldSkipSlimViewCheckBox.IsEnabled = false;
|
||||
ShouldSkipSlimViewPolicy.Visibility = Visibility.Visible;
|
||||
ShouldSkipSlimViewCheckBox.ToolTip = cMultiLanguageSupport.GetItem("Settings.Global.PolicyTooltip");
|
||||
ShouldSkipSlimViewPolicy.ToolTip = cMultiLanguageSupport.GetItem("Settings.Global.PolicyTooltip");
|
||||
}
|
||||
OnPropertyChanged(nameof(ShouldSkipSlimView));
|
||||
|
||||
// hide or deactivate SmallViewAlignment options due to the policies
|
||||
_policy = cFasdCockpitConfig.Instance.Global.GetPropertyPolicy("SmallViewAlignment");
|
||||
if (_policy == enumConfigPolicy.Hidden)
|
||||
{
|
||||
PositionOfSmallViewsLabel.Visibility = Visibility.Collapsed;
|
||||
PositionOfSmallViewsInput.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
PositionOfSmallViewsLabel.Visibility = Visibility.Visible;
|
||||
PositionOfSmallViewsInput.Visibility = Visibility.Visible;
|
||||
}
|
||||
if (_policy == enumConfigPolicy.Default)
|
||||
{
|
||||
PositionOfSmallViewsInput.IsEnabled = true;
|
||||
PositionOfSmallViewsPolicy.Visibility = Visibility.Collapsed;
|
||||
PositionOfSmallViewsPolicy.ToolTip = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
PositionOfSmallViewsInput.IsEnabled = false;
|
||||
PositionOfSmallViewsPolicy.Visibility = Visibility.Visible;
|
||||
PositionOfSmallViewsPolicy.ToolTip = cMultiLanguageSupport.GetItem("Settings.Global.PolicyTooltip");
|
||||
}
|
||||
OnPropertyChanged(nameof(PositionOfSmallViews));
|
||||
|
||||
// hide or deactivate FavouriteBarAlignment options due to the policies
|
||||
_policy = cFasdCockpitConfig.Instance.Global.GetPropertyPolicy("FavouriteBarAlignment");
|
||||
if (_policy == enumConfigPolicy.Hidden)
|
||||
{
|
||||
PositionOfFavouriteBarLabel.Visibility = Visibility.Collapsed;
|
||||
PositionOfFavouriteBarInput.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
PositionOfFavouriteBarLabel.Visibility = Visibility.Visible;
|
||||
PositionOfFavouriteBarInput.Visibility = Visibility.Visible;
|
||||
}
|
||||
if (_policy == enumConfigPolicy.Default)
|
||||
{
|
||||
PositionOfFavouriteBarInput.IsEnabled = true;
|
||||
PositionOfFavouriteBarPolicy.Visibility = Visibility.Collapsed;
|
||||
PositionOfFavouriteBarPolicy.ToolTip = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
PositionOfFavouriteBarInput.IsEnabled = false;
|
||||
PositionOfFavouriteBarPolicy.Visibility = Visibility.Visible;
|
||||
PositionOfFavouriteBarPolicy.ToolTip = cMultiLanguageSupport.GetItem("Settings.Global.PolicyTooltip");
|
||||
}
|
||||
OnPropertyChanged(nameof(PositionOfFavouriteBar));
|
||||
|
||||
}
|
||||
|
||||
public void SetUpSettingsControls()
|
||||
{
|
||||
try
|
||||
{
|
||||
enumAppColorMode selectedAppColorMode = cFasdCockpitConfig.Instance.DetailsPageColorMode;
|
||||
SelectAppColorMode(selectedAppColorMode);
|
||||
|
||||
foreach (Border highlightBorder in HighlightColorStack.Children)
|
||||
{
|
||||
HighlightColorBorder_Click(highlightBorder);
|
||||
HighlightColorBorder_Click(highlightBorder);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
#region Window Events
|
||||
|
||||
private void Window_Initialized(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
highlightColorActivationStatus = !string.IsNullOrEmpty(cFasdCockpitConfig.Instance.HighlightColorVisibility) ?
|
||||
JsonConvert.DeserializeObject<Dictionary<enumHighlightColor, bool>>(cFasdCockpitConfig.Instance.HighlightColorVisibility) :
|
||||
new Dictionary<enumHighlightColor, bool>()
|
||||
{
|
||||
{ enumHighlightColor.blue, true},
|
||||
{ enumHighlightColor.green, true},
|
||||
{ enumHighlightColor.orange, true},
|
||||
{ enumHighlightColor.red, true}
|
||||
};
|
||||
|
||||
if (DesignerProperties.GetIsInDesignMode(this))
|
||||
return;
|
||||
|
||||
SetUpSettingsControls();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private async void SettingsWindow_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
OnPropertyChanged(nameof(IsSlimPageVisibile));
|
||||
OnPropertyChanged(nameof(IsDetailsPageVisibile));
|
||||
|
||||
BlurInvoker_IsActiveChanged(sender, e);
|
||||
|
||||
if (e.NewValue is bool b && b is false)
|
||||
if (cSupportCaseDataProvider.detailsPage?.Visibility == Visibility.Visible)
|
||||
await cSupportCaseDataProvider.detailsPage.AdjustWindowSizeAsync();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CloseButton
|
||||
|
||||
private void CloseButton_Click()
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void CloseButton_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
CloseButton_Click();
|
||||
}
|
||||
|
||||
private void CloseButton_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
CloseButton_Click();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetLanguage
|
||||
|
||||
private void Flag_Click(object sender)
|
||||
{
|
||||
if (!(sender is FrameworkElement FE))
|
||||
return;
|
||||
|
||||
var NewLanguage = FE.Tag?.ToString();
|
||||
var OldLanguage = cMultiLanguageSupport.CurrentLanguage;
|
||||
|
||||
|
||||
cMultiLanguageSupport.CurrentLanguage = NewLanguage;
|
||||
|
||||
cFasdCockpitConfig.Instance.SelectedLanguage = NewLanguage;
|
||||
cFasdCockpitConfig.Instance.Save("SelectedLanguage");
|
||||
|
||||
if (OldLanguage == NewLanguage)
|
||||
return;
|
||||
|
||||
var dialogResult = CustomMessageBox.CustomMessageBox.Show(cMultiLanguageSupport.GetItem("Menu.SelectLanguage.RestartDialog.Text"), cMultiLanguageSupport.GetItem("Menu.SelectLanguage.RestartDialog.Caption"), enumHealthCardStateLevel.Info, null, true);
|
||||
|
||||
if (dialogResult == true)
|
||||
{
|
||||
System.Windows.Forms.Application.Restart();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private void Flag_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Flag_Click(sender);
|
||||
}
|
||||
|
||||
private void Flag_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
Flag_Click(sender);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SelectColorMode
|
||||
|
||||
private void SelectAppColorMode(enumAppColorMode appColorMode)
|
||||
{
|
||||
try
|
||||
{
|
||||
string src = "";
|
||||
|
||||
switch (appColorMode)
|
||||
{
|
||||
case enumAppColorMode.DarkMode:
|
||||
LightModeIcon.SelectedInternIcon = enumInternIcons.style_sun;
|
||||
LightModeIcon.ClearValue(AdaptableIcon.PrimaryIconColorProperty);
|
||||
DarkModeIcon.SelectedInternIcon = enumInternIcons.style_moonFilled;
|
||||
DarkModeIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Menu.Icon.Hover");
|
||||
|
||||
src = @"ResourceDictionaries\DarkModeResources.xaml";
|
||||
break;
|
||||
case enumAppColorMode.LightMode:
|
||||
LightModeIcon.SelectedInternIcon = enumInternIcons.style_sunFilled;
|
||||
LightModeIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Menu.Icon.Hover");
|
||||
DarkModeIcon.SelectedInternIcon = enumInternIcons.style_moon;
|
||||
DarkModeIcon.ClearValue(AdaptableIcon.PrimaryIconColorProperty);
|
||||
|
||||
src = @"ResourceDictionaries\LightModeResources.xaml";
|
||||
break;
|
||||
default:
|
||||
LightModeIcon.SelectedInternIcon = enumInternIcons.style_sunFilled;
|
||||
DarkModeIcon.SelectedInternIcon = enumInternIcons.style_moon;
|
||||
LightModeIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Menu.Icon.Hover");
|
||||
break;
|
||||
}
|
||||
|
||||
cFasdCockpitConfig.Instance.DetailsPageColorMode = appColorMode;
|
||||
cFasdCockpitConfig.Instance.Save("DetailsPageColorMode");
|
||||
|
||||
Application.Current.Resources.MergedDictionaries.Insert(0, new ResourceDictionary { Source = new Uri(src, UriKind.Relative) });
|
||||
Application.Current.Resources.MergedDictionaries.Remove(Application.Current.Resources.MergedDictionaries[1]);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorModeIcon_Click(object sender)
|
||||
{
|
||||
try
|
||||
{
|
||||
string senderTag = (sender as FrameworkElement).Tag.ToString().ToLower();
|
||||
|
||||
switch (senderTag)
|
||||
{
|
||||
case "darkmode":
|
||||
SelectAppColorMode(enumAppColorMode.DarkMode);
|
||||
break;
|
||||
case "lightmode":
|
||||
SelectAppColorMode(enumAppColorMode.LightMode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorModeIcon_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
ColorModeIcon_Click(sender);
|
||||
}
|
||||
|
||||
private void ColorModeIcon_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
ColorModeIcon_Click(sender);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SelectHighlightColor
|
||||
|
||||
private void SetHighlightColor(enumHighlightColor selectedColor, bool isActive)
|
||||
{
|
||||
try
|
||||
{
|
||||
Border selectedBorder = new Border();
|
||||
string colorReference = "";
|
||||
|
||||
switch (selectedColor)
|
||||
{
|
||||
case enumHighlightColor.blue:
|
||||
selectedBorder = HighlightBlue;
|
||||
colorReference = "Color.Blue";
|
||||
break;
|
||||
case enumHighlightColor.green:
|
||||
selectedBorder = HighlightGreen;
|
||||
colorReference = "Color.Green";
|
||||
break;
|
||||
case enumHighlightColor.orange:
|
||||
selectedBorder = HighlightOrange;
|
||||
colorReference = "Color.Orange";
|
||||
break;
|
||||
case enumHighlightColor.red:
|
||||
selectedBorder = HighlightRed;
|
||||
colorReference = "Color.Red";
|
||||
break;
|
||||
}
|
||||
|
||||
selectedBorder.ClearValue(BorderBrushProperty);
|
||||
|
||||
if (isActive)
|
||||
{
|
||||
selectedBorder.SetResourceReference(BorderBrushProperty, "Color.Menu.Icon");
|
||||
selectedBorder.SetResourceReference(BackgroundProperty, colorReference);
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedBorder.SetResourceReference(BorderBrushProperty, colorReference);
|
||||
selectedBorder.Background = Brushes.Transparent;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void HightlightColorBorder_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string tagValue = (sender as FrameworkElement).Tag.ToString().ToLower();
|
||||
|
||||
switch (tagValue)
|
||||
{
|
||||
case "blue":
|
||||
SetHighlightColor(enumHighlightColor.blue, !highlightColorActivationStatus[enumHighlightColor.blue]);
|
||||
break;
|
||||
case "green":
|
||||
SetHighlightColor(enumHighlightColor.green, !highlightColorActivationStatus[enumHighlightColor.green]);
|
||||
break;
|
||||
case "orange":
|
||||
SetHighlightColor(enumHighlightColor.orange, !highlightColorActivationStatus[enumHighlightColor.orange]);
|
||||
break;
|
||||
case "red":
|
||||
SetHighlightColor(enumHighlightColor.red, !highlightColorActivationStatus[enumHighlightColor.red]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void HightlightColorBorder_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string tagValue = (sender as FrameworkElement).Tag.ToString().ToLower();
|
||||
|
||||
switch (tagValue)
|
||||
{
|
||||
case "blue":
|
||||
SetHighlightColor(enumHighlightColor.blue, highlightColorActivationStatus[enumHighlightColor.blue]);
|
||||
break;
|
||||
case "green":
|
||||
SetHighlightColor(enumHighlightColor.green, highlightColorActivationStatus[enumHighlightColor.green]);
|
||||
break;
|
||||
case "orange":
|
||||
SetHighlightColor(enumHighlightColor.orange, highlightColorActivationStatus[enumHighlightColor.orange]);
|
||||
break;
|
||||
case "red":
|
||||
SetHighlightColor(enumHighlightColor.red, highlightColorActivationStatus[enumHighlightColor.red]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void HighlightColorBorder_Click(object sender)
|
||||
{
|
||||
try
|
||||
{
|
||||
enumHighlightColor clickedHighlightColor = enumHighlightColor.none;
|
||||
|
||||
switch ((sender as Border).Tag.ToString().ToLower())
|
||||
{
|
||||
case "blue":
|
||||
clickedHighlightColor = enumHighlightColor.blue;
|
||||
if (highlightColorActivationStatus[clickedHighlightColor])
|
||||
Application.Current.Resources["HighlightColor.Blue"] = FindResource("Transparent.Custom");
|
||||
else
|
||||
Application.Current.Resources["HighlightColor.Blue"] = FindResource("Color.Blue");
|
||||
break;
|
||||
case "green":
|
||||
clickedHighlightColor = enumHighlightColor.green;
|
||||
if (highlightColorActivationStatus[clickedHighlightColor])
|
||||
Application.Current.Resources["HighlightColor.Green"] = FindResource("Transparent.Custom");
|
||||
else
|
||||
Application.Current.Resources["HighlightColor.Green"] = FindResource("Color.Green");
|
||||
break;
|
||||
case "orange":
|
||||
clickedHighlightColor = enumHighlightColor.orange;
|
||||
if (highlightColorActivationStatus[clickedHighlightColor])
|
||||
Application.Current.Resources["HighlightColor.Orange"] = FindResource("Transparent.Custom");
|
||||
else
|
||||
Application.Current.Resources["HighlightColor.Orange"] = FindResource("Color.Orange");
|
||||
break;
|
||||
case "red":
|
||||
clickedHighlightColor = enumHighlightColor.red;
|
||||
if (highlightColorActivationStatus[clickedHighlightColor])
|
||||
Application.Current.Resources["HighlightColor.Red"] = FindResource("Transparent.Custom");
|
||||
else
|
||||
Application.Current.Resources["HighlightColor.Red"] = FindResource("Color.Red");
|
||||
break;
|
||||
}
|
||||
|
||||
highlightColorActivationStatus[clickedHighlightColor] = !highlightColorActivationStatus[clickedHighlightColor];
|
||||
|
||||
string jsonText = JsonConvert.SerializeObject(highlightColorActivationStatus, Formatting.Indented);
|
||||
cFasdCockpitConfig.Instance.HighlightColorVisibility = jsonText;
|
||||
cFasdCockpitConfig.Instance.Save("HighlightColorVisibility");
|
||||
|
||||
SetHighlightColor(clickedHighlightColor, highlightColorActivationStatus[clickedHighlightColor]);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void HighlightColorBorder_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
HighlightColorBorder_Click(sender);
|
||||
}
|
||||
|
||||
private void HighlightColorBorder_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
HighlightColorBorder_Click(sender);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SmallViewTextBlockClick
|
||||
|
||||
private void SmallViewTextBlock_Click(object sender)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sender is FrameworkElement senderElement)
|
||||
if (int.TryParse(senderElement.Tag.ToString(), out int positionIndex))
|
||||
PositionOfSmallViews = positionIndex;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void SmallViewTextBlock_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
SmallViewTextBlock_Click(sender);
|
||||
}
|
||||
|
||||
private void SmallViewTextBlock_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
SmallViewTextBlock_Click(sender);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FavouritePositionTextBlock_Click
|
||||
|
||||
private void FavouritePositionTextBlock_Click(object sender)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sender is FrameworkElement senderElement)
|
||||
if (int.TryParse(senderElement.Tag.ToString(), out int positionIndex))
|
||||
PositionOfFavouriteBar = positionIndex;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void FavouritePositionTextBlock_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
FavouritePositionTextBlock_Click(sender);
|
||||
}
|
||||
|
||||
private void FavouritePositionTextBlock_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
FavouritePositionTextBlock_Click(sender);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyZoomButton_Click
|
||||
|
||||
private void ScaleValueTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(sender is FrameworkElement senderElement))
|
||||
return;
|
||||
|
||||
if (!senderElement.IsFocused)
|
||||
return;
|
||||
|
||||
UpdateApplyButtonVisibility();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateApplyButtonVisibility()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ApplySlimPageZoomButton != null)
|
||||
{
|
||||
bool isSlimPageButtonVisible = false;
|
||||
if (int.TryParse(SlimPageScaleValueTextBox.Text, out var slimPageZoom))
|
||||
if (slimPageZoom >= 50 && slimPageZoom <= 250)
|
||||
isSlimPageButtonVisible = slimPageZoom != ZoomSlimPageInPercent;
|
||||
|
||||
ApplySlimPageZoomButton.Visibility = isSlimPageButtonVisible ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
||||
if (ApplyDetailsPageZoomButton != null)
|
||||
{
|
||||
bool isDetailsPageButtonVisible = false;
|
||||
if (int.TryParse(ScaleValueTextBox.Text, out var detailsPageZoom))
|
||||
if (detailsPageZoom >= 50 && detailsPageZoom <= 250)
|
||||
isDetailsPageButtonVisible = detailsPageZoom != ZoomDetailsPageInPecent;
|
||||
|
||||
ApplyDetailsPageZoomButton.Visibility = isDetailsPageButtonVisible ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyZoomButton_Click(object sender)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(sender is FrameworkElement senderElement))
|
||||
return;
|
||||
|
||||
switch (senderElement.Tag)
|
||||
{
|
||||
case "SlimPageZoom":
|
||||
if (int.TryParse(SlimPageScaleValueTextBox.Text, out var slimPageZoom))
|
||||
ZoomSlimPageInPercent = slimPageZoom;
|
||||
break;
|
||||
case "DetailsPageZoom":
|
||||
if (int.TryParse(ScaleValueTextBox.Text, out var detailsPageZoom))
|
||||
ZoomDetailsPageInPecent = detailsPageZoom;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateApplyButtonVisibility();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyZoomButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
ApplyZoomButton_Click(sender);
|
||||
}
|
||||
|
||||
private void ApplyZoomButton_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
ApplyZoomButton_Click(sender);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void SettingsWindow_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
if (int.TryParse(ScaleValueTextBox.Text, out var detailsPageZoom))
|
||||
ZoomDetailsPageInPecent = detailsPageZoom;
|
||||
|
||||
if (int.TryParse(SlimPageScaleValueTextBox.Text, out var slimPageZoom))
|
||||
ZoomSlimPageInPercent = slimPageZoom;
|
||||
|
||||
UpdateApplyButtonVisibility();
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private async void SettingsWindow_Closed(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_Instance = null;
|
||||
if (cSupportCaseDataProvider.detailsPage?.Visibility == Visibility.Visible)
|
||||
await cSupportCaseDataProvider.detailsPage.AdjustWindowSizeAsync();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
102
FasdDesktopUi/Pages/SettingsPage/ShortCutPageView.xaml
Normal file
102
FasdDesktopUi/Pages/SettingsPage/ShortCutPageView.xaml
Normal file
@@ -0,0 +1,102 @@
|
||||
<settingspagebase:SettingsPageBase
|
||||
xmlns:settingspagebase="clr-namespace:FasdDesktopUi.Pages.SettingsPage"
|
||||
x:Class="FasdDesktopUi.Pages.ShortCutPage.ShortCutPageView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:FasdDesktopUi.Pages.ShortCutPage"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
mc:Ignorable="d"
|
||||
Title="ShortCutPageView"
|
||||
IsVisibleChanged="BlurInvoker_IsActiveChanged"
|
||||
ResizeMode="NoResize"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
MinHeight="100"
|
||||
MinWidth="400"
|
||||
ShowInTaskbar="False"
|
||||
Topmost="True"
|
||||
SizeToContent="WidthAndHeight"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
UseLayoutRounding="True">
|
||||
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="40" />
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<Border CornerRadius="10"
|
||||
Background="{DynamicResource BackgroundColor.Menu.Categories}"
|
||||
Padding="10"
|
||||
Style="{x:Null}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ico:AdaptableIcon x:Name="CloseButton"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{DynamicResource SettingsPage.Close.Icon}"
|
||||
MouseLeftButtonUp="CloseButton_MouseUp"
|
||||
TouchDown="CloseButton_TouchDown"
|
||||
SelectedInternIcon="window_close" />
|
||||
|
||||
<StackPanel x:Name="ContentPanel"
|
||||
Grid.Row="1">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="BorderBrush"
|
||||
Value="#DBDBDB" />
|
||||
<Setter Property="Background"
|
||||
Value="#F7FAFA" />
|
||||
<Setter Property="BorderThickness"
|
||||
Value="1.5" />
|
||||
<Setter Property="Padding"
|
||||
Value="6 2.5" />
|
||||
<Setter Property="MaxHeight"
|
||||
Value="30" />
|
||||
<Setter Property="CornerRadius"
|
||||
Value="5" />
|
||||
<Setter Property="Margin"
|
||||
Value="0 7.5" />
|
||||
<Setter Property="Effect">
|
||||
<Setter.Value>
|
||||
<DropShadowEffect Color="{DynamicResource ShadowColor.Menu.KeyBoardShortcut}"
|
||||
Direction="290"
|
||||
ShadowDepth="2.5"
|
||||
BlurRadius="7.5" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Margin"
|
||||
Value="0, 0, 20, 0" />
|
||||
<Setter Property="FontSize"
|
||||
Value="14" />
|
||||
<Setter Property="FontFamily"
|
||||
Value="Calibri" />
|
||||
<Setter Property="FontWeight"
|
||||
Value="Bold" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource FontColor.Menu.Categories}" />
|
||||
<Setter Property="VerticalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="TextWrapping"
|
||||
Value="Wrap" />
|
||||
<Setter Property="MaxWidth"
|
||||
Value="250" />
|
||||
<Setter Property="HorizontalAlignment"
|
||||
Value="Left" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
</settingspagebase:SettingsPageBase>
|
||||
302
FasdDesktopUi/Pages/SettingsPage/ShortCutPageView.xaml.cs
Normal file
302
FasdDesktopUi/Pages/SettingsPage/ShortCutPageView.xaml.cs
Normal file
@@ -0,0 +1,302 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using C4IT.MultiLanguage;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Pages.SettingsPage;
|
||||
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Pages.ShortCutPage
|
||||
{
|
||||
public partial class ShortCutPageView : SettingsPageBase
|
||||
{
|
||||
private static ShortCutPageView _Instance = null;
|
||||
|
||||
public static ShortCutPageView Instance
|
||||
{
|
||||
get { return _Instance = _Instance ?? new ShortCutPageView(); }
|
||||
}
|
||||
|
||||
private ShortCutPageView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnInitialized(EventArgs e)
|
||||
{
|
||||
base.OnInitialized(e);
|
||||
InitializeHotKeyInformation();
|
||||
}
|
||||
|
||||
private void InitializeHotKeyInformation()
|
||||
{
|
||||
try
|
||||
{
|
||||
var hotKeyCategories = new List<cHotKeyCategoryInformation>();
|
||||
|
||||
var initialSearchCategory = new cHotKeyCategoryInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Initial search",
|
||||
["DE"] = "Initiale Suche"
|
||||
},
|
||||
HotKeyInformation = new List<cHotKeyInformation>()
|
||||
{
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Start new empty search",
|
||||
["DE"] = "Neue leere Suche starten"
|
||||
},
|
||||
Modifiers = new List<ModifierKeys>() { ModifierKeys.Control },
|
||||
HotKey = Key.F3
|
||||
},
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Start new search with highlighted text",
|
||||
["DE"] = "Neue Suche nach markiertem Text starten"
|
||||
},
|
||||
Modifiers = new List<ModifierKeys>() { ModifierKeys.Control, ModifierKeys.Alt },
|
||||
HotKey = Key.F3
|
||||
},
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Select previous/next result",
|
||||
["DE"] = "Vorheriges/Nächstes Ergebnis auwählen"
|
||||
},
|
||||
HotKey = Key.Up,
|
||||
AlternativeKey = Key.Down
|
||||
},
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Confirm selection",
|
||||
["DE"] = "Auswahl bestätigen"
|
||||
},
|
||||
HotKey = Key.Enter
|
||||
},
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Cancel search",
|
||||
["DE"] = "Suche abbrechen"
|
||||
},
|
||||
HotKey = Key.Escape
|
||||
}
|
||||
}
|
||||
};
|
||||
hotKeyCategories.Add(initialSearchCategory);
|
||||
|
||||
var slimViewCategory = new cHotKeyCategoryInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Slim View",
|
||||
["DE"] = "Slim View"
|
||||
},
|
||||
HotKeyInformation = new List<cHotKeyInformation>()
|
||||
{
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Open Details Page",
|
||||
["DE"] = "Details Page öffnen"
|
||||
},
|
||||
HotKey = Key.Enter
|
||||
}
|
||||
}
|
||||
};
|
||||
hotKeyCategories.Add(slimViewCategory);
|
||||
|
||||
var detailsPageCategory = new cHotKeyCategoryInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Details Page",
|
||||
["DE"] = "Details Page"
|
||||
},
|
||||
HotKeyInformation = new List<cHotKeyInformation>()
|
||||
{
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Open previous/next category",
|
||||
["DE"] = "Vorherige/nächste Kategorie öffnen"
|
||||
},
|
||||
HotKey = Key.Up,
|
||||
AlternativeKey = Key.Down
|
||||
},
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Fold in/out history",
|
||||
["DE"] = "Historie ein-/ausklappen"
|
||||
},
|
||||
HotKey = Key.Left,
|
||||
AlternativeKey = Key.Right
|
||||
},
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Opens/closes all categories at once",
|
||||
["DE"] = "Alle Kateogrien auf einmal öffnen/schließen"
|
||||
},
|
||||
HotKey = Key.OemPlus,
|
||||
AlternativeKey = Key.OemMinus
|
||||
},
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new C4IT.MultiLanguage.cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Open Quick Action menu",
|
||||
["DE"] = "Quick Action Menü öffnen"
|
||||
},
|
||||
HotKey = Key.Q,
|
||||
},
|
||||
new cHotKeyInformation()
|
||||
{
|
||||
Names = new cMultiLanguageDictionary()
|
||||
{
|
||||
["EN"] = "Reset zoom",
|
||||
["DE"] = "Zoom zurücksetzen"
|
||||
},
|
||||
HotKey = Key.NumPad0,
|
||||
Modifiers = new List<ModifierKeys>() { ModifierKeys.Control }
|
||||
}
|
||||
}
|
||||
};
|
||||
hotKeyCategories.Add(detailsPageCategory);
|
||||
|
||||
DrawHotKeyCategories(hotKeyCategories);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawHotKeyCategories(List<cHotKeyCategoryInformation> HotKeyCategories)
|
||||
{
|
||||
try
|
||||
{
|
||||
const int keyFontSize = 11;
|
||||
ContentPanel.Children.Clear();
|
||||
|
||||
if (HotKeyCategories is null)
|
||||
return;
|
||||
|
||||
foreach (var category in HotKeyCategories)
|
||||
{
|
||||
TextBlock titleTextBlock = new TextBlock() { Text = category.Names.GetValue() };
|
||||
ContentPanel.Children.Add(titleTextBlock);
|
||||
|
||||
Border categoryBorder = new Border() { CornerRadius = new CornerRadius(7.5), Margin = new Thickness(5), Padding = new Thickness(10, 5, 10, 5), Style = null };
|
||||
categoryBorder.SetResourceReference(BackgroundProperty, "BackgroundColor.Menu.MainCategory");
|
||||
|
||||
|
||||
Grid hotKeyGrid = new Grid();
|
||||
hotKeyGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(250) });
|
||||
hotKeyGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
|
||||
|
||||
for (int i = 0; i < category.HotKeyInformation.Count; i++)
|
||||
{
|
||||
var hotKeyInfo = category.HotKeyInformation[i];
|
||||
|
||||
hotKeyGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
|
||||
|
||||
TextBlock hotKeyNameTextBlock = new TextBlock() { Text = hotKeyInfo.Names.GetValue(), FontWeight = FontWeights.Regular };
|
||||
hotKeyNameTextBlock.SetResourceReference(ForegroundProperty, "FontColor.Menu.Categories");
|
||||
Grid.SetColumn(hotKeyNameTextBlock, 0);
|
||||
Grid.SetRow(hotKeyNameTextBlock, i);
|
||||
hotKeyGrid.Children.Add(hotKeyNameTextBlock);
|
||||
|
||||
StackPanel hotKeyPanel = new StackPanel() { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center };
|
||||
|
||||
foreach (var modifier in hotKeyInfo.Modifiers)
|
||||
{
|
||||
Border modifierKeyBorder = new Border();
|
||||
string modifierText = modifier.Equals(ModifierKeys.Control) ? cMultiLanguageSupport.GetItem("Global.KeyBoard.Ctrl") : modifier.ToString();
|
||||
|
||||
modifierKeyBorder.Child = new TextBlock() { Text = modifierText, TextAlignment = TextAlignment.Center, FontSize = keyFontSize, Margin = new Thickness(0), TextWrapping = TextWrapping.NoWrap, Foreground = (SolidColorBrush)new BrushConverter().ConvertFrom("#3D3C3C") };
|
||||
hotKeyPanel.Children.Add(modifierKeyBorder);
|
||||
|
||||
TextBlock plusTextBlock = new TextBlock() { Text = "+", Margin = new Thickness(10, 0, 10, 0), FontWeight = FontWeights.Regular };
|
||||
hotKeyPanel.Children.Add(plusTextBlock);
|
||||
}
|
||||
|
||||
Border keyBorder = new Border();
|
||||
keyBorder.Child = new TextBlock() { Text = hotKeyInfo.GetKeyDisplayString(hotKeyInfo.HotKey), TextAlignment = TextAlignment.Center, FontSize = keyFontSize, Margin = new Thickness(0), TextWrapping = TextWrapping.NoWrap, Foreground = (SolidColorBrush)new BrushConverter().ConvertFrom("#3D3C3C") };
|
||||
hotKeyPanel.Children.Add(keyBorder);
|
||||
|
||||
if (hotKeyInfo.AlternativeKey != null)
|
||||
{
|
||||
TextBlock alternativeTextBlock = new TextBlock() { Text = "/", Margin = new Thickness(10, 0, 10, 0), FontWeight = FontWeights.Regular };
|
||||
hotKeyPanel.Children.Add(alternativeTextBlock);
|
||||
|
||||
Border alternativeKeyBorder = new Border();
|
||||
alternativeKeyBorder.Child = new TextBlock() { Text = hotKeyInfo.GetKeyDisplayString(hotKeyInfo.AlternativeKey.Value), FontSize = keyFontSize, TextAlignment = TextAlignment.Center, Margin = new Thickness(0), TextWrapping = TextWrapping.NoWrap, Foreground = (SolidColorBrush)new BrushConverter().ConvertFrom("#3D3C3C") };
|
||||
hotKeyPanel.Children.Add(alternativeKeyBorder);
|
||||
}
|
||||
|
||||
Grid.SetColumn(hotKeyPanel, 1);
|
||||
Grid.SetRow(hotKeyPanel, i);
|
||||
hotKeyGrid.Children.Add(hotKeyPanel);
|
||||
}
|
||||
|
||||
categoryBorder.Child = hotKeyGrid;
|
||||
|
||||
ContentPanel.Children.Add(categoryBorder);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
#region CloseButton
|
||||
|
||||
private void CloseButton_Click()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CloseButton_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
CloseButton_Click();
|
||||
}
|
||||
|
||||
private void CloseButton_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
CloseButton_Click();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user