using System;
using System.Drawing;
using System.Collections.Generic;
public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
        var windowTitlesList = new List<string>();
		// Build the list of open window titles
		foreach (IntPtr window in BFS.Window.GetVisibleAndMinimizedWindowHandles())
        {
            string windowTitle = BFS.Window.GetText(window);
            if (!String.IsNullOrEmpty(windowTitle))
            {
                windowTitlesList.Add(windowTitle);
            }
        }
        
        // Convert the list to a string array
        string[] windowTitles = windowTitlesList.ToArray();
        
        // Show the list to choose from
        string selectedWindow = BFS.Dialog.GetUserInputListViewWithFilter("Select the window to move...", windowTitles);
        // Move the window to the current monitor
        BFS.Window.MoveToMonitor(BFS.Monitor.GetMonitorIDByXY(BFS.Input.GetMousePositionX(), BFS.Input.GetMousePositionY()), BFS.Window.GetWindowByTextExact(selectedWindow));
	}
}