private void ChangeImage(int newOffset) { _imageOffset = newOffset.Marquee(0, 13); var img = BingImage.GetFromWeb(_imageOffset); if (img != null) { UseImage(img); } }
private void UseImage(BingImage image) { image.WriteTo(ImageFile); if (!NativeMethods.SetWallpaper(ImageFile)) { return; } var wrappedText = image.Description.WordWrap(50); _currentImageLabel.Text = wrappedText; _currentIndexLabel.Text = string.Format(Resources.Program_UseImage_Index, _imageOffset + 1); }
private void WatchThread() { BingImage currentImage = null; while (true) { var newImage = BingImage.GetFromWeb(0); if (newImage != null && (currentImage == null || newImage.Date > currentImage.Date)) { currentImage = newImage; _imageOffset = 0; UseImage(currentImage); } Thread.Sleep(TimeSpan.FromMinutes(30)); } }