public AgentManager(IEventLogging logging) { _logging = logging; _flag = new AutoResetEvent(false); _proc = new Thread(ThreadProc); _backgroundProvider = new BackgroundProvider(); _proc.Start(_flag); _flag.WaitOne(-1); }
/// <summary> /// Performs the background update. /// </summary> /// <exception cref="System.Exception">The background provider has not been selected</exception> public async void UpdateBackgroundAsync(IBackgroundProvider backgroundProvider, bool force = false) { if (Settings.Default.EnableAutomaticUpdates || force) { Task<string> downloadBackground = backgroundProvider.DownloadBackgroundAsync(null); var backgroundPath = await downloadBackground; BackgroundHelper.SetDesktopBackground(backgroundPath, DesktopBackgroundStyle.Filled); FileUtility.CleanupDirectory(ApplicationDataPath, Path.GetFileNameWithoutExtension(backgroundPath)); } }
public static bool changeBackground(IBackgroundProvider provider) { var file = provider.getBackground(); var result = false; unsafe { fixed (char* val = file) { result = PInvoke.SystemParametersInfo( SYSTEM_PARAMETERS_INFO_ACTION.SPI_SETDESKWALLPAPER, 0, val, SystemParametersInfo_fWinIni.SPIF_UPDATEINIFILE | SystemParametersInfo_fWinIni.SPIF_SENDCHANGE); } } return result; }
/// <summary> /// Gets the current background information. /// </summary> /// <returns></returns> public string GetCurrentBackgroundInformation(IBackgroundProvider backgroundProvider) { return backgroundProvider.BackgroundDescription; }
public MainForm(EventWaitHandle flag, IBackgroundProvider backgroundProvider) : this() { _exitFlag = flag; _backgroundProvider = backgroundProvider; }