Skip to content

Commit 7260e7a

Browse files
committed
Requested changes
1 parent 2f5f104 commit 7260e7a

File tree

2 files changed

+69
-66
lines changed

2 files changed

+69
-66
lines changed

src/Files.App/Views/Properties/HashesPage.xaml

Lines changed: 56 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,69 @@
2626

2727
<Grid x:Name="RootGrid">
2828

29+
<!-- Hash Comparison Section -->
2930
<Grid
30-
x:Name="HashesListGrid"
31+
x:Name="HashComparisonGrid"
3132
Margin="12"
3233
VerticalAlignment="Top"
3334
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
3435
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
3536
BorderThickness="1"
3637
CornerRadius="4">
38+
<Grid.RowDefinitions>
39+
<RowDefinition Height="Auto" />
40+
<RowDefinition Height="Auto" />
41+
</Grid.RowDefinitions>
42+
<Grid.ColumnDefinitions>
43+
<ColumnDefinition Width="*" />
44+
<ColumnDefinition Width="Auto" />
45+
</Grid.ColumnDefinitions>
46+
47+
<!-- Hash Input -->
48+
<Grid
49+
Grid.Row="0"
50+
Grid.Column="0"
51+
Margin="12">
52+
<Grid.ColumnDefinitions>
53+
<ColumnDefinition Width="*" />
54+
</Grid.ColumnDefinitions>
55+
56+
<TextBox
57+
x:Name="HashInputTextBox"
58+
Grid.Column="0"
59+
PlaceholderText="{helpers:ResourceString Name=EnterHashToCompare}"
60+
TextChanged="HashInputTextBox_TextChanged" />
61+
</Grid>
62+
63+
<!-- Compare File Button -->
64+
<Button
65+
x:Name="CompareFileButton"
66+
Grid.Row="0"
67+
Grid.Column="1"
68+
Margin="12"
69+
Click="CompareFileButton_Click"
70+
Content="{helpers:ResourceString Name=CompareFile}" />
71+
</Grid>
72+
73+
<InfoBar
74+
x:Name="HashMatchInfoBar"
75+
Title="Title"
76+
Grid.Row="1"
77+
Grid.Column="0"
78+
Margin="12,75,12,12"
79+
IsClosable="False"
80+
IsOpen="True"
81+
Message="Message"
82+
Severity="Informational" />
83+
84+
<Grid
85+
x:Name="HashesListGrid"
86+
Margin="12,130,12,12"
87+
VerticalAlignment="Stretch"
88+
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
89+
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
90+
BorderThickness="1"
91+
CornerRadius="4">
3792

3893
<!-- Hashes ListView -->
3994
<ListView
@@ -200,55 +255,5 @@
200255
</ListView>
201256
</Grid>
202257

203-
<!-- Hash Comparison Section -->
204-
<Grid
205-
x:Name="HashComparisonGrid"
206-
Margin="12,0,12,12"
207-
VerticalAlignment="Bottom"
208-
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
209-
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
210-
BorderThickness="1"
211-
CornerRadius="4">
212-
<Grid.RowDefinitions>
213-
<RowDefinition Height="Auto" />
214-
</Grid.RowDefinitions>
215-
<Grid.ColumnDefinitions>
216-
<ColumnDefinition Width="*" />
217-
<ColumnDefinition Width="Auto" />
218-
</Grid.ColumnDefinitions>
219-
220-
<!-- Hash Input -->
221-
<Grid
222-
Grid.Row="0"
223-
Grid.Column="0"
224-
Margin="12">
225-
<Grid.ColumnDefinitions>
226-
<ColumnDefinition Width="*" />
227-
<ColumnDefinition Width="Auto" />
228-
</Grid.ColumnDefinitions>
229-
230-
<TextBox
231-
x:Name="HashInputTextBox"
232-
Grid.Column="0"
233-
PlaceholderText="{helpers:ResourceString Name=EnterHashToCompare}"
234-
TextChanged="HashInputTextBox_TextChanged" />
235-
236-
<FontIcon
237-
x:Name="HashMatchIcon"
238-
Grid.Column="1"
239-
Margin="8,0,0,0"
240-
VerticalAlignment="Center"
241-
Visibility="Collapsed" />
242-
</Grid>
243-
244-
<!-- Compare File Button -->
245-
<Button
246-
x:Name="CompareFileButton"
247-
Grid.Row="0"
248-
Grid.Column="1"
249-
Margin="12"
250-
Click="CompareFileButton_Click"
251-
Content="{helpers:ResourceString Name=CompareFile}" />
252-
</Grid>
253258
</Grid>
254259
</vm:BasePropertiesPage>

src/Files.App/Views/Properties/HashesPage.xaml.cs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,24 @@ private void CompareHashes()
5757

5858
if (string.IsNullOrEmpty(hashToCompare))
5959
{
60-
HashMatchIcon.Visibility = Visibility.Collapsed;
60+
HashMatchInfoBar.Visibility = Visibility.Collapsed;
6161
return;
6262
}
6363

6464
foreach (var hashInfo in HashesViewModel.Hashes)
6565
{
6666
if (hashInfo.HashValue != null && hashInfo.HashValue.Equals(hashToCompare, StringComparison.OrdinalIgnoreCase))
6767
{
68-
HashMatchIcon.Glyph = "\uE73E"; // Check mark
69-
//HashMatchIcon.Foreground = new SolidColorBrush(Colors.Green);
70-
ToolTipService.SetToolTip(HashMatchIcon, string.Format(Strings.HashesMatch.GetLocalizedResource(), hashInfo.Algorithm));
71-
HashMatchIcon.Visibility = Visibility.Visible;
68+
HashMatchInfoBar.Severity = InfoBarSeverity.Success; // Set success
69+
HashMatchInfoBar.Title = string.Format(Strings.HashesMatch.GetLocalizedResource(), hashInfo.Algorithm);
70+
HashMatchInfoBar.Visibility = Visibility.Visible;
7271
return;
7372
}
7473
}
7574

76-
HashMatchIcon.Glyph = "\uE711"; // Cross mark
77-
//HashMatchIcon.Foreground = new SolidColorBrush(Colors.Red);
78-
ToolTipService.SetToolTip(HashMatchIcon, Strings.HashesDoNotMatch.GetLocalizedResource());
79-
HashMatchIcon.Visibility = Visibility.Visible;
75+
HashMatchInfoBar.Severity = InfoBarSeverity.Error; // Set error
76+
HashMatchInfoBar.Title = Strings.HashesDoNotMatch.GetLocalizedResource();
77+
HashMatchInfoBar.Visibility = Visibility.Visible;
8078
}
8179

8280
private async void CompareFileButton_Click(object sender, RoutedEventArgs e)
@@ -91,19 +89,19 @@ private async void CompareFileButton_Click(object sender, RoutedEventArgs e)
9189
{
9290
var selectedFileHash = await CalculateSHA384HashAsync(file.Path);
9391
var currentFileHash = HashesViewModel.Hashes.FirstOrDefault(h => h.Algorithm == "SHA384")?.HashValue;
94-
92+
HashInputTextBox.Text = selectedFileHash;
9593
if (selectedFileHash == currentFileHash)
9694
{
97-
HashMatchIcon.Glyph = "\uE73E"; // Check mark
98-
ToolTipService.SetToolTip(HashMatchIcon, Strings.HashesMatch.GetLocalizedResource());
95+
HashMatchInfoBar.Severity = InfoBarSeverity.Success; // Check mark
96+
HashMatchInfoBar.Title = Strings.HashesMatch.GetLocalizedResource();
9997
}
10098
else
10199
{
102-
HashMatchIcon.Glyph = "\uE711"; // Cross mark
103-
ToolTipService.SetToolTip(HashMatchIcon, Strings.HashesMatch.GetLocalizedResource());
100+
HashMatchInfoBar.Severity = InfoBarSeverity.Error; // Cross mark
101+
HashMatchInfoBar.Title = Strings.HashesMatch.GetLocalizedResource();
104102
}
105103

106-
HashMatchIcon.Visibility = Visibility.Visible;
104+
HashMatchInfoBar.Visibility = Visibility.Visible;
107105
}
108106
}
109107

0 commit comments

Comments
 (0)