Respect isDraggable by toggling WindowChrome caption drag

This commit is contained in:
Meik
2026-03-05 12:52:33 +01:00
parent 63f1ffc57d
commit 44d1d63349
2 changed files with 15 additions and 4 deletions

View File

@@ -67,6 +67,7 @@ namespace C4IT_CustomerPanel
private DispatcherTimer _adHocTimer; private DispatcherTimer _adHocTimer;
private DispatcherTimer _regularTimer; private DispatcherTimer _regularTimer;
private DispatcherTimer _checkServerConnectionTimer; private DispatcherTimer _checkServerConnectionTimer;
private const double HeaderCaptionHeight = 72d;
private bool _initialTimerInvocationDone = false; private bool _initialTimerInvocationDone = false;
private bool _manualRefreshInProgress = false; private bool _manualRefreshInProgress = false;
private TimeSpan _lastTicketInterval; private TimeSpan _lastTicketInterval;
@@ -506,10 +507,7 @@ namespace C4IT_CustomerPanel
private void SetAppearance(bool firstStart) private void SetAppearance(bool firstStart)
{ {
if (!ConfigSettings.GetConfig()._isDraggable) ApplyWindowDraggableState();
{
ResetLocation();
}
System.Collections.ObjectModel.Collection<ResourceDictionary> themes = new System.Collections.ObjectModel.Collection<ResourceDictionary>(); System.Collections.ObjectModel.Collection<ResourceDictionary> themes = new System.Collections.ObjectModel.Collection<ResourceDictionary>();
if (ConfigSettings.GetConfig()._iconColor != 0) if (ConfigSettings.GetConfig()._iconColor != 0)
@@ -559,6 +557,18 @@ namespace C4IT_CustomerPanel
} }
} }
private void ApplyWindowDraggableState()
{
bool draggable = ConfigSettings?.GetConfig()?._isDraggable ?? true;
if (!draggable)
ResetLocation();
WindowChrome chrome = WindowChrome.GetWindowChrome(this);
if (chrome != null)
chrome.CaptionHeight = draggable ? HeaderCaptionHeight : 0d;
}
public void ResetLocation() public void ResetLocation()
{ {
var CM = MethodBase.GetCurrentMethod(); var CM = MethodBase.GetCurrentMethod();

View File

@@ -1384,6 +1384,7 @@ namespace C4IT_CustomerPanel.libs
cpConfig = JsonConvert.DeserializeObject<CustomerPanelConfig>(json); cpConfig = JsonConvert.DeserializeObject<CustomerPanelConfig>(json);
cpConfig._encryptedApiToken = CustomerPanelSecurePassword.Instance.Decode(cpConfig._encryptedApiToken); cpConfig._encryptedApiToken = CustomerPanelSecurePassword.Instance.Decode(cpConfig._encryptedApiToken);
LogEntry($"[Config API] _isDraggable={cpConfig?._isDraggable}", LogLevels.Debug);
if (cpConfig?._uiColors != null && cpConfig._uiColors.TryGetValue("activeButtonColor", out string apiActiveColor) && !string.IsNullOrWhiteSpace(apiActiveColor)) if (cpConfig?._uiColors != null && cpConfig._uiColors.TryGetValue("activeButtonColor", out string apiActiveColor) && !string.IsNullOrWhiteSpace(apiActiveColor))
LogEntry($"[Config API] activeButtonColor={apiActiveColor}", LogLevels.Debug); LogEntry($"[Config API] activeButtonColor={apiActiveColor}", LogLevels.Debug);