Skip to content

Commit

Permalink
Code polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
malieskimi committed Nov 8, 2022
1 parent 773e1e0 commit e457dbf
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 121 deletions.
1 change: 0 additions & 1 deletion src/SecureElementReader.App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public static void Main(string[] args)

SubscribeToDomainUnhandledEvents();
RegisterDependencies();
//RunBackgroundTasks();
LogStart();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace SecureElementReader.App.ViewModels
{
public class AboutDialogViewModel : DialogViewModelBase
{

public string AssemblyVersion => GetAssemblyVersion();

public ICommand CloseButton { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class CertDetailsViewModel : ViewModelBase, ICertDetailsViewModel
[Reactive]
public bool PkiCertInvalid { get; set; }


public CertDetailsViewModel(IDialogService dialogService)
{
_dialogService = dialogService;
Expand Down
4 changes: 1 addition & 3 deletions src/SecureElementReader.App/ViewModels/MenuViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public void Translate(string targetLanguage)
public void StartUpTranslate()
{
Translate(_configuration.Language);
}

}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ private void ButtonClose()

private void OnButtonTap()
{
Process.Start(new ProcessStartInfo("https://tap.sandbox.suf.purs.gov.rs/Help/view/1048069196/Инсталирање-RCA-и-ICA-сертификата/sr-Cyrl-RS") { UseShellExecute = true });

Process.Start(
new ProcessStartInfo("https://tap.sandbox.suf.purs.gov.rs/Help/view/1048069196/Инсталирање-RCA-и-ICA-сертификата/sr-Cyrl-RS")
{
UseShellExecute = true
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ private void ValidateResult(VerifyPinModel result)
ShowTaxMessage = true;
TaxMessage = _mainWindowProvider.GetMainWindow().GetResourceObservable("PkiAppletLocked").ToString();
}

}
private void ButtonClose()
{
Expand Down
30 changes: 15 additions & 15 deletions src/SecureElementReader.App/Views/CertDetailsView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@
<TextBlock Grid.Column="0" Grid.Row="7" Margin="9,4" Classes="h2" Text="{DynamicResource IssuerName}"/>
<TextBlock Grid.Column="0" Grid.Row="8" Margin="9,4" Classes="h2" Text="{DynamicResource ApiUrl}"/>

<TextBox Grid.Column="1" Grid.Row="2" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.UniqueIdentifier}"/>
<TextBox Grid.Column="1" Grid.Row="3" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.Tin}"/>
<TextBox Grid.Column="1" Grid.Row="4" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.Organization}"/>
<TextBox Grid.Column="1" Grid.Row="5" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.OrganizationUnit}"/>
<TextBox Grid.Column="1" Grid.Row="6" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.CommonName}"/>
<TextBox Grid.Column="1" Grid.Row="7" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.IssuerName}"/>
<TextBox Grid.Column="1" Grid.Row="8" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.ApiUrl}"/>
<TextBox Grid.Column="1" Grid.Row="2" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.UniqueIdentifier}"/>
<TextBox Grid.Column="1" Grid.Row="3" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.Tin}"/>
<TextBox Grid.Column="1" Grid.Row="4" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.Organization}"/>
<TextBox Grid.Column="1" Grid.Row="5" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.OrganizationUnit}"/>
<TextBox Grid.Column="1" Grid.Row="6" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.CommonName}"/>
<TextBox Grid.Column="1" Grid.Row="7" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.IssuerName}"/>
<TextBox Grid.Column="1" Grid.Row="8" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.ApiUrl}"/>

<TextBlock Grid.Column="2" Grid.Row="2" Margin="4" Classes="h2" Text="{DynamicResource GivenName}"/>
<TextBlock Grid.Column="2" Grid.Row="3" Margin="4" Classes="h2" Text="{DynamicResource SurName}"/>
Expand All @@ -85,18 +85,18 @@
<TextBlock Grid.Column="2" Grid.Row="7" Margin="4" Classes="h2" Text="{DynamicResource RequestedBy}"/>
<TextBlock Grid.Column="2" Grid.Row="8" Margin="4" Classes="h2" Text="{DynamicResource ExpiryDate}"/>

<TextBox Grid.Column="3" Grid.Row="2" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.GivenName}"/>
<TextBox Grid.Column="3" Grid.Row="3" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.SurName}"/>
<TextBox Grid.Column="3" Grid.Row="4" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.State}"/>
<TextBox Grid.Column="3" Grid.Row="5" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.StreetAddress}"/>
<TextBox Grid.Column="3" Grid.Row="6" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.CertificateType}"/>
<TextBox Grid.Column="3" Grid.Row="7" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.RequestedBy}"/>
<TextBox Grid.Column="3" Grid.Row="8" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.ExpiryDate}"/>
<TextBox Grid.Column="3" Grid.Row="2" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.GivenName}"/>
<TextBox Grid.Column="3" Grid.Row="3" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.SurName}"/>
<TextBox Grid.Column="3" Grid.Row="4" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.State}"/>
<TextBox Grid.Column="3" Grid.Row="5" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.StreetAddress}"/>
<TextBox Grid.Column="3" Grid.Row="6" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.CertificateType}"/>
<TextBox Grid.Column="3" Grid.Row="7" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.RequestedBy}"/>
<TextBox Grid.Column="3" Grid.Row="8" Margin="4" Classes="h1" Text="{Binding CertDetailsModel.ExpiryDate}"/>
</Grid>

<Rectangle Fill="Gray" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Height="2" VerticalAlignment="Center"/>

<Label Grid.Column="1" Grid.Row="3" Content="{DynamicResource SeCertValid}" IsVisible="{Binding SeCertValid}" Foreground="Green" FontSize="15" FontWeight="Bold" Padding="0" />
<Label Grid.Column="1" Grid.Row="3" Content="{DynamicResource SeCertValid}" IsVisible="{Binding SeCertValid}" Foreground="Green" FontSize="15" FontWeight="Bold" Padding="0" />
<Label Grid.Column="1" Grid.Row="3" Content="{DynamicResource SeCertInvalid}" IsVisible="{Binding SeCertInvalid}" Foreground="Red" FontSize="15" FontWeight="Bold" Padding="0"/>
<Label Grid.Column="1" Grid.Row="4" Content="{DynamicResource PkiCertValid}" IsVisible="{Binding PkiCertValid}" Foreground="Green" FontSize="15" FontWeight="Bold" Padding="0" />
<Label Grid.Column="1" Grid.Row="4" Content="{DynamicResource PkiCertInvalid}" IsVisible="{Binding PkiCertInvalid}" Foreground="Red" FontSize="15" FontWeight="Bold" Padding="0"/>
Expand Down
4 changes: 1 addition & 3 deletions src/SecureElementReader.App/Views/Dialogs/AboutDialog.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,5 @@
</StackPanel>

</StackPanel>

</Grid>

</Grid>
</Window>
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
<Label Content="{DynamicResource PkiAppletLocked}" IsVisible="{Binding PkiAppletLocked}" Classes="Alert"/>
<Label Content="{DynamicResource SEAppletLocked}" IsVisible="{Binding SeAppletLocked}" Classes="Alert"/>
<Label Content="{DynamicResource ReturnCard}" IsVisible="{Binding ShowTaxMessage}" Classes="Alert"/>
<StackPanel Orientation="Vertical" Width="486" Height="48" HorizontalAlignment="Center" IsVisible="{Binding WrongPinAlertText}" Classes="Alert">
<StackPanel Orientation="Horizontal" Width="486" Height="24" Classes="Alert">
<StackPanel Orientation="Vertical" Width="500" Height="48" IsVisible="{Binding WrongPinAlertText}" Classes="Alert">
<StackPanel Orientation="Horizontal" Width="500" Height="24" Classes="Alert">
<Label Content="{DynamicResource WrongPkiPinAlertText}" Classes="Alert" />
<Label Content="{Binding TrysLeft}" Classes="Alert"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Width="486" Height="24" IsVisible="{Binding WrongPinAlertText}" Classes="Alert">
<StackPanel Orientation="Horizontal" Width="500" Height="24" IsVisible="{Binding WrongPinAlertText}" Classes="Alert">
<Label Content="{DynamicResource WrongSePinAlertText}" Classes="Alert" />
<Label Content="{Binding TrysLeft}" Classes="Alert"/>
</StackPanel>
Expand All @@ -72,7 +72,5 @@
CornerRadius="0" Content="{DynamicResource Close}"/>

</Grid>

</Grid>

</Window>
56 changes: 20 additions & 36 deletions src/SecureElementReader.App/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:main="clr-namespace:SecureElementReader.App.Views"
xmlns:local="clr-namespace:SecureElementReader.App.ViewModels"
xmlns:titlebars="clr-namespace:SecureElementReader.App.Views.Titlebars;assembly=SecureElementReader.App"
xmlns:local="clr-namespace:SecureElementReader.App.ViewModels"
xmlns:titlebars="clr-namespace:SecureElementReader.App.Views.Titlebars;assembly=SecureElementReader.App"
x:Class="SecureElementReader.App.Views.MainWindow"
WindowStartupLocation="CenterScreen"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="-1"
CanResize="false"
Width="800" Height="580"
Icon="/Assets/taxcore.png"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="-1"
CanResize="false"
Width="800" Height="580"
Icon="/Assets/taxcore.png"
Title="Secure Element Reader App"
Background="#e8e8e8"
FontFamily="Highway Sans Pro">


Background="#e8e8e8"
FontFamily="Highway Sans Pro">

<Window.Styles>
<Style Selector="Button.B">
<Setter Property="CornerRadius" Value="0"/>
Expand All @@ -40,44 +39,29 @@
<Setter Property="IsEnabled" Value="False"/>
</Style>
</Window.Styles>


<Grid x:Name="BaseWindowGrid" Width="800" Height="580">



<Grid x:Name="BaseWindowGrid" Width="800" Height="580">
<Grid x:Name="DefinedGrid"
ColumnDefinitions="100,100,100,100,100,100,100,100" RowDefinitions="30,100,450">


ColumnDefinitions="100,100,100,100,100,100,100,100" RowDefinitions="30,100,450">
<DockPanel x:Name="Titlebar" Grid.Column="0" Grid.ColumnSpan="8" Grid.Row="0" Width="800">
<titlebars:WindowsTitleBar IsSeamless="True"></titlebars:WindowsTitleBar>
<titlebars:MacosTitleBar IsSeamless="False"></titlebars:MacosTitleBar>
</DockPanel>


<Grid x:Name="ButtonsGrid" Grid.Column="0" Grid.ColumnSpan="8" Grid.Row="1" ColumnDefinitions="5,180,10,150,150,150,25,130" RowDefinitions="20,5,3,30,5,30">

<Grid x:Name="ButtonsGrid" Grid.Column="0" Grid.ColumnSpan="8" Grid.Row="1" ColumnDefinitions="5,180,10,150,150,150,25,130" RowDefinitions="20,5,3,30,5,30">
<TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="8" Width="800" Height="25"
TextAlignment="Center" Text="{DynamicResource Welcome}" FontSize="20" Foreground="#5b6372" />

TextAlignment="Center" Text="{DynamicResource Welcome}" FontSize="20" Foreground="#5b6372" />
<Rectangle Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="8"
HorizontalAlignment="Center" Width="500" Fill="Black" Height="2"/>

HorizontalAlignment="Center" Width="500" Fill="Black" Height="2"/>
<Button Grid.Column="1" Grid.Row="3" Classes="B"
Command="{Binding RefreshReaderListCommand}" Background="#19aa8c" Content="{DynamicResource GetReader}"/>

Command="{Binding RefreshReaderListCommand}" Background="#19aa8c" Content="{DynamicResource GetReader}"/>
<TextBox Grid.Column="3" Grid.Row="3" Grid.ColumnSpan="2" CornerRadius="0" BorderThickness="0" Foreground="Black"
IsEnabled="False" Text="{Binding CardReaderName}" Watermark="{DynamicResource NoCardReadesFounded}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>

IsEnabled="False" Text="{Binding CardReaderName}" Watermark="{DynamicResource NoCardReadesFounded}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
<Button Grid.Column="1" Grid.Row="5" Classes="B"
Command="{Binding CertDetailsCommand}" Background="#21bcbe" Content="{DynamicResource GetCert}" IsEnabled="{Binding IsEnabled}"/>

<Button Grid.Column="3" Grid.Row="5" Classes="B"
Command="{Binding VerifyPinCommand}" Background="#21bcbe" Content="{DynamicResource VerifyPin}" IsEnabled="{Binding IsEnabled}"/>

<Image Grid.Column="7" Grid.Row="0" Grid.RowSpan="6" HorizontalAlignment="Left" VerticalAlignment="Center"
Width="90" Height="90" Source="/Assets/taxcore.png"/>

Width="90" Height="90" Source="/Assets/taxcore.png"/>
</Grid>

<main:CertDetailsView Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,5 @@
</StackPanel>
</DockPanel>
</Grid>






</UserControl>
95 changes: 47 additions & 48 deletions src/SecureElementReader.App/Views/Titlebars/WindowsTitleBar.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,75 +5,74 @@
x:Class="SecureElementReader.App.Views.Titlebars.WindowsTitleBar"
xmlns:main="clr-namespace:SecureElementReader.App.Views"
DockPanel.Dock="Top">
<StackPanel>
<Grid>
<DockPanel Background="#e8e8e8"
<StackPanel>
<Grid>
<DockPanel Background="#e8e8e8"
IsHitTestVisible="False"
></DockPanel>
<DockPanel>
<StackPanel Orientation="Horizontal"
<DockPanel>
<StackPanel Orientation="Horizontal"
DockPanel.Dock="Left"
Spacing="0">
<main:MenuView DataContext="{Binding MenuViewModel}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Right"
<main:MenuView DataContext="{Binding MenuViewModel}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Right"
Orientation="Horizontal"
Spacing="0">
<Button Width="46"

<Button Width="46"
Height="30"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
BorderThickness="0"
Name="MinimizeButton"
ToolTip.Tip="Minimize">
<Button.Resources>
<CornerRadius x:Key="ControlCornerRadius">0</CornerRadius>
</Button.Resources>
<Button.Styles>
<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#44AAAAAA"/>
</Style>
<Style Selector="Button:not(:pointerover) /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
</Button.Styles>
<Path Margin="10,8,10,0"
<Button.Resources>
<CornerRadius x:Key="ControlCornerRadius">0</CornerRadius>
</Button.Resources>
<Button.Styles>
<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#44AAAAAA"/>
</Style>
<Style Selector="Button:not(:pointerover) /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
</Button.Styles>
<Path Margin="10,8,10,0"
Stretch="Uniform"
Fill="{DynamicResource SystemControlForegroundBaseHighBrush}"
Data="M2048 1229v-205h-2048v205h2048z"></Path>
</Button>

</Button>

<Button Width="46"
<Button Width="46"
Height="30"
VerticalAlignment="Bottom"
BorderThickness="0"
Name="CloseButton">
<Button.Resources>
<CornerRadius x:Key="ControlCornerRadius">0</CornerRadius>
</Button.Resources>
<Button.Styles>
<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Red"/>
</Style>
<Style Selector="Button:not(:pointerover) /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="Button:pointerover > Path">
<Setter Property="Fill" Value="White"/>
</Style>
<Style Selector="Button:not(:pointerover) > Path">
<Setter Property="Fill" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
</Style>
</Button.Styles>
<Path Margin="10,5,10,0"
<Button.Resources>
<CornerRadius x:Key="ControlCornerRadius">0</CornerRadius>
</Button.Resources>
<Button.Styles>
<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Red"/>
</Style>
<Style Selector="Button:not(:pointerover) /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="Button:pointerover > Path">
<Setter Property="Fill" Value="White"/>
</Style>
<Style Selector="Button:not(:pointerover) > Path">
<Setter Property="Fill" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
</Style>
</Button.Styles>
<Path Margin="10,5,10,0"
Stretch="Uniform"
Data="M1169 1024l879 -879l-145 -145l-879 879l-879 -879l-145 145l879 879l-879 879l145 145l879 -879l879 879l145 -145z"></Path>
</Button>
</Button>

</StackPanel>
</DockPanel>
</Grid>
</StackPanel>
</StackPanel>
</DockPanel>
</Grid>
</StackPanel>
</UserControl>

0 comments on commit e457dbf

Please sign in to comment.