public static void ShowMarketplace(MGXna_Framework.PlayerIndex player) { #if WINDOWS_PHONE // Call the Microsoft implementation of ShowMarketplace using an alias. MsXna_Guide.ShowMarketplace((MsXna_PlayerIndex)player); #elif WINDOWS_STOREAPP _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var uri = new Uri(@"ms-windows-store:PDP?PFN=" + Package.Current.Id.FamilyName); Launcher.LaunchUriAsync(uri).AsTask<bool>().Wait(); }).AsTask(); #endif }
internal static void Initialise(MGXna_Framework.Game game) { #if !DIRECTX MonoGameGamerServicesHelper.Initialise(game); #endif }
public static IAsyncResult BeginShowMessageBox( MGXna_Framework.PlayerIndex player, string title, string text, IEnumerable<string> buttons, int focusButton, MessageBoxIcon icon, AsyncCallback callback, Object state ) { #if WINDOWS_PHONE // Call the Microsoft implementation of BeginShowMessageBox using an alias. return MsXna_Guide.BeginShowMessageBox( (MsXna_PlayerIndex)player, title, text, buttons, focusButton, (MsXna_MessageBoxIcon)icon, callback, state); #elif !WINDOWS_UAP // TODO: GuideAlreadyVisibleException if (IsVisible) throw new Exception("The function cannot be completed at this time: the Guide UI is already active. Wait until Guide.IsVisible is false before issuing this call."); if (player != PlayerIndex.One) throw new ArgumentOutOfRangeException("player", "Specified argument was out of the range of valid values."); if (title == null) throw new ArgumentNullException("title", "This string cannot be null or empty, and must be less than 256 characters long."); if (text == null) throw new ArgumentNullException("text", "This string cannot be null or empty, and must be less than 256 characters long."); if (buttons == null) throw new ArgumentNullException("buttons", "Value can not be null."); ShowMessageBoxDelegate smb = ShowMessageBox; return smb.BeginInvoke(title, text, buttons, focusButton, icon, callback, smb); #else var tcs = new TaskCompletionSource<int?>(state); var task = Task.Run<int?>(() => ShowMessageBox(title, text, buttons, focusButton, icon)); task.ContinueWith(t => { // Copy the task result into the returned task. if (t.IsFaulted) tcs.TrySetException(t.Exception.InnerExceptions); else if (t.IsCanceled) tcs.TrySetCanceled(); else tcs.TrySetResult(t.Result); // Invoke the user callback if necessary. if (callback != null) callback(tcs.Task); }); return tcs.Task; #endif }
public static IAsyncResult BeginShowKeyboardInput ( MGXna_Framework.PlayerIndex player, string title, string description, string defaultText, AsyncCallback callback, Object state, bool usePasswordMode) { #if WINDOWS_PHONE // Call the Microsoft implementation of BeginShowKeyboardInput using an alias. return MsXna_Guide.BeginShowKeyboardInput((MsXna_PlayerIndex)player, title, description, defaultText, callback, state, usePasswordMode); #elif !WINDOWS_UAP ShowKeyboardInputDelegate ski = ShowKeyboardInput; return ski.BeginInvoke(player, title, description, defaultText, usePasswordMode, callback, ski); #else throw new NotImplementedException(); #endif }
public static IAsyncResult BeginShowKeyboardInput ( MGXna_Framework.PlayerIndex player, string title, string description, string defaultText, AsyncCallback callback, Object state) { #if WINDOWS_PHONE // Call the Microsoft implementation of BeginShowKeyboardInput using an alias. return MsXna_Guide.BeginShowKeyboardInput((MsXna_PlayerIndex)player, title, description, defaultText, callback, state); #else return BeginShowKeyboardInput(player, title, description, defaultText, callback, state, false ); #endif }
private static string ShowKeyboardInput( MGXna_Framework.PlayerIndex player, string title, string description, string defaultText, bool usePasswordMode) { #if WINDOWS_STOREAPP // If SwapChainBackgroundPanel is null then we are running the non-XAML template if (Game.Instance.graphicsDeviceManager.SwapChainBackgroundPanel == null) { throw new NotImplementedException("This method works only when using the XAML template."); } Task<string> result = null; _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var inputDialog = new InputDialog(); result = inputDialog.ShowAsync(title, description, defaultText, usePasswordMode); }).AsTask().Wait(); result.Wait(); return result.Result; #else throw new NotImplementedException(); #endif }
public static IAsyncResult BeginShowMessageBox( MGXna_Framework.PlayerIndex player, string title, string text, IEnumerable<string> buttons, int focusButton, MessageBoxIcon icon, AsyncCallback callback, Object state ) { #if WINDOWS_PHONE // Call the Microsoft implementation of BeginShowMessageBox using an alias. return MsXna_Guide.BeginShowMessageBox( (MsXna_PlayerIndex)player, title, text, buttons, focusButton, (MsXna_MessageBoxIcon)icon, callback, state); #else // TODO: GuideAlreadyVisibleException if (IsVisible) throw new Exception("The function cannot be completed at this time: the Guide UI is already active. Wait until Guide.IsVisible is false before issuing this call."); if (player != PlayerIndex.One) throw new ArgumentOutOfRangeException("player", "Specified argument was out of the range of valid values."); if (title == null) throw new ArgumentNullException("title", "This string cannot be null or empty, and must be less than 256 characters long."); if (text == null) throw new ArgumentNullException("text", "This string cannot be null or empty, and must be less than 256 characters long."); if (buttons == null) throw new ArgumentNullException("buttons", "Value can not be null."); ShowMessageBoxDelegate smb = ShowMessageBox; return smb.BeginInvoke(title, text, buttons, focusButton, icon, callback, smb); #endif }