Error handling for corrupt images.
This commit is contained in:
@@ -40,13 +40,21 @@ namespace WPicView
|
||||
dPos = allDirs.Length - 1;
|
||||
allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern);
|
||||
fPos = allFiles.Length-1;
|
||||
this.Title = allFiles[fPos];
|
||||
IMG1.Source = new BitmapImage(new Uri(allFiles[fPos]));
|
||||
showFile(allFiles[fPos]);
|
||||
group.Children.Add(st);
|
||||
group.Children.Add(tt);
|
||||
|
||||
}
|
||||
|
||||
private void showFile(String fileName) {
|
||||
this.Title = allFiles[fPos];
|
||||
try {
|
||||
IMG1.Source = new BitmapImage(new Uri(fileName));
|
||||
} catch (Exception ex) {
|
||||
this.Title = "ERRROR LOADING FILE " + this.Title;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnKeyDownHandler(object sender, KeyEventArgs e)
|
||||
{
|
||||
// Directory Navigation
|
||||
@@ -102,8 +110,7 @@ namespace WPicView
|
||||
// Display file
|
||||
if (allFiles.Length > 0)
|
||||
{
|
||||
this.Title = allFiles[fPos];
|
||||
IMG1.Source = new BitmapImage(new Uri(allFiles[fPos]));
|
||||
showFile(allFiles[fPos]);
|
||||
}
|
||||
|
||||
// zoom - TODO
|
||||
|
||||
Reference in New Issue
Block a user