private async void ShowPrevAsync() { if (prev != null) { next = current; current = prev; imageBox.Source = current.Image; nameButton.Content = current.Name; if (current.ID != 0) { ulong i = current.ID - 1; /*if (favNewest) * { * i = i % 30; * if (i == 0 && currentList != 0) * { * Names = await GetNames(--currentList); * } * * while (true) * { * while (true) * { * if (fav.Find(s => s == Names[(int)i]) != null) * { * i = (ulong)currentList * 30 + i; * goto FoundNext; * } * else * { * if (i == 0) * { * i = 29; * currentList--; * break; * } * else * i--; * } * } * if (currentList == -1) * { * prev = null; * return; * } * Names = await GetNames(currentList); * } * } * FoundNext:*/ prev = await GetImageWithNameAsync(i); } else { prev = null; } } }
private async void ShowNextAsync() { prev = current; if (next != null) { current = next; } else { MessageBox.Show("No more images"); } imageBox.Source = current.Image; nameButton.Content = current.Name; try { ulong i = current.ID + 1; /*if (favNewest) * { * i = i % 30; * if (i == 0) * { * Names = await GetNames(++currentList); * } * * while (true) * { * while (true) * { * if (fav.Find(s => s == Names[(int)i]) != null) * { * i = (ulong)currentList * 30 + i; * goto FoundNext; * } * else * { * i++; * if (i == 30) * { * i = 0; * currentList++; * break; * } * } * } * Names = await GetNames(currentList); * } * } * FoundNext:*/ next = await GetImageWithNameAsync(i); } catch { next = null; } }
private async void LoadAsync(object sender, RoutedEventArgs e) { current = await GetImageWithNameAsync(0); next = await GetImageWithNameAsync(1); imageBox.Source = current.Image; nameButton.Content = current.Name; }