Permalink
Browse files

add OnReset virtual to BaseCommand, and call it when page navigates

  • Loading branch information...
1 parent 35d9a5c commit 5109de522ab8d7e83bb6f74323abf1fa5d851be0 @purplecabbage purplecabbage committed Dec 4, 2012
@@ -100,5 +100,13 @@ public static BaseCommand CreateByServiceName(string service)
return commandMap[service];
}
+
+ public static void ResetAllCommands()
+ {
+ foreach (BaseCommand bc in commandMap.Values)
+ {
+ bc.OnReset();
+ }
+ }
}
}
@@ -103,6 +103,15 @@ public void DispatchCommandResult(PluginResult result)
}
}
+
+ /// <summary>
+ /// Occurs when the application is being deactivated.
+ /// </summary>
+ public virtual void OnReset()
+ {
+ }
+
+
/// <summary>
/// Occurs when the application is being deactivated.
/// </summary>
@@ -379,7 +379,8 @@ void GapBrowser_Navigating(object sender, NavigatingEventArgs e)
{
this.PageDidChange = true;
// Debug.WriteLine("GapBrowser_Navigating to :: " + e.Uri.ToString());
- // TODO: tell any running plugins to stop doing what they are doing.
+ this.nativeExecution.ResetAllCommands();
+
// TODO: check whitelist / blacklist
// NOTE: Navigation can be cancelled by setting : e.Cancel = true;
}
@@ -56,6 +56,11 @@ public static bool IsRunningOnEmulator()
return Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator;
}
+ public void ResetAllCommands()
+ {
+ CommandFactory.ResetAllCommands();
+ }
+
/// <summary>
/// Executes command and returns result back.
/// </summary>

0 comments on commit 5109de5

Please sign in to comment.