I am trying this method of double image buffering, it is a for each loop which loops through the whole array and if the int is an even number it will add it to the end string variable and then display that image in StarImage however if it is an odd number it will do the same but this time display in the Image2.. for some reason it displays the strings in the 2 text boxes whether that was an even number or an odd number but for some reason the image is not showing in the imagebox's even though this is the correct path for the images, here is what I have so far:
string[] images = new string[] { "Star_00001.png", "Star_00002.png", "Star_00003.png", "Star_00004.png", "Star_00005.png", "Star_00006.png", "Star_00007.png", "Star_00008.png",
"Star_00009.png", "Star_00010.png", "Star_00011.png", "Star_00012.png", "Star_00013.png", "Star_00014.png", "Star_00015.png", "Star_00016.png",
"Star_00017.png", "Star_00018.png", "Star_00019.png", "Star_00021.png", "Star_00022.png", "Star_00023.png", "Star_00024.png", "Star_00025.png",};
int num = 0;
string path = "Assets/Star/Star_0000";
foreach(string file in images)
{
num = num + 1;
if ((num & 1) == 0)
{
string num2 = num.ToString();
string end = path + num2;
BitmapImage Image = new BitmapImage();
Image.UriSource = new Uri(this.BaseUri, end);
StarImage.Source = Image;
TxtBlock1.Text = end;
await Task.Delay(46);
}
else
{
string num2 = num.ToString();
string end = path + num2;
BitmapImage Image3 = new BitmapImage();
Image3.UriSource = new Uri(this.BaseUri, end);
Image2.Source = Image3;
TxtBlock2.Text = end;
await Task.Delay(46);
}
}
Does anyone understand what I am doing wrong, or perhaps any alternatives to double buffering?