@@ -80,30 +80,20 @@ private void HashInputTextBox_TextChanged(object sender, TextChangedEventArgs e)
8080
8181 private async void CompareFileButton_Click ( object sender , RoutedEventArgs e )
8282 {
83- var picker = new Windows . Storage . Pickers . FileOpenPicker ( ) ;
84- picker . SuggestedStartLocation = Windows . Storage . Pickers . PickerLocationId . Desktop ;
85- picker . FileTypeFilter . Add ( "*" ) ;
86- WinRT . Interop . InitializeWithWindow . Initialize ( picker , MainWindow . Instance . WindowHandle ) ;
83+ var result = await HashesViewModel . CompareFileAsync ( ) ;
8784
88- var file = await picker . PickSingleFileAsync ( ) ;
89- if ( file != null )
85+ if ( result )
9086 {
91- var selectedFileHash = await HashesViewModel . CalculateSHA384HashAsync ( file . Path ) ;
92- var currentFileHash = HashesViewModel . Hashes . FirstOrDefault ( h => h . Algorithm == "SHA384" ) ? . HashValue ;
93- HashInputTextBox . Text = selectedFileHash ;
94- if ( selectedFileHash == currentFileHash )
95- {
96- HashMatchInfoBar . Severity = InfoBarSeverity . Success ; // Check mark
97- HashMatchInfoBar . Title = Strings . HashesMatch . GetLocalizedResource ( ) ;
98- }
99- else
100- {
101- HashMatchInfoBar . Severity = InfoBarSeverity . Error ; // Cross mark
102- HashMatchInfoBar . Title = Strings . HashesMatch . GetLocalizedResource ( ) ;
103- }
104-
105- HashMatchInfoBar . IsOpen = true ;
87+ HashMatchInfoBar . Severity = InfoBarSeverity . Success ; // Check mark
88+ HashMatchInfoBar . Title = Strings . HashesMatch . GetLocalizedResource ( ) ;
89+ }
90+ else
91+ {
92+ HashMatchInfoBar . Severity = InfoBarSeverity . Error ; // Cross mark
93+ HashMatchInfoBar . Title = "no" ;
10694 }
95+
96+ HashMatchInfoBar . IsOpen = true ;
10797 }
10898
10999 private void MenuFlyout_Closing ( FlyoutBase sender , FlyoutBaseClosingEventArgs e )
0 commit comments