NasaPicOfDay.BackgroundChanger.SetDesktopBackground C# (CSharp) Метод

SetDesktopBackground() публичный Метод

Set the desktop to the current picture of the day Full file path to the image to set as the desktop background.
public SetDesktopBackground ( string fileName ) : void
fileName string
Результат void
        public void SetDesktopBackground(string fileName)
        {
            try
             {
            if (GlobalVariables.LoggingEnabled) ExceptionManager.WriteInformation("Preparing to change desktop background");
            SystemParametersInfo(SpiSetdeskwallpaper, 0, fileName, SpifUpdateinifile);
            if (GlobalVariables.LoggingEnabled) ExceptionManager.WriteInformation("Completed desktop background change");
             }
             catch (Exception ex)
             {
            if (GlobalVariables.LoggingEnabled) ExceptionManager.WriteInformation("An error occurred updating the desktop background.");
            ExceptionManager.WriteException(ex);
             }
        }

Usage Example

Пример #1
0
        private void btnSetImage_Click(object sender, EventArgs e)
        {
            var bgChanger = new BackgroundChanger();

            GlobalVariables.NasaImage = bgChanger.GetImage(_currentImageNumber, _currentPage);
            bgChanger.SetDesktopBackground(GlobalVariables.NasaImage.DownloadedPath);
            Close();
        }
All Usage Examples Of NasaPicOfDay.BackgroundChanger::SetDesktopBackground