static KeyValuePair<ImageSource, string> SelectImage(string title, string baseFile)
{
string target = null;
ImageSource img = null;
string file = baseFile;
OpenFileDialog diag = new OpenFileDialog();
diag.Title = title;
diag.FileName = file;
diag.CheckFileExists = true;
diag.Filter = "Image Files|*.jpg;*.png;*.gif;*.bmp;*.tif|All files|*.*";
if (diag.ShowDialog() == true)
{
img = GetImage(diag.FileName);
file = diag.FileName;
target = System.IO.Path.Combine(App.AppDataPath, new FileInfo(file).Name);
try
{
File.Copy(file, target, true);
}
catch (Exception ex)
{
MessageBox.Show("Error copying to data directory:\r\n\r\n" + ex.Message, "Big Red Button of Death", MessageBoxButton.OK, MessageBoxImage.Error);
target = null;
}
}
return new KeyValuePair<ImageSource, string>(img, target);
}
private void OnChangeAbortSelfDestruct(object sender, RoutedEventArgs e)