using System;
using System.Drawing;
using Microsoft.Win32;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
// Gets the number of monitors attached to the system
int numberOfMonitors = BFS.Monitor.GetMonitorCountEnabledNoSplits();
// If there are 2, enable the titlebar buttons
if (numberOfMonitors == 2)
{
if (!TitleBarButtonsEnabled())
BFS.DisplayFusion.RunFunction("Toggle TitleBar Buttons");
}
// If there's only 1, disable the titlebar buttons
else if (numberOfMonitors == 1)
{
if (TitleBarButtonsEnabled())
BFS.DisplayFusion.RunFunction("Toggle TitleBar Buttons");
}
}
private static bool TitleBarButtonsEnabled()
{
// Check the registry to see if titlebar buttons are enabled, and return a true or false
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Binary Fortress Software\\DisplayFusion"))
{
if (key != null)
{
Object TitleBarButtonsEnabledValue = key.GetValue("TitleBarButtonsEnabled");
if (TitleBarButtonsEnabledValue.ToString() == "1")
return true;
else
return false;
}
else
{
return false;
}
}
}
}