using System;
using System.Drawing;
using System.Collections.Generic;
public static class DisplayFusionFunction
{
public static void Run()
{
// Initialize the list
var allChromeWindows = new List<IntPtr>();
// Loop through all open windows and add Chrome windows to the list
foreach (IntPtr window in BFS.Window.GetVisibleAndMinimizedWindowHandles())
{
if (BFS.Window.GetText(window).EndsWith("Google Chrome"))
{
allChromeWindows.Add(window);
}
}
// Loop through the available monitors and move the windows to them
int i = 0;
for (int n = 0; n < BFS.Monitor.GetMonitorIDs().Length; n++)
{
BFS.Window.MoveToMonitorMaximized(BFS.Monitor.GetMonitorIDs()[n], allChromeWindows[i]);
if ((allChromeWindows.Count - 1) == i)
{
// If we got here, we've moved all of the open windows
return;
}
i++;
if (i == BFS.Monitor.GetMonitorIDs().Length)
{
// If we got here, there were more windows than monitors, so we reset the index on the monitors array
n = -1;
}
}
}
}