diff --git a/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.Shared/Controls/Popups/ToastManager.cs b/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.Shared/Controls/Popups/ToastManager.cs
index 7819b2df5..62d052288 100644
--- a/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.Shared/Controls/Popups/ToastManager.cs
+++ b/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.Shared/Controls/Popups/ToastManager.cs
@@ -27,6 +27,7 @@ class ToastInfo
///
/// Object responsible for manging the lifecycle of toasts. This can be used to perform fire-and-forget showing of Toast objects.
+ /// Internally this creates a Toast object using the FlatRedBall.Forms Toast control.
///
public static class ToastManager
{
@@ -39,8 +40,6 @@ public static class ToastManager
public static Layer DefaultToastLayer { get; set; }
static IList liveToasts;
static bool hasBeenStarted;
-#if !UWP
- // threading works differently in UWP. do we care? Is UWP going to live?
static void Start()
{
@@ -59,13 +58,18 @@ static void Start()
thread.Start();
}
}
-#endif
+ ///
+ /// Queues a toast to be shown for the given duration. This method can be called from any thread.
+ /// If a toast is currently shown, then this message is queued and will be shown on the next toast.
+ ///
+ /// The message to display
+ /// The layer for the Toast instance.
+ /// The number of seconds to display the toast.
public static void Show(string message, Layer frbLayer = null, double durationInSeconds = 2.0)
{
if(!hasBeenStarted)
{
-#if !UWP
if(FlatRedBallServices.IsThreadPrimary())
{
Start();
@@ -74,7 +78,6 @@ public static void Show(string message, Layer frbLayer = null, double durationIn
{
Instructions.InstructionManager.AddSafe(Start);
}
-#endif
}
var toastInfo = new ToastInfo { Message = message, FrbLayer = frbLayer, DurationInSeconds = durationInSeconds};
@@ -82,6 +85,9 @@ public static void Show(string message, Layer frbLayer = null, double durationIn
toastMessages.Add(toastInfo);
}
+ ///
+ /// Removes all live toasts from all managers. This is called automatically when a Screen is destroyed.
+ ///
public static void DestroyLiveToasts()
{
int numberOfToastsToClean = liveToasts?.Count ?? 0;
diff --git a/FRBDK/Glue/GumPlugin/GumPlugin/Managers/EventExportManager.cs b/FRBDK/Glue/GumPlugin/GumPlugin/Managers/EventExportManager.cs
index 771db8a71..99de0f925 100644
--- a/FRBDK/Glue/GumPlugin/GumPlugin/Managers/EventExportManager.cs
+++ b/FRBDK/Glue/GumPlugin/GumPlugin/Managers/EventExportManager.cs
@@ -221,26 +221,29 @@ await TaskManager.Self.AddAsync(async () =>
{
if(oldCodeFileName.Exists())
{
- System.IO.File.Copy(oldCodeFileName.FullPath, newCodeFileName.FullPath, overwrite: true);
+ GlueCommands.Self.TryMultipleTimes(() =>
+ {
+ System.IO.File.Copy(oldCodeFileName.FullPath, newCodeFileName.FullPath, overwrite: true);
- var contents = System.IO.File.ReadAllText(newCodeFileName.FullPath);
- RefactorManager.Self.RenameClassInCode(
- oldCodeFileName.NoPathNoExtension,
- newCodeFileName.NoPathNoExtension,
- ref contents);
+ var contents = System.IO.File.ReadAllText(newCodeFileName.FullPath);
+ RefactorManager.Self.RenameClassInCode(
+ oldCodeFileName.NoPathNoExtension,
+ newCodeFileName.NoPathNoExtension,
+ ref contents);
- var oldNamespace = GueDerivingClassCodeGenerator.Self.GetFullRuntimeNamespaceFor(false, exportedEvent.OldName);
- var newNamespace = GueDerivingClassCodeGenerator.Self.GetFullRuntimeNamespaceFor(false, exportedEvent.NewName);
+ var oldNamespace = GueDerivingClassCodeGenerator.Self.GetFullRuntimeNamespaceFor(false, exportedEvent.OldName);
+ var newNamespace = GueDerivingClassCodeGenerator.Self.GetFullRuntimeNamespaceFor(false, exportedEvent.NewName);
- if(oldNamespace != newNamespace)
- {
- RefactorManager.Self.RenameNamespaceInCode(
- oldNamespace,
- newNamespace,
- ref contents);
- }
+ if (oldNamespace != newNamespace)
+ {
+ RefactorManager.Self.RenameNamespaceInCode(
+ oldNamespace,
+ newNamespace,
+ ref contents);
+ }
- System.IO.File.WriteAllText(newCodeFileName.FullPath, contents);
+ System.IO.File.WriteAllText(newCodeFileName.FullPath, contents);
+ });
await GlueCommands.Self.ProjectCommands.TryAddCodeFileToProjectAsync(newCodeFileName, saveOnAdd:true);
}