[WIP] TaskBar changes

This commit is contained in:
Terry MacDonald 2022-02-02 11:44:13 +13:00
parent c9a349125d
commit a13aa60258
4 changed files with 17 additions and 13 deletions

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information
[assembly: AssemblyVersion("2.2.0.157")]
[assembly: AssemblyFileVersion("2.2.0.157")]
[assembly: AssemblyVersion("2.2.0.159")]
[assembly: AssemblyFileVersion("2.2.0.159")]
[assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)]

View File

@ -146,7 +146,7 @@ namespace DisplayMagician.UIForms
WINDOWS_DISPLAY_CONFIG winConfig = Profile.WindowsDisplayConfig;
// Reset the taskbar layout binary to the original one we stored when the profile was made
winConfig.TaskBarLayout = new List<TaskBarStuckRectangle>(winConfig.OriginalTaskBarLayout);
//winConfig.TaskBarLayout = new List<TaskBarStuckRectangle>(winConfig.OriginalTaskBarLayout);
if (rb_default_taskbar.Checked)
{
winConfig.TaskBarForcedEdge = TaskBarForcedEdge.None;

View File

@ -100,16 +100,18 @@ namespace DisplayMagicianShared.Windows
MainScreen = false;
DevicePath = devicePath;
Binary = binary;
OriginalBinary = new byte[binary.Length];
binary.CopyTo(OriginalBinary, 0);
Version = version;
// Extract the values from the binary byte field
PopulateFieldsFromBinary();
SharedLogger.logger.Trace($"WinLibrary/GetWindowsDisplayConfig: The taskbar for {DevicePath} is against the {Edge} edge, is positioned at ({Location.X},{Location.Y}) and is {Location.Width}x{Location.Height} in size.");
SharedLogger.logger.Trace($"TaskBarStuckRectangle/TaskBarStuckRectangle: The taskbar for {DevicePath} is against the {Edge} edge, is positioned at ({Location.X},{Location.Y}) and is {Location.Width}x{Location.Height} in size.");
}
else
{
SharedLogger.logger.Trace($"WinLibrary/GetWindowsDisplayConfig: Unable to get the TaskBarStuckRectangle binary settings from {devicePath} screen.");
SharedLogger.logger.Trace($"TaskBarStuckRectangle/TaskBarStuckRectangle: Unable to get the TaskBarStuckRectangle binary settings from {devicePath} screen.");
}
}
}
@ -156,16 +158,18 @@ namespace DisplayMagicianShared.Windows
MainScreen = true;
DevicePath = devicePath;
Binary = binary;
OriginalBinary = new byte[binary.Length];
binary.CopyTo(OriginalBinary, 0);
Version = version;
// Extract the values from the binary byte field
PopulateFieldsFromBinary();
SharedLogger.logger.Trace($"WinLibrary/GetWindowsDisplayConfig: The taskbar for {DevicePath} is against the {Edge} edge, is positioned at ({Location.X},{Location.Y}) and is {Location.Width}x{Location.Height} in size.");
SharedLogger.logger.Trace($"TaskBarStuckRectangle/TaskBarStuckRectangle: The taskbar for {DevicePath} is against the {Edge} edge, is positioned at ({Location.X},{Location.Y}) and is {Location.Width}x{Location.Height} in size.");
}
else
{
SharedLogger.logger.Trace($"WinLibrary/GetWindowsDisplayConfig: Unable to get the TaskBarStuckRectangle binary settings from {devicePath} screen.");
SharedLogger.logger.Trace($"TaskBarStuckRectangle/TaskBarStuckRectangle: Unable to get the TaskBarStuckRectangle binary settings from {devicePath} screen.");
}
}
}
@ -603,12 +607,12 @@ namespace DisplayMagicianShared.Windows
RegistryKeyPermissionCheck.ReadWriteSubTree))
{
key.SetValue(DevicePath, Binary);
SharedLogger.logger.Trace($"TaskBarStuckRectangle/Apply: Successfully applied TaskBarStuckRectangle registry settings for the {DevicePath} Screen in {address}!");
SharedLogger.logger.Trace($"TaskBarStuckRectangle/WriteToRegistry: Successfully applied TaskBarStuckRectangle registry settings for the {DevicePath} Screen in {address}!");
}
}
catch (Exception ex)
{
SharedLogger.logger.Error(ex, $"TaskBarStuckRectangle/GetCurrent: Unable to set the {DevicePath} TaskBarStuckRectangle registry settings in {address} due to an exception!");
SharedLogger.logger.Error(ex, $"TaskBarStuckRectangle/WriteToRegistry: Unable to set the {DevicePath} TaskBarStuckRectangle registry settings in {address} due to an exception!");
}
}

View File

@ -56,7 +56,7 @@ namespace DisplayMagicianShared.Windows
public List<ADVANCED_HDR_INFO_PER_PATH> DisplayHDRStates;
public Dictionary<string, GDI_DISPLAY_SETTING> GdiDisplaySettings;
public List<TaskBarStuckRectangle> TaskBarLayout;
public List<TaskBarStuckRectangle> OriginalTaskBarLayout;
//public List<TaskBarStuckRectangle> OriginalTaskBarLayout;
public TaskBarForcedEdge TaskBarForcedEdge;
public TaskBarSettings TaskBarSettings;
@ -187,7 +187,7 @@ namespace DisplayMagicianShared.Windows
myDefaultConfig.DisplaySources = new Dictionary<string, List<uint>>();
myDefaultConfig.GdiDisplaySettings = new Dictionary<string, GDI_DISPLAY_SETTING>();
myDefaultConfig.TaskBarLayout = new List<TaskBarStuckRectangle>();
myDefaultConfig.OriginalTaskBarLayout = new List<TaskBarStuckRectangle>();
//myDefaultConfig.OriginalTaskBarLayout = new List<TaskBarStuckRectangle>();
myDefaultConfig.TaskBarSettings = new TaskBarSettings();
myDefaultConfig.TaskBarForcedEdge = TaskBarForcedEdge.None;
myDefaultConfig.IsCloned = false;
@ -653,7 +653,7 @@ namespace DisplayMagicianShared.Windows
windowsDisplayConfig.DisplayConfigModes = modes;
windowsDisplayConfig.GdiDisplaySettings = GetGdiDisplaySettings();
windowsDisplayConfig.TaskBarLayout = taskBarStuckRectangles;
windowsDisplayConfig.OriginalTaskBarLayout = new List<TaskBarStuckRectangle>(taskBarStuckRectangles);
//windowsDisplayConfig.OriginalTaskBarLayout = new List<TaskBarStuckRectangle>(taskBarStuckRectangles);
windowsDisplayConfig.TaskBarSettings = taskBarSettings;
return windowsDisplayConfig;
@ -1401,7 +1401,7 @@ namespace DisplayMagicianShared.Windows
}
else
{
SharedLogger.logger.Error($"WinLibrary/GetCurrent: Unable to set the {tbsr.DevicePath} TaskBarStuckRectangle registry settings as the version isn't v2 or v3!");
SharedLogger.logger.Error($"WinLibrary/SetActiveConfig: Unable to set the {tbsr.DevicePath} TaskBarStuckRectangle registry settings as the version isn't v2 or v3!");
}
}