当前位置: 首页>>代码示例>>C#>>正文


C# AlertDialog.Builder.Dismiss方法代码示例

本文整理汇总了C#中Android.App.AlertDialog.Builder.Dismiss方法的典型用法代码示例。如果您正苦于以下问题:C# AlertDialog.Builder.Dismiss方法的具体用法?C# AlertDialog.Builder.Dismiss怎么用?C# AlertDialog.Builder.Dismiss使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.App.AlertDialog.Builder的用法示例。


在下文中一共展示了AlertDialog.Builder.Dismiss方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowErrorDialog

 protected void ShowErrorDialog(Exception ex)
 {
     RunOnUiThread(() =>
     {
         AlertDialog ad = new AlertDialog.Builder(this).Create();
         ad.SetCancelable(false);
         ad.SetMessage(string.Format("An error has occured: {0}", ex));
         ad.SetButton("OK", (sender, args) => ad.Dismiss());
         ad.Show();
     });
 }
开发者ID:pascalfr,项目名称:MPfm,代码行数:11,代码来源:BasePreferenceActivity.cs

示例2: ShowMsgBox_OK

        public static void ShowMsgBox_OK(Activity currentActivity, string title, string msg)
        {
            AlertDialog alertDialog = new AlertDialog.Builder(currentActivity).Create();

            alertDialog.SetTitle(title);
            alertDialog.SetMessage(msg);

            alertDialog.SetButton((int)DialogButtonType.Neutral, "OK",
                (object sender, DialogClickEventArgs e) => {
                    alertDialog.Dismiss();
                });
            alertDialog.Show();
        }
开发者ID:sagisprojects,项目名称:Virtual-Guitar-Teacher,代码行数:13,代码来源:Generic.cs

示例3: RenderResults

 private void RenderResults(List<Product> products)
 {
     if (products == null || products.Count == 0)
     {
         _progressDialog.Dismiss ();
         var alertDialog = new AlertDialog.Builder(this).Create();
         alertDialog.SetTitle("Search Results");
         alertDialog.SetMessage("We were unable to find any matches in the catalog.");
         alertDialog.SetIcon(Resource.Drawable.icon);
         alertDialog.SetButton("OK", (o, e) =>
         {
             alertDialog.Dismiss();
             Finish();
         });
         alertDialog.Show();
     }
     else
     {
         SetContentView (Resource.Layout.SearchResults);
         ListView.SetBackgroundColor (G.Color.Transparent);
         ListAdapter = new ProductListAdapter(this, products);
         _progressDialog.Dismiss ();
     }
 }
开发者ID:jheerman,项目名称:Satchmobile-Demo,代码行数:24,代码来源:SearchActivity.cs

示例4: SyncCompleted

 public void SyncCompleted()
 {
     RunOnUiThread(() => {
         _lblTitle.Text = "Sync completed";
         AlertDialog ad = new AlertDialog.Builder(this).Create();
         ad.SetCancelable(false);
         ad.SetMessage("Sync has completed successfully.");
         ad.SetButton("OK", (sender, args) => {
             ad.Dismiss();
             Finish();
         });
         ad.Show();
     });
 }
开发者ID:pascalfr,项目名称:MPfm,代码行数:14,代码来源:SyncDownloadActivity.cs

示例5: ShowMessage

 public void ShowMessage(string title, string message)
 {
     RunOnUiThread(() => {
         AlertDialog ad = new AlertDialog.Builder(this).Create();
         ad.SetCancelable(false);
         ad.SetTitle(title);
         ad.SetMessage(message);
         ad.SetButton("OK", (sender, args) => ad.Dismiss());
         ad.Show();
     });
 }
开发者ID:pascalfr,项目名称:MPfm,代码行数:11,代码来源:EqualizerPresetDetailsActivity.cs

示例6: SyncEmptyError

 public void SyncEmptyError(Exception ex)
 {
     RunOnUiThread(() => {
         AlertDialog ad = new AlertDialog.Builder(this).Create();
         ad.SetCancelable(false);
         ad.SetTitle("Error");
         ad.SetMessage(ex.Message);
         ad.SetButton("OK", (sender, args) => ad.Dismiss());
         ad.Show();
     });
 }
开发者ID:pascalfr,项目名称:MPfm,代码行数:11,代码来源:SyncMenuActivity.cs

示例7: PromptForInputAsync

        public override void PromptForInputAsync(string prompt, bool startVoiceRecognizer, Action<string> callback)
        {
            new Thread(() =>
                {
                    string input = null;
                    ManualResetEvent dialogDismissWait = new ManualResetEvent(false);

                    GetMainActivityAsync(true, mainActivity => mainActivity.RunOnUiThread(() =>
                        {
                            EditText inputEdit = new EditText(mainActivity);

                            AlertDialog dialog = new AlertDialog.Builder(mainActivity)
                                                 .SetTitle("Sensus is requesting input...")
                                                 .SetMessage(prompt)
                                                 .SetView(inputEdit)
                                                 .SetPositiveButton("OK", (o, e) =>
                                                     {
                                                         input = inputEdit.Text;
                                                     })
                                                 .SetNegativeButton("Cancel", (o, e) => { })
                                                 .Create();

                            // for some reason, stopping the activity with the home button doesn't raise the alert dialog's dismiss
                            // event. so, we'll manually trap the activity stop and dismiss the dialog ourselves. this is important
                            // because the caller of this method might be blocking itself or others (e.g., other prompts) until
                            // the dialog is dismissed. if we don't trap the activity stop then those blocks could go on indefinitely.
                            EventHandler activityStoppedHandler = (o,e) =>
                                {
                                    dialog.Dismiss();
                                };

                            mainActivity.Stopped += activityStoppedHandler;

                            dialog.DismissEvent += (o,e) =>
                                {
                                    // we don't need the dismiss event anymore, since the dialog has closed
                                    mainActivity.Stopped -= activityStoppedHandler;

                                    dialogDismissWait.Set();
                                };

                            ManualResetEvent dialogShowWait = new ManualResetEvent(false);

                            dialog.ShowEvent += (o,e) =>
                                {
                                    dialogShowWait.Set();
                                };

                            // dismiss the keyguard when dialog appears
                            dialog.Window.AddFlags(global::Android.Views.WindowManagerFlags.DismissKeyguard);
                            dialog.Window.AddFlags(global::Android.Views.WindowManagerFlags.ShowWhenLocked);
                            dialog.Window.AddFlags(global::Android.Views.WindowManagerFlags.TurnScreenOn);
                            dialog.Window.SetSoftInputMode(global::Android.Views.SoftInput.StateAlwaysVisible);

                            // dim whatever is behind the dialog
                            dialog.Window.AddFlags(global::Android.Views.WindowManagerFlags.DimBehind);
                            dialog.Window.Attributes.DimAmount = 0.75f;

                            dialog.Show();

                            #region voice recognizer
                            if (startVoiceRecognizer)
                            {
                                new Thread(() =>
                                    {
                                        // wait for the dialog to be shown so it doesn't hide our speech recognizer activity
                                        dialogShowWait.WaitOne();

                                        // there's a slight race condition between the dialog showing and speech recognition showing. pause here to prevent the dialog from hiding the speech recognizer.
                                        Thread.Sleep(1000);

                                        Intent intent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
                                        intent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm);
                                        intent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1500);
                                        intent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500);
                                        intent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000);
                                        intent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);
                                        intent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default);
                                        intent.PutExtra(RecognizerIntent.ExtraPrompt, prompt);

                                        mainActivity.GetActivityResultAsync(intent, AndroidActivityResultRequestCode.RecognizeSpeech, result =>
                                            {
                                                if (result != null && result.Item1 == Result.Ok)
                                                {
                                                    IList<string> matches = result.Item2.GetStringArrayListExtra(RecognizerIntent.ExtraResults);
                                                    if (matches != null && matches.Count > 0)
                                                        mainActivity.RunOnUiThread(() =>
                                                            {
                                                                inputEdit.Text = matches[0];
                                                            });
                                                }
                                            });

                                    }).Start();
                            }
                            #endregion

                        }));

                    dialogDismissWait.WaitOne();
//.........这里部分代码省略.........
开发者ID:trishalaneeraj,项目名称:sensus,代码行数:101,代码来源:AndroidSensusServiceHelper.cs


注:本文中的Android.App.AlertDialog.Builder.Dismiss方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。