I am developing a Windows Phone 8.1 application in C #. I use the camera to take a picture. The image is saved on the device, and I'm trying to show it in the image. I tested it on an HTC phone and it worked well, but when I tried it on Nokia Lumia, the image will never load. Does anyone have an idea how to solve this?
Here is the code I sing to take a picture:
private void snap_task_Click(object sender, EventArgs e)
{
cameraCaptureTask = new CameraCaptureTask();
cameraCaptureTask.Completed += cameraCaptureTask_Completed;
cameraCaptureTask.Show();
}
void cameraCaptureTask_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
NavigationService.Navigate(new Uri("/Slika.xaml?fotka=" + e.OriginalFileName, UriKind.Relative));
}
}
And this is the code where I am trying to upload an image.
public Slika()
{
InitializeComponent();
string slika = string.Empty;
string slika2 = string.Empty;
this.Loaded += (s, e) =>
{
if (NavigationContext.QueryString.TryGetValue("fotka", out slika))
{
putanja = slika;
int x = putanja.Length;
if (x == 1)
{
putanja = "/Resources/" + putanja + ".png";
uriPutanja = new Uri(putanja, UriKind.Relative);
fotka = new BitmapImage(uriPutanja);
}
else
{
uriPutanja = new Uri(putanja, UriKind.Relative);
porukaTextBox.Text = putanja;
fotka = new BitmapImage(uriPutanja);
}
}
img1.Source = fotka;
};
}
PS
booting from local resources works fine on both phones, it’s just the “more” part of the problem that causes problems in Nokia.
source
share