mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
594a62132f |
@@ -479,7 +479,7 @@ public partial class MainWindow
|
||||
_currentDesktopSurfaceIndex = target;
|
||||
BeginDesktopPageContextSettle(previousIndex, target);
|
||||
ApplyDesktopSurfaceOffset();
|
||||
PersistSettings();
|
||||
SchedulePersistSettings(delayMs: Math.Max(280, (int)FluttermotionToken.Page.TotalMilliseconds + 80));
|
||||
}
|
||||
|
||||
private bool CanSwipeDesktopSurface()
|
||||
|
||||
@@ -32,6 +32,11 @@ public partial class MainWindow
|
||||
{
|
||||
_ = sender;
|
||||
|
||||
if (_suppressOwnSettingsReloadCount > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Scope == SettingsScope.App && e.ChangedKeys is { Count: > 0 })
|
||||
{
|
||||
var changedKeys = e.ChangedKeys.ToArray();
|
||||
@@ -382,6 +387,7 @@ public partial class MainWindow
|
||||
|
||||
private void PersistSettings()
|
||||
{
|
||||
_persistSettingsRevision++;
|
||||
if (_suppressSettingsPersistence)
|
||||
{
|
||||
return;
|
||||
@@ -389,6 +395,8 @@ public partial class MainWindow
|
||||
|
||||
try
|
||||
{
|
||||
// Saving our own state should not trigger a full external reload cycle.
|
||||
_suppressOwnSettingsReloadCount++;
|
||||
_settingsService.SaveSnapshot(SettingsScope.App, BuildAppSettingsSnapshot());
|
||||
_componentLayoutStore.SaveLayout(BuildDesktopLayoutSettingsSnapshot());
|
||||
_settingsService.SaveSnapshot(SettingsScope.Launcher, BuildLauncherSettingsSnapshot());
|
||||
@@ -397,11 +405,29 @@ public partial class MainWindow
|
||||
{
|
||||
AppLogger.Warn("SettingsRuntime", "Failed to persist settings.", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (_suppressOwnSettingsReloadCount > 0)
|
||||
{
|
||||
_suppressOwnSettingsReloadCount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SchedulePersistSettings(int delayMs = 200)
|
||||
{
|
||||
DispatcherTimer.RunOnce(PersistSettings, TimeSpan.FromMilliseconds(Math.Max(0, delayMs)));
|
||||
var revision = ++_persistSettingsRevision;
|
||||
DispatcherTimer.RunOnce(
|
||||
() =>
|
||||
{
|
||||
if (revision != _persistSettingsRevision)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PersistSettings();
|
||||
},
|
||||
TimeSpan.FromMilliseconds(Math.Max(0, delayMs)));
|
||||
}
|
||||
|
||||
internal void ReloadFromPersistedSettings()
|
||||
|
||||
@@ -145,7 +145,9 @@
|
||||
<TranslateTransform>
|
||||
<TranslateTransform.Transitions>
|
||||
<Transitions>
|
||||
<DoubleTransition Property="X" Duration="{StaticResource FluttermotionToken.Duration.Page}" />
|
||||
<DoubleTransition Property="X"
|
||||
Duration="{StaticResource FluttermotionToken.Duration.Page}"
|
||||
Easing="0.22,1,0.36,1" />
|
||||
</Transitions>
|
||||
</TranslateTransform.Transitions>
|
||||
</TranslateTransform>
|
||||
|
||||
@@ -153,6 +153,8 @@ public partial class MainWindow : Window, ISettingsWindowAnchorProvider
|
||||
private bool _isWeatherPreviewInProgress;
|
||||
private ClockDisplayFormat _clockDisplayFormat = ClockDisplayFormat.HourMinuteSecond;
|
||||
private bool _externalSettingsReloadPending;
|
||||
private int _persistSettingsRevision;
|
||||
private int _suppressOwnSettingsReloadCount;
|
||||
private double CurrentDesktopPitch => _currentDesktopCellSize + _currentDesktopCellGap;
|
||||
|
||||
public MainWindow()
|
||||
|
||||
Reference in New Issue
Block a user