Here's a little context:
My C# windows form is trying to save a bitmap image with:
OutputImage.Image = OutputBitmap;
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
if (!(System.IO.Directory.Exists(desktopPath + @"\" + "Cache")))
{
System.IO.Directory.CreateDirectory(desktopPath + @"\" + "Cache");
}
try
{
OutputBitmap.Save(desktopPath + "\\Cache\\" + "ImageName.jpg");
}
catch
{
Debug("-Darn... file error!-");
}
Now the problem is I have an elementHost containing some WPF code which is using the same bitmap image file for another process:
BitmapSource Source = new BitmapImage(new Uri(desktopPath + "\\Cache\\" + "ImageName.jpg"));
Now since that the file is being used by the WPF element, is it conclusively impossible to have said image saved?
Thanks!