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