private ImageSource GetImageFromImagePath() { string file = Directory.GetCurrentDirectory() + "\\" + ImagePath; FileStream fs = null; BitmapImage image = null; try { if (File.Exists(file)) { //remove Debug from path file = file.Replace("Debug", ""); fs = new FileStream(file, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); byte[] imageBytes = br.ReadBytes((int)fs.Length); br.Close(); image = TextureUtil.ConvertByteToImageAndResize(imageBytes, 0, 0); } } catch (Exception ex) { RoLog.Instance.WriteToLog(ex.Message, TracedAttribute.ERROR); } finally { if (fs != null) { fs.Close(); } } return(image); }