Permalink
Browse files

Merge pull request #1258 from azchohfi/develop3d

Fixes PreviousExecutionState for WindowsStoreXaml template.
  • Loading branch information...
tomspilman committed Feb 19, 2013
2 parents 58a37cd + c0dd813 commit 1adebbd78e009a86b8bba241222a3467de71b2a1
@@ -434,21 +434,21 @@ public static StorageDevice EndShowSelector (IAsyncResult result)
{
if (!result.IsCompleted) {
- // Wait for the WaitHandle to become signaled.
+ // Wait for the WaitHandle to become signaled.
try {
result.AsyncWaitHandle.WaitOne ();
} finally {
#if !WINRT
result.AsyncWaitHandle.Close ();
#endif
- }
+ }
}
#if WINRT
var del = showDelegate;
showDelegate = null;
#else
// Retrieve the delegate.
- AsyncResult asyncResult = (AsyncResult)result;
+ AsyncResult asyncResult = (AsyncResult)result;
var del = asyncResult.AsyncDelegate;
#endif
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework;
using Windows.UI.Core;
using Windows.UI.Xaml.Controls;
+using Windows.ApplicationModel.Activation;
namespace MonoGame.Framework
{
@@ -48,5 +49,19 @@ static public T Create(string launchParameters, CoreWindow window, SwapChainBack
// Return the created game object.
return game;
}
+
+ /// <summary>
+ /// Preserves the previous execution state in MetroGamePlatform and returns the constructed game object initialized with the given window.
+ /// </summary>
+ /// <param name="launchParameters">The command line arguments from launch.</param>
+ /// <param name="window">The core window object.</param>
+ /// <param name="swapPanel">The XAML swapchain panel to which we render the scene and recieve input events.</param>
+ /// <returns></returns>
+ static public T Create(LaunchActivatedEventArgs args, CoreWindow window, SwapChainBackgroundPanel swapPanel)
+ {
+ MetroGamePlatform.PreviousExecutionState = args.PreviousExecutionState;
+
+ return Create(args.Arguments, window, swapPanel);
+ }
}
-}
+}
@@ -36,7 +36,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs args)
if (gamePage == null)
{
// Create a main GamePage
- gamePage = new GamePage(args.Arguments);
+ gamePage = new GamePage(args);
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
@@ -1,6 +1,7 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using MonoGame.Framework;
+using Windows.ApplicationModel.Activation;
namespace $safeprojectname$
@@ -12,12 +13,12 @@ public sealed partial class GamePage : SwapChainBackgroundPanel
{
readonly Game1 _game;
- public GamePage(string launchArguments)
+ public GamePage(LaunchActivatedEventArgs args)
{
this.InitializeComponent();
// Create the game.
- _game = XamlGame<Game1>.Create(launchArguments, Window.Current.CoreWindow, this);
+ _game = XamlGame<Game1>.Create(args, Window.Current.CoreWindow, this);
}
}
}

0 comments on commit 1adebbd

Please sign in to comment.