Semangat-Semangat! Meskipun lambat yang penting istiqomah, yang lebih keren lagi banyak dan istiqomah! Iya kan! :') SEMANGAT!!!
Sumber: http://stackoverflow.com/questions/11754406/random-images-in-wp7
Oprek Pertama
private Random rand = new Random();
private Image GetRandomImage(string PastScannerResults)
{
string[] files = Directory.GetFiles("/PastScanner/Results");
int i = rand.Next(files.Length);
return Image.FromFile(files[i]);
}
Oprek Kedua
IsolatedStorageFile userFile = IsolatedStorageFile.GetUserStoreForApplication();
var files = userFile.GetFileNames();
Random r = new Random();
using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile(files[r.next(0,files.count], FileMode.Open, FileAccess.Read))
{
bi.SetSource(fileStream);
this.img.Height = bi.PixelHeight;
this.img.Width = bi.PixelWidth;
}
this.img.Source = bi;
Tidak ada komentar:
Posting Komentar