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