Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In the following Code i'm unable to compare the pending image values.

public partial class MainPage : PhoneApplicationPage
{
Image PendingImage1;
Image PendingImage2;

public void img1_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
this.img1.Source = new BitmapImage(new Uri("Assets/baby.jpg", UriKind.RelativeOrAbsolute));
if (PendingImage1 == null)
{
PendingImage1 = img1;
}
else if (PendingImage1 != null && PendingImage2 == null)
{
PendingImage2 = img1;
}
if (PendingImage1 != null && PendingImage2 != null)
{
if (PendingImage1.Tag == PendingImage2.Tag)
{

}
else
{
DispatcherTimer timer = new DispatcherTimer();
timer.Start();
}

}
}

private void img2_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{

this.img2.Source = new BitmapImage(new Uri("Assets/duckk.jpg", UriKind.RelativeOrAbsolute));
if (PendingImage1 == null)
{
PendingImage1 = img2;
}
else if (PendingImage1 != null && PendingImage2 == null)
{
PendingImage2 = img2;
}
if (PendingImage1 != null && PendingImage2 != null)
{
if (PendingImage1.Tag == PendingImage2.Tag)
{

}
else
{
DispatcherTimer timer = new DispatcherTimer();
timer.Start();
}

}
}
Posted
Updated 4-Jun-14 3:16am
v2
Comments
Pheonyx 4-Jun-14 9:05am    
Firstly, I don't imagine anyone here is likely yo read through your entire code base. By pasting your codebase it implies you haven't done any debugging at all. I would suggest you start by stepping through your code and identifying what function fails. Then investigate what values you are expecting and what you are getting to identify where your issue lies.
ritu tyagi 4-Jun-14 9:11am    
Okkk Thankx for reply.. i wll take care of it..
Naz_Firdouse 4-Jun-14 9:34am    
what is the issue?
if you click on image one and image two, if the tags for img1 and img2 are same, then the if condition holds true else it will be false...
ritu tyagi 5-Jun-14 1:10am    
Yaa exactly i want to compare my both of the images with the help of tags. if both match then then if condition then else
johannesnestler 4-Jun-14 10:49am    
Code not finished? if (PendingImage1 != null && PendingImage2 != null)
{
if (PendingImage1.Tag == PendingImage2.Tag)
{

}
...
So whats the Problem, yes an error, but where?, what error?, what do you expect?, what you tried?

1 solution

Why are you comparing images at all?

It seems you're data model is non-existent and that's what is screwing you over right now.

Each image should be the visual representation of a data point in your data model. That data point should be a numerical value. Then the comparison is very easy.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900