PasswordCrackerView.xaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <Page x:Class="friaLabbar.Views.PasswordCrackerView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:friaLabbar.Views"
  7. xmlns:viewmodels="clr-namespace:friaLabbar.ViewModels"
  8. mc:Ignorable="d"
  9. d:DesignHeight="450" d:DesignWidth="800"
  10. Background="Wheat"
  11. Title="PasswordCrackerView">
  12. <Page.Resources>
  13. <Style TargetType="TextBlock">
  14. <Setter Property="Padding" Value="10 10" />
  15. <Setter Property="FontSize" Value="20" />
  16. </Style>
  17. <Style TargetType="TextBox">
  18. <Setter Property="Margin" Value="4" />
  19. </Style>
  20. <viewmodels:PasswordToColorConverter x:Key="passwordToColorConverter" />
  21. <viewmodels:PasswordCharacterToColorConverter x:Key="passwordCharacterToColorConverter" />
  22. </Page.Resources>
  23. <Grid Grid.IsSharedSizeScope="True">
  24. <Grid.ColumnDefinitions>
  25. <ColumnDefinition Width="20" />
  26. <ColumnDefinition Width="auto" SharedSizeGroup="FirstColumn" />
  27. <ColumnDefinition Width="auto" SharedSizeGroup="SecondColumn" />
  28. <ColumnDefinition Width="*" />
  29. </Grid.ColumnDefinitions>
  30. <Grid.RowDefinitions>
  31. <RowDefinition Height="20" />
  32. <RowDefinition Height="auto" />
  33. <RowDefinition Height="auto" />
  34. <RowDefinition Height="auto" />
  35. </Grid.RowDefinitions>
  36. <!-- Row 0 -->
  37. <!-- Row 1 -->
  38. <TextBlock Text="Password cracker" FontSize="40" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="4" />
  39. <!-- Row 2 -->
  40. <TextBlock Text="Position" Grid.Row="2" Grid.Column="1" Background="Aqua"/>
  41. <TextBlock Text="Seen characters" Grid.Row="2" Grid.Column="2" Background="Turquoise" />
  42. <TextBlock Text="Passwords" Grid.Row="2" Grid.Column="3" Background="BlanchedAlmond" />
  43. <!-- Row 3 -->
  44. <ItemsControl ItemsSource="{Binding PossiblePasswords}" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2">
  45. <ItemsControl.ItemTemplate>
  46. <DataTemplate>
  47. <Grid>
  48. <Grid.ColumnDefinitions>
  49. <ColumnDefinition Width="auto" SharedSizeGroup="FirstColumn" />
  50. <ColumnDefinition Width="auto" SharedSizeGroup="SecondColumn" />
  51. </Grid.ColumnDefinitions>
  52. <Grid.RowDefinitions>
  53. <RowDefinition Height="auto" />
  54. </Grid.RowDefinitions>
  55. <TextBlock Text="{Binding Position}" Background="Orchid" Grid.Column="0"/>
  56. <TextBox Text="{Binding Text}" Grid.Column="1" Background="Pink" />
  57. </Grid>
  58. </DataTemplate>
  59. </ItemsControl.ItemTemplate>
  60. </ItemsControl>
  61. <ItemsControl ItemsSource="{Binding AllPasswords}" Grid.Row="3" Grid.Column="3">
  62. <ItemsControl.ItemsPanel>
  63. <ItemsPanelTemplate>
  64. <WrapPanel />
  65. </ItemsPanelTemplate>
  66. </ItemsControl.ItemsPanel>
  67. <ItemsControl.ItemTemplate>
  68. <DataTemplate>
  69. <Border BorderThickness="1" BorderBrush="Black">
  70. <StackPanel Orientation="Horizontal" Margin="10" Background="{Binding IsPossible, Converter={StaticResource passwordToColorConverter}}">
  71. <ItemsControl ItemsSource="{Binding Characters}">
  72. <ItemsControl.ItemsPanel>
  73. <ItemsPanelTemplate>
  74. <StackPanel Orientation="Horizontal" />
  75. </ItemsPanelTemplate>
  76. </ItemsControl.ItemsPanel>
  77. <ItemsControl.ItemTemplate>
  78. <DataTemplate>
  79. <TextBlock Text="{Binding Character}" Padding="1" FontSize="20" FontWeight="Bold" Foreground="{Binding State, Converter={StaticResource passwordCharacterToColorConverter}}" />
  80. </DataTemplate>
  81. </ItemsControl.ItemTemplate>
  82. </ItemsControl>
  83. </StackPanel>
  84. </Border>
  85. </DataTemplate>
  86. </ItemsControl.ItemTemplate>
  87. </ItemsControl>
  88. <!-- Row 4 -->
  89. </Grid>
  90. </Page>