@@ -49,26 +49,23 @@ public bool IsPageTypeNotHome
49
49
public void CheckForImage ( )
50
50
{
51
51
//check if the selected item is an image file
52
- try
53
- {
54
- string ItemExtension = ( App . CurrentInstance . ContentPage as BaseLayout ) . SelectedItem . FileExtension ;
52
+ string ItemExtension = ( App . CurrentInstance . ContentPage as BaseLayout ) . SelectedItem . FileExtension ;
55
53
56
- if ( ! string . IsNullOrEmpty ( ItemExtension )
57
- && ItemExtension . Equals ( ".png" , StringComparison . OrdinalIgnoreCase )
58
- || ItemExtension . Equals ( ".jpg" , StringComparison . OrdinalIgnoreCase )
59
- || ItemExtension . Equals ( ".bmp" , StringComparison . OrdinalIgnoreCase )
60
- || ItemExtension . Equals ( ".jpeg" , StringComparison . OrdinalIgnoreCase ) )
54
+ if ( ! string . IsNullOrEmpty ( ItemExtension ) )
55
+ {
56
+ if ( ItemExtension . Equals ( ".png" , StringComparison . OrdinalIgnoreCase )
57
+ || ItemExtension . Equals ( ".jpg" , StringComparison . OrdinalIgnoreCase )
58
+ || ItemExtension . Equals ( ".bmp" , StringComparison . OrdinalIgnoreCase )
59
+ || ItemExtension . Equals ( ".jpeg" , StringComparison . OrdinalIgnoreCase ) )
61
60
{
62
61
// Since item is an image, set the IsSelectedItemImage property to true
63
62
App . InteractionViewModel . IsSelectedItemImage = true ;
64
- }
65
- else
66
- {
67
- // Since item is not an image, set the IsSelectedItemImage property to false
68
- App . InteractionViewModel . IsSelectedItemImage = false ;
63
+ return ;
69
64
}
70
65
}
71
- catch ( Exception ) { }
66
+
67
+ // Since item is not an image, folder or file without extension, set the IsSelectedItemImage property to false
68
+ App . InteractionViewModel . IsSelectedItemImage = false ;
72
69
}
73
70
}
74
71
}
0 commit comments