private static Task<string> PlatformShow(string title, string description, string defaultText, bool usePasswordMode)
        {
            tcs = new TaskCompletionSource<string>();
            dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                async () =>
                {
                    inputDialog = new InputDialog();
                    var result = await inputDialog.ShowAsync(title, description, defaultText, usePasswordMode);

                    if (!tcs.Task.IsCompleted)
                        tcs.SetResult(result);
                });

            return tcs.Task;
        }
示例#2
0
        private static Task <string> PlatformShow(string title, string description, string defaultText, bool usePasswordMode)
        {
            tcs = new TaskCompletionSource <string>();
            dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                async() =>
            {
                inputDialog = new InputDialog();
                var result  = await inputDialog.ShowAsync(title, description, defaultText, usePasswordMode);

                if (!tcs.Task.IsCompleted)
                {
                    tcs.SetResult(result);
                }
            });

            return(tcs.Task);
        }
示例#3
0
		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
		}