/// <summary> /// Execute /// </summary> /// <param name="e">The <see cref="DesktopBackgroundChangedEventArgs" /> instance containing the event data.</param> public override async Task Execute(DesktopBackgroundChangedEventArgs e) { if (!string.IsNullOrEmpty(_temporaryBackground)) { await _desktop.SetDesktopBackground(_temporaryBackground); } await Task.Delay(_delayTimeMs); await _desktop.SetDesktopBackground(_background); }
/// <summary> /// Executes the specified e. /// </summary> /// <param name="e">The <see cref="DesktopBackgroundChangedEventArgs" /> instance containing the event data.</param> public override async Task Execute(DesktopBackgroundChangedEventArgs e) { foreach (var slide in _slides) { if (!File.Exists(slide.Filename)) { Debug.WriteLine("What the frick where am I???", slide.Filename); continue; } await Desktop.Current?.SetDesktopBackground(slide.Filename); await Task.Delay(slide.DisplayTime); } }
/// <summary> /// Called when [desktop background changed]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="DesktopBackgroundChangedEventArgs"/> instance containing the event data.</param> private void OnDesktopBackgroundChanged(object sender, DesktopBackgroundChangedEventArgs e) { if (_isInternalSet) { _desktopSet.Set(); _isInternalSet = false; } else { var executableHooks = _hooks.Where(x => x.CanExecute(e)); Task.Run(async() => { foreach (var hook in executableHooks) { await hook.Execute(e); } }); } }
/// <summary> /// Executes the specified e. /// </summary> /// <param name="e">The <see cref="DesktopBackgroundChangedEventArgs"/> instance containing the event data.</param> public abstract Task Execute(DesktopBackgroundChangedEventArgs e);
/// <summary> /// Determines whether this instance can execute the specified e. /// </summary> /// <param name="e">The <see cref="DesktopBackgroundChangedEventArgs"/> instance containing the event data.</param> /// <returns> /// <c>true</c> if this instance can execute the specified e; otherwise, <c>false</c>. /// </returns> public bool CanExecute(DesktopBackgroundChangedEventArgs e) { return(e.NewBackground != e.OldBackground); }
/// <summary> /// Executes the specified e. /// </summary> /// <param name="e">The <see cref="T:DbgMON.DesktopManagement.Monitoring.DesktopBackgroundChangedEventArgs" /> instance containing the event data.</param> /// <returns></returns> public override Task Execute(DesktopBackgroundChangedEventArgs e) { return(default);