private void Update() { PreUpdate?.Invoke(this, null); UpdatedEvents.Clear(); //Blackout. TODO: Cleanup this a bit. Maybe push blank effect frame to keyboard incase it has existing stuff displayed if ((Global.Configuration.time_based_dimming_enabled && Utils.Time.IsCurrentTimeBetween(Global.Configuration.time_based_dimming_start_hour, Global.Configuration.time_based_dimming_start_minute, Global.Configuration.time_based_dimming_end_hour, Global.Configuration.time_based_dimming_end_minute))) { StopUnUpdatedEvents(); return; } string raw_process_name = Path.GetFileName(processMonitor.ProcessPath); UpdateProcess(); EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); //TODO: Move these IdleEffects to an event //this.UpdateIdleEffects(newFrame); ILightEvent profile = GetCurrentProfile(out bool preview); timerInterval = profile?.Config?.UpdateInterval ?? defaultTimerInterval; // If the current foreground process is excluded from Aurora, disable the lighting manager if ((profile is Desktop.Desktop && !profile.IsEnabled) || Global.Configuration.excluded_programs.Contains(raw_process_name)) { StopUnUpdatedEvents(); Global.dev_manager.Shutdown(); Global.effengine.PushFrame(newFrame); return; } else { Global.dev_manager.InitializeOnce(); } if (Global.Configuration.OverlaysInPreview || !preview) { foreach (var underlay in Underlays) { ILightEvent @event = Events[underlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { UpdateEvent(@event, newFrame); } } } //Need to do another check in case Desktop is disabled or the selected preview is disabled if (profile.IsEnabled) { UpdateEvent(profile, newFrame); } if (Global.Configuration.OverlaysInPreview || !preview) { // Update any overlays registered in the Overlays array. This includes applications with type set to Overlay and things such as skype overlay foreach (var overlay in Overlays) { ILightEvent @event = Events[overlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { UpdateEvent(@event, newFrame); } } // Update any overlays that are timer-based (e.g. the volume overlay that appears for a few seconds at a time) TimedListObject[] overlay_events = overlays.ToArray(); foreach (TimedListObject evnt in overlay_events) { if ((evnt.item as LightEvent).IsEnabled) { UpdateEvent((evnt.item as LightEvent), newFrame); } } // Update any applications that have overlay layers if that application is open var events = GetOverlayActiveProfiles().ToList(); //Add the Light event that we're previewing to be rendered as an overlay if (preview && Global.Configuration.OverlaysInPreview && !events.Contains(profile)) { events.Add(profile); } foreach (var @event in events) { @event.UpdateOverlayLights(newFrame); } UpdateIdleEffects(newFrame); } Global.effengine.PushFrame(newFrame); StopUnUpdatedEvents(); PostUpdate?.Invoke(this, null); }
private void Update() { PreUpdate?.Invoke(this, null); UpdatedEvents.Clear(); //Blackout. TODO: Cleanup this a bit. Maybe push blank effect frame to keyboard incase it has existing stuff displayed if ((Global.Configuration.time_based_dimming_enabled && Utils.Time.IsCurrentTimeBetween(Global.Configuration.time_based_dimming_start_hour, Global.Configuration.time_based_dimming_start_minute, Global.Configuration.time_based_dimming_end_hour, Global.Configuration.time_based_dimming_end_minute))) { StopUnUpdatedEvents(); return; } string raw_process_name = Path.GetFileName(processMonitor.ProcessPath); UpdateProcess(); EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); //TODO: Move these IdleEffects to an event //this.UpdateIdleEffects(newFrame); ILightEvent profile = GetCurrentProfile(out bool preview); timerInterval = profile?.Config?.UpdateInterval ?? defaultTimerInterval; // If the current foreground process is excluded from Aurora, disable the lighting manager if ((profile is Desktop.Desktop && !profile.IsEnabled) || Global.Configuration.excluded_programs.Contains(raw_process_name)) { StopUnUpdatedEvents(); Global.dev_manager.Shutdown(); Global.effengine.PushFrame(newFrame); return; } else { Global.dev_manager.InitializeOnce(); } //Need to do another check in case Desktop is disabled or the selected preview is disabled if (profile.IsEnabled) { UpdateEvent(profile, newFrame); } // Overlay layers if (!preview || Global.Configuration.OverlaysInPreview) { foreach (var @event in GetOverlayActiveProfiles()) { @event.UpdateOverlayLights(newFrame); } //Add the Light event that we're previewing to be rendered as an overlay (assuming it's not already active) if (preview && Global.Configuration.OverlaysInPreview && !GetOverlayActiveProfiles().Contains(profile)) { profile.UpdateOverlayLights(newFrame); } UpdateIdleEffects(newFrame); } Global.effengine.PushFrame(newFrame); StopUnUpdatedEvents(); PostUpdate?.Invoke(this, null); }