ShowAsync() 공개 메소드

Begins an asynchronous operation showing a dialog.
In some cases, such as when the dialog is closed by the system out of your control, your result can be an empty command. Returns either the command selected which destroyed the dialog, or an empty command. For example, a dialog hosted in a charms window will return an empty command if the charms window has been dismissed.
public ShowAsync ( ) : Task
리턴 Task
예제 #1
0
 private void App_CommandsRequested(InTheHand.UI.ApplicationSettings.SettingsPane sender, InTheHand.UI.ApplicationSettings.SettingsPaneCommandsRequestedEventArgs args)
 {
     args.Request.ApplicationCommands.Add(new InTheHand.UI.ApplicationSettings.SettingsCommand("test", "Testing", async(c) =>
     {
         InTheHand.UI.Popups.MessageDialog md = new InTheHand.UI.Popups.MessageDialog("Testing", "Woohoo title");
         await md.ShowAsync();
     }));
     args.Request.ApplicationCommands.Add(new InTheHand.UI.ApplicationSettings.SettingsCommand("system", "System", async(c) =>
     {
         InTheHand.UI.Popups.MessageDialog md = new InTheHand.UI.Popups.MessageDialog("Testing", "Woohoo title");
         md.Commands.Add(new InTheHand.UI.Popups.UICommand("one", (c2) => { System.Diagnostics.Debug.WriteLine("One"); }, "1"));
         md.Commands.Add(new InTheHand.UI.Popups.UICommand("two", (c2) => { System.Diagnostics.Debug.WriteLine("Two"); }, "2"));
         await md.ShowAsync();
     }));
 }
예제 #2
0
 private void App_CommandsRequested(InTheHand.UI.ApplicationSettings.SettingsPane sender, InTheHand.UI.ApplicationSettings.SettingsPaneCommandsRequestedEventArgs args)
 {
     args.Request.ApplicationCommands.Add(new InTheHand.UI.ApplicationSettings.SettingsCommand("test", "Testing", async (c) =>
     {
         InTheHand.UI.Popups.MessageDialog md = new InTheHand.UI.Popups.MessageDialog("Testing", "Woohoo title");
         await md.ShowAsync();
     }));
     args.Request.ApplicationCommands.Add(new InTheHand.UI.ApplicationSettings.SettingsCommand("system", "System", async (c) =>
     {
         InTheHand.UI.Popups.MessageDialog md = new InTheHand.UI.Popups.MessageDialog("Testing", "Woohoo title");
         md.Commands.Add(new InTheHand.UI.Popups.UICommand("one", (c2) => { System.Diagnostics.Debug.WriteLine("One"); }, "1"));
         md.Commands.Add(new InTheHand.UI.Popups.UICommand("two", (c2) => { System.Diagnostics.Debug.WriteLine("Two"); }, "2"));
         await md.ShowAsync();
     }));
 }
예제 #3
0
        /*internal static void CompletionHandler(IAsyncInfo operation, AsyncStatus status)
        {
            global::System.Diagnostics.Debug.WriteLine(operation.ErrorCode);
            
            Type storeType = Type.GetType("Windows.ApplicationModel.Calls.PhoneCallStore, Windows, ContentType=WindowsRuntime");
            Type template = typeof(Windows.Foundation.IAsyncOperation<>);
            Type genericType = template.MakeGenericType(storeType);
            var nativeStore = genericType.GetRuntimeMethod("GetResults", new Type[0]).Invoke(operation, new object[0]);
        }
*/

    /// <summary>
    /// Launches the built-in phone call UI with the specified phone number and display name.
    /// </summary>
    /// <param name="phoneNumber">A phone number.
    /// This should be in international format e.g. +12345678901</param>
    /// <param name="displayName">A display name.</param>
    public static void ShowPhoneCallUI(string phoneNumber, string displayName)
        {
#if __ANDROID__
            string action = Intent.ActionDial; //promptUser ? Intent.ActionDial : Intent.ActionCall;
            Intent callIntent = new Intent(action, Android.Net.Uri.FromParts("tel", CleanPhoneNumber(phoneNumber), null));
            callIntent.AddFlags(ActivityFlags.ClearWhenTaskReset);
            Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity.StartActivity(callIntent);
            //Platform.Android.ContextManager.Context.StartActivity(callIntent);
#elif __IOS__
            if (UIKit.UIDevice.CurrentDevice.Model != "iPhone")
            {
                UIKit.UIAlertView av = new UIKit.UIAlertView("Phone", "Dial " + phoneNumber, null, "Done");
                av.Show();
            }
            else
            {
                global::Foundation.NSUrl url = new global::Foundation.NSUrl("telprompt:" + CleanPhoneNumber(phoneNumber));        
                UIKit.UIApplication.SharedApplication.OpenUrl(url);
            } 
#elif WINDOWS_UWP || WINDOWS_PHONE_APP
#if WINDOWS_UWP
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.ApplicationModel.Calls.PhoneCallManager"))
            {
#endif
                Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(phoneNumber, displayName);
#if WINDOWS_UWP
            }
            else
            {
                Windows.System.Launcher.LaunchUriAsync(new Uri("tel:" + phoneNumber));
            }
#endif
#elif WINDOWS_APP || WIN32
            MessageDialog prompt = new MessageDialog(string.Format("Dial {0} at {1}?", displayName, phoneNumber), "Phone");
            prompt.Commands.Add(new UICommand("Call", async (c) =>
                {
                        // Windows may prompt the user for an app e.g. Skype, Lync etc
                        await Launcher.LaunchUriAsync(new Uri("tel:" + CleanPhoneNumber(phoneNumber)));
                }));
            prompt.Commands.Add(new UICommand("Cancel", null));
            prompt.ShowAsync();

#elif WINDOWS_PHONE
            PhoneCallTask pct = new PhoneCallTask();
            pct.PhoneNumber = phoneNumber;
            pct.DisplayName = displayName;
            pct.Show();
#else
            throw new PlatformNotSupportedException();
#endif
        }