fix: seed starting backdrop on every load, not just first launch
SeedStartingBackdrop() moved outside the Scenes.Count==0 guard so it fires on every startup. Existing layouts with a Background source are skipped (idempotent check).
This commit is contained in:
@@ -1354,8 +1354,8 @@ public class MainViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
foreach (var name in SceneCatalog.All)
|
foreach (var name in SceneCatalog.All)
|
||||||
AddScene(name);
|
AddScene(name);
|
||||||
SeedStartingBackdrop();
|
|
||||||
}
|
}
|
||||||
|
SeedStartingBackdrop();
|
||||||
|
|
||||||
// The live backdrop belongs to Live only; a pre-policy DB may have
|
// The live backdrop belongs to Live only; a pre-policy DB may have
|
||||||
// backdrops lingering in other scenes — drop them, then
|
// backdrops lingering in other scenes — drop them, then
|
||||||
@@ -1740,6 +1740,10 @@ public class MainViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var starting = Scenes.FirstOrDefault(s => SceneCatalog.Is(s.Name, "Starting"));
|
||||||
|
if (starting == null) return;
|
||||||
|
if (starting.Elements.OfType<Source>().Any(s => s.Type == SourceType.Background)) return;
|
||||||
|
|
||||||
var uri = new Uri("pack://application:,,,/Assets/starting-backdrop.jpg", UriKind.Absolute);
|
var uri = new Uri("pack://application:,,,/Assets/starting-backdrop.jpg", UriKind.Absolute);
|
||||||
using var stream = Application.GetResourceStream(uri)?.Stream;
|
using var stream = Application.GetResourceStream(uri)?.Stream;
|
||||||
if (stream == null) return;
|
if (stream == null) return;
|
||||||
@@ -1748,8 +1752,6 @@ public class MainViewModel : ViewModelBase
|
|||||||
var bytes = ms.ToArray();
|
var bytes = ms.ToArray();
|
||||||
var assetId = AddAsset(bytes);
|
var assetId = AddAsset(bytes);
|
||||||
if (assetId == null) return;
|
if (assetId == null) return;
|
||||||
var starting = Scenes.FirstOrDefault(s => SceneCatalog.Is(s.Name, "Starting"));
|
|
||||||
if (starting == null) return;
|
|
||||||
starting.Elements.Add(new Source
|
starting.Elements.Add(new Source
|
||||||
{
|
{
|
||||||
Name = "Background",
|
Name = "Background",
|
||||||
|
|||||||
Reference in New Issue
Block a user