Represents a dialog.
The dialog has a command bar that can support up to three commands. If you don't specify any commands, then a default command is added to close the dialog.

The dialog dims the screen behind it and blocks touch events from passing to the app's canvas until the user responds.

Message dialogs should be used sparingly, and only for critical messages or simple questions that must block the user's flow.

PlatformVersion supported AndroidAndroid 4.4 and later iOSiOS 9.0 and later macOSOS X 10.7 and later tvOStvOS 9.0 and later Windows UWPWindows 10 Windows StoreWindows 8.1 or later Windows Phone StoreWindows Phone 8.1 or later Windows Phone SilverlightWindows Phone 8.0 or later Windows (Desktop Apps)Windows Vista or later
예제 #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
        }