public ScreenMirror(Orchestrator orchestrator, INanoleafClient nanoleafClient, ScaleType scaleType, FlipType flipType) { _externalControlEndpoint = nanoleafClient.ExternalControlEndpoint; _panelAreas = new List <Rectangle>(); _panelIds = new List <int>(); _deviceType = orchestrator.PanelLayout.DeviceType; var screenBounds = ScreenBoundsHelper.GetScreenBounds(UserSettings.Settings.ScreenMirrorMonitorIndex); var panels = orchestrator.PanelLayout.GetScaledPolygons(screenBounds.Width, screenBounds.Height, scaleType, flipType); switch (_deviceType) { case DeviceType.Aurora: LoadPanelsForTriangles(panels); break; case DeviceType.Canvas: LoadPanelsForSquares(panels); break; case DeviceType.Shapes: LoadPanelsForShapes(panels); break; default: throw new NotImplementedException($"Screen mirror constructor for device of type {orchestrator.PanelLayout.DeviceType} not implemented"); } }
private readonly Rectangle _capturedBounds; //Simple rectangle that start at 0,0 and has width and height set to the rectangle size public ScreenMirror(Device device, Orchestrator orchestrator, INanoleafClient nanoleafClient, ScaleType scaleType) { _nanoleafClient = nanoleafClient; _externalControlEndpoint = _nanoleafClient.ExternalControlEndpoint; _screenBounds = MonitorHelper.GetScreenBounds(device.ScreenMirrorMonitorIndex); _panels = orchestrator.PanelLayout.GetScaledTriangles(_screenBounds.Width, _screenBounds.Height, scaleType); //Set the rectangle size to 1/3th of the length of a side of the triangle. TODO: test what size is best var triangle = _panels.FirstOrDefault().Polygon; _rectangleSize = (int)Math.Floor(System.Windows.Point.Subtract(triangle.Points[0], triangle.Points[1]).Length / 3); _capturedBounds = new Rectangle(0, 0, _rectangleSize, _rectangleSize); }
protected BaseProcessPercentageEventTrigger(ITrigger trigger, Orchestrator orchestrator, string processName) { _trigger = trigger; _orchestrator = orchestrator; _processName = processName; var client = NanoleafClient.GetClientForDevice(_orchestrator.Device); _externalControlEndpoint = client.ExternalControlEndpoint; //Check if the user has somehow messed up their percentage profile, then we create a single step percentage profile if (_orchestrator.Device.PercentageProfile == null || _orchestrator.Device.PercentageProfile.Steps.Count == 0) { _percentageProfile = new PercentageProfile(); var step = new PercentageStep(); foreach (var panel in client.LayoutEndpoint.GetLayout().PanelPositions) { step.PanelIds.Add(panel.PanelId); } _percentageProfile.Steps.Add(step); _percentagePerStep = 100f; _amountOfSteps = 1; } else { _percentageProfile = _orchestrator.Device.PercentageProfile; _amountOfSteps = _percentageProfile.Steps.Count; _percentagePerStep = 100f / _amountOfSteps; } var processCheckTimer = new Timer(60000); processCheckTimer.Elapsed += CheckProcess; processCheckTimer.AutoReset = true; processCheckTimer.Start(); _effectTimer = new Timer(100); _effectTimer.Elapsed += ApplyEffect; _effectTimer.AutoReset = true; }