Added method to automatically align all loaded devices

This commit is contained in:
DarthAffe committed 2017-11-07 20:24:22 +01:00
1 parent 851d93f40a
commit c127002148
1 file changed
+13
+13
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)))