1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 10:08:31 +00:00

Added method to automatically align all loaded devices

This commit is contained in:
Darth Affe 2017-11-07 20:24:22 +01:00
parent 851d93f40a
commit c127002148

View File

@ -42,6 +42,19 @@ namespace RGB.NET.Core
} }
} }
/// <summary>
/// Automatically aligns all devices to prevent overlaps.
/// </summary>
public void AlignDevies()
{
double posX = 0;
foreach (IRGBDevice device in Devices)
{
device.Location.X = posX;
posX += device.Size.Width + 1;
}
}
private void DeviceOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) private void DeviceOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
{ {
if (string.Equals(propertyChangedEventArgs.PropertyName, nameof(IRGBDevice.Location))) if (string.Equals(propertyChangedEventArgs.PropertyName, nameof(IRGBDevice.Location)))