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


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

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


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

示例1: OnCreateDialog

        public override Dialog OnCreateDialog(Bundle bundle)
        {
            base.OnCreateDialog (bundle);

            catalogs = new CheckinShared.CatalogDB ();
            LayoutInflater inflater = Activity.LayoutInflater;
            View view = inflater.Inflate (Resource.Layout.AddCatalog, null);

            EditText textName = view.FindViewById<EditText> (Resource.Id.txtAgregarCatalogo);

            AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
            builder.SetTitle ("Crear catálogo");
            builder.SetView (view);
            builder.SetPositiveButton ("Crear", delegate (object sender, DialogClickEventArgs e) {
                Catalog catalog = new Catalog ();

                if (textName.Text.Length != 0)
                {
                    catalog.Name = textName.Text;
                    catalog.Quantity = 0;
                    catalog.UserId = AppHelper.GetCurrentUser(Activity).Id;
                    catalogs.Insert(catalog);

                    catalog.SaveToParse();

                    Console.WriteLine("ParentFragment: " + ParentFragment);

                    ((CatalogsFragment) ((MainActivity) Activity).CurrentFragment()).AddCatalog(catalog);
                }
            });
            builder.SetNegativeButton ("Salir", delegate (object sender, DialogClickEventArgs e) { });

            return builder.Create ();
        }
开发者ID:hpneo,项目名称:CheckinApp,代码行数:34,代码来源:AddCatalogDialogFragment.cs

示例2: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
            Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton);
            Button callButton = FindViewById<Button>(Resource.Id.CallButton);
            Button callHistoryButton = FindViewById<Button>(Resource.Id.CallHistoryButton);

            // "Call" を Disable にします
            callButton.Enabled = false;
            // 番号を変換するコードを追加します。
            string translatedNumber = string.Empty;
            translateButton.Click += (object sender, EventArgs e) =>
            {
                // ユーザーのアルファベットの電話番号を電話番号に変換します。
                translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);
                if (String.IsNullOrWhiteSpace(translatedNumber))
                {
                    callButton.Text = "Call";
                    callButton.Enabled = false;
                }
                else
                {
                    callButton.Text = "Call " + translatedNumber;
                    callButton.Enabled = true;
                }
            };

            callButton.Click += (object sender, EventArgs e) =>
            {
                // "Call" ボタンがクリックされたら電話番号へのダイヤルを試みます。
                var callDialog = new AlertDialog.Builder(this);
                callDialog.SetMessage("Call " + translatedNumber + "?");
                callDialog.SetNeutralButton("Call", delegate
                {
                    // 掛けた番号のリストに番号を追加します。
                    phoneNumbers.Add(translatedNumber);
                    // Call History ボタンを有効にします。
                    callHistoryButton.Enabled = true;
                    // 電話への intent を作成します。
                    var callIntent = new Intent(Intent.ActionCall);
                    callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
                    StartActivity(callIntent);
                });
                callDialog.SetNegativeButton("Cancel", delegate { });
                // アラートダイアログを表示し、ユーザーのレスポンスを待ちます。
                callDialog.Show();
            };

            callHistoryButton.Click += (sender, e) =>
            {
                var intent = new Intent(this, typeof(CallHistoryActivity));
                intent.PutStringArrayListExtra("phone_numbers", phoneNumbers);
                StartActivity(intent);
            };
        }
开发者ID:ytabuchi,项目名称:MSXamarinHOL,代码行数:60,代码来源:MainActivity.cs

示例3: DeleteConfirmAlert

 public void DeleteConfirmAlert(string failMessage, int position)
 {
     //build incorrect username/password alert and display when called
     AlertDialog.Builder alert = new AlertDialog.Builder(this);
     alert.SetTitle("Confirm Deletion");
     alert.SetMessage(failMessage);
     alert.SetNegativeButton("No", (senderAlert, args) =>
      {
          //do nothing, return to view
      });
     alert.SetPositiveButton("Yes", (senderAlert, args) =>
     {
         //delete appointment from database, return to view
         Core myCore = new Core(persistentData);
         List<string> myList = new List<string>();
         List<string> recieved = new List<string>();
         myList.Add("03");
         myList.Add(apptID[position]);
         recieved = myCore.messageHandler(myList);
         deleteAppointmentEntry(position);
     });
     RunOnUiThread(() =>
     {
         alert.Show();
     });
 }
开发者ID:josh7niels,项目名称:ssdi_team3,代码行数:26,代码来源:ViewAppointments.cs

示例4: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView ( Resource.Layout.Main );

            // Resources
            Button Button1 = FindViewById <Button> (Resource.Id.Button1);
            Button Button2 = FindViewById <Button> (Resource.Id.Button2);
            Button Button3 = FindViewById <Button> (Resource.Id.Button3);

            // Resource CallBacks
            Button1.Click += delegate {
                StartActivity ( typeof ( Game ) );
                Finish (); };

            Button2.Click += delegate {
                StartActivity ( typeof ( Instructions ) );
                Finish (); };

            Button3.Click += delegate {
                AlertDialog.Builder MessageBox = new AlertDialog.Builder ( this );
                MessageBox.SetNegativeButton ( "OK", delegate {} );
                MessageBox.SetMessage ("Xamarin Studio\n-Hussain Al-Homedawy.");
                MessageBox.Show (); };
        }
开发者ID:hussain-alhomedawy,项目名称:Tic-Tac-Toe-for-the-Android-OS,代码行数:27,代码来源:MainActivity.cs

示例5: Alert

        public static void Alert(Activity context, string title, string message, bool CancelButton, Action<Result> callback = null)
        {
            context.RunOnUiThread(() =>
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(context);
                builder.SetTitle(title);
                builder.SetMessage(message);

                if (callback != null)
                {
                    builder.SetPositiveButton("Ok", (sender, e) =>
                    {
                        callback(Result.Ok);
                    });

                    if (CancelButton)
                    {
                        builder.SetNegativeButton("Cancel", (sender, e) =>
                        {
                            callback(Result.Canceled);
                        });
                    }
                }
                else
                {
                    builder.SetPositiveButton("OK", (sender, e) => { });
                }

                builder.Show();
            });
        }
开发者ID:payinsights,项目名称:samples,代码行数:31,代码来源:Helpers.cs

示例6: GetInfo

 void GetInfo()
 {
     // создаем xml-документ
     XmlDocument xmlDocument = new XmlDocument ();
     // делаем запрос на получение имени пользователя
     WebRequest webRequest = WebRequest.Create ("https://api.vk.com/method/users.get.xml?&access_token=" + token);
     WebResponse webResponse = webRequest.GetResponse ();
     Stream stream = webResponse.GetResponseStream ();
     xmlDocument.Load (stream);
     string name =  xmlDocument.SelectSingleNode ("response/user/first_name").InnerText;
     // делаем запрос на проверку,
     webRequest = WebRequest.Create ("https://api.vk.com/method/groups.isMember.xml?group_id=20629724&access_token=" + token);
     webResponse = webRequest.GetResponse ();
     stream = webResponse.GetResponseStream ();
     xmlDocument.Load (stream);
     bool habrvk = (xmlDocument.SelectSingleNode ("response").InnerText =="1");
     // выводим диалоговое окно
     var builder = new AlertDialog.Builder (this);
     // пользователь состоит в группе "хабрахабр"?
     if (!habrvk) {
         builder.SetMessage ("Привет, "+name+"!\r\n\r\nТы не состоишь в группе habrahabr.Не хочешь вступить?");
         builder.SetPositiveButton ("Да", (o, e) => {
             // уточнив, что пользователь желает вступить, отправим запрос
             webRequest = WebRequest.Create ("https://api.vk.com/method/groups.join.xml?group_id=20629724&access_token=" + token);
              webResponse = webRequest.GetResponse ();
         });
         builder.SetNegativeButton ("Нет", (o, e) => {
         });
     } else {
         builder.SetMessage ("Привет, "+name+"!\r\n\r\nОтлично! Ты состоишь в группе habrahabr.");
         builder.SetPositiveButton ("Ок", (o, e) => {
         });
     }
     builder.Create().Show();
 }
开发者ID:Danil410,项目名称:VkApiXamarin,代码行数:35,代码来源:MainActivity.cs

示例7: OnCreateDialog

        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Build Set Meals Dialog
            var builder = new AlertDialog.Builder(Activity);

            // Get Layout Inflater
            var inflator = Activity.LayoutInflater;

            // Inflate Layout For Password Dialog
            var dialogView = inflator.Inflate(Resource.Layout.SetMealsDialogFragment, null);

            // Initialize Properties
            breakfastEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextBreakfast);
            lunchEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextLunch);
            dinnerEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextDinner);

            // Set Text To Current Meal Values
            breakfastEditText.Text = MealItem.Breakfast;
            lunchEditText.Text = MealItem.Lunch;
            dinnerEditText.Text = MealItem.Dinner;

            // Set Positive & Negative Buttons
            builder.SetView(dialogView);
            builder.SetPositiveButton("Set Meals", HandlePositiveButtonClick);
            // builder.SetNeutralButton("Clear Meals", HandleNeutralButtonClick);
            builder.SetNegativeButton("Cancel", HandleNegativeButtonClick);

            // Build And Return Dialog
            var dialog = builder.Create();
            return dialog;
        }
开发者ID:cameronsmith223,项目名称:Beta-Chi-Daily-Update,代码行数:33,代码来源:SetMealsDialogFragment.cs

示例8: OnCreateDialog

        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Build Password Dialog
            var builder = new AlertDialog.Builder(Activity);

            // Get Layout Inflater
            var inflator = Activity.LayoutInflater;

            // Inflate Layout For Password Dialog
            var dialogView = inflator.Inflate(Resource.Layout.AddReminderDialogFragment, null);

            // Initialize Properties
            ReminderEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextReminder);

            // Set Positive & Negative Buttons
            builder.SetView(dialogView);
            builder.SetPositiveButton("Add Reminder", HandlePositiveButtonClick);
            builder.SetNegativeButton("Cancel", HandleNegativeButtonClick);

            // Build And Return Dialog
            var dialog = builder.Create();
            return dialog;
        }
开发者ID:cameronsmith223,项目名称:Beta-Chi-Daily-Update,代码行数:25,代码来源:UpdateReminderDialogFragment.cs

示例9: AlertYesOrNo

        public static void AlertYesOrNo(Activity context, string title, string message, Action<Result> callback)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.SetTitle(title);
            builder.SetMessage(message);

            if (callback != null)
            {
                builder.SetPositiveButton("Yes", (sender, e) =>
                {
                    callback(Result.Ok);
                });

                builder.SetNegativeButton("No", (sender, e) =>
                {
                    callback(Result.Canceled);
                });
            }
            else
            {
                builder.SetPositiveButton("OK", (sender, e) => { });
            }

            builder.Show();
        }
开发者ID:payinsights,项目名称:samples,代码行数:25,代码来源:Helpers.cs

示例10: CreateChatRooms

		protected void CreateChatRooms(){
			chatroomsAdapter = new ChatRoomsAdapter (this);
			var chatRoomsListView = FindViewById<ListView> (Resource.Id.chatroomsListView);
			chatRoomsListView.Adapter = chatroomsAdapter;
			chatRoomsListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
				ChatRoom currChatRoom = chatroomsAdapter.GetChatRoomAt(e.Position);
				var intent = new Intent(this, typeof(ChatRoomActivity));
				intent.PutExtra("chatroom", currChatRoom.webID);
				StartActivity(intent);
			};
			chatRoomsListView.ItemLongClick += async (object sender, AdapterView.ItemLongClickEventArgs e) => {
				AlertDialog.Builder alert = new AlertDialog.Builder(this);
				alert.SetTitle("Do you want to delete this chatroom?");
				alert.SetPositiveButton("Yes", (senderAlert, args) => {
					ChatRoom currChatRoom = chatroomsAdapter.GetChatRoomAt(e.Position);
					ParsePush.UnsubscribeAsync (currChatRoom.webID);
					ChatRoomUser cru = DatabaseAccessors.ChatRoomDatabaseAccessor.DeleteChatRoomUser(DatabaseAccessors.CurrentUser().webID, currChatRoom.webID);
					DatabaseAccessors.ChatRoomDatabaseAccessor.DeleteChatRoom(currChatRoom.webID);
					ParseChatRoomDatabase pcrd = new ParseChatRoomDatabase();
					pcrd.DeleteChatRoomUserAsync(cru);
					Console.WriteLine("ERASED");
					chatroomsAdapter.NotifyDataSetChanged();

				});
				alert.SetNegativeButton("No", (senderAlert, args) => {
				});	
				alert.Show();
			};
		}
开发者ID:dmerrill6,项目名称:MidgardMessenger,代码行数:29,代码来源:ChatsActivity.cs

示例11: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.Splash);
			new Handler ().PostDelayed (() => {
				//LoadActivity();
				var updateManager = new UpdateManager(this,true);
				if (updateManager.CheckUpdate())
				{
					var builder = new AlertDialog.Builder (this).SetTitle ("软件升级").SetMessage ("发现新版本,建议更新使用新版本").SetOnKeyListener(this).SetCancelable(false);
					builder.SetPositiveButton ("下载", (sender, e) => {
						noticeDialog.Dismiss();	
						//显示下载对话框,下载
						updateManager.ShowDownloadDialog();
					});
					builder.SetNegativeButton ("以后再说", (sender, e) => {
						noticeDialog.Dismiss();	
						LoadActivity();
					});
					noticeDialog= builder.Create ();
					noticeDialog.Show();
				}
				else
				{
					LoadActivity();
				}
			},2000);
		
			// Create your application here
		}
开发者ID:lq-ever,项目名称:CommunityCenter,代码行数:30,代码来源:SplashActivity.cs

示例12: MsgBox

        public static void MsgBox(Context context,
			string msg, 
			string Titolo = "Vegetha", 
			string PositiveText = "OK", 
			Action PositiveAction = null, 
			string NegativeText ="",
			Action NegativeAction = null)
        {
            AlertDialog.Builder d = new AlertDialog.Builder (context);
            d.SetTitle(Titolo);
            d.SetMessage (msg);
            if (PositiveAction != null) {
                d.SetPositiveButton (PositiveText, (sender, e) => {
                    PositiveAction.Invoke();
                });
            } else {
                d.SetPositiveButton (PositiveText, (sender, e) => {

                });
            }

            if (NegativeAction != null) {
                d.SetNegativeButton (NegativeText, (sender, e) => {
                    NegativeAction.Invoke ();
                });
            }
            d.Show ();
        }
开发者ID:frungillo,项目名称:vegetha,代码行数:28,代码来源:funzioni.cs

示例13: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Page_Dialog);

            var yesNoDialogbutton = FindViewById<Button>(Resource.Id.YesNoDialogButton);
            yesNoDialogbutton.Click += delegate
                                {
                                    var builder = new AlertDialog.Builder(this);
                                    builder.SetMessage(Resource.String.knigts_dialog_title);
                                    builder.SetPositiveButton(Resource.String.yes, (s, e) => { });
                                    builder.SetNegativeButton(Resource.String.no, (s, e) => { }).Create();
                                    builder.Show();
                                };

            var alertDialogButton = FindViewById<Button>(Resource.Id.AlertDialogButton);
            alertDialogButton.Click += delegate { ShowDialog(AlertDialog); };

            var listDialogButton = FindViewById<Button>(Resource.Id.ListDialogButton);
            listDialogButton.Click += delegate { ShowDialog(ListDialog); };

            var multiChoiceDialogButton = FindViewById<Button>(Resource.Id.MultiChoiceDialogButton);
            multiChoiceDialogButton.Click += delegate { ShowDialog(MultiChoiceDialog); };

            var customViewDialogButton = FindViewById<Button>(Resource.Id.CustomViewDialogButton);
            customViewDialogButton.Click += delegate { ShowDialog(CustomViewDialog); };

            var fragmentDialogsButton = FindViewById<Button>(Resource.Id.FragmentDialogsButton);
            fragmentDialogsButton.Click += delegate
                                               {
                                                   var intent = new Intent(this, typeof (DialogFragmentActivity));
                                                   intent.AddFlags(ActivityFlags.ClearTop);
                                                   StartActivity(intent);
                                               };
        }
开发者ID:Cheesebaron,项目名称:MonoDroid.DialogSample,代码行数:35,代码来源:DialogActivity.cs

示例14: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource.
            SetContentView (Resource.Layout.Main);

            // Get our UI controls from the loaded layout:
            EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
            Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton);
            Button callButton = FindViewById<Button>(Resource.Id.CallButton);
            Button callHistoryButton = FindViewById<Button> (Resource.Id.CallHistoryButton);

            // Disable the "Call" button.
            callButton.Enabled = false;

            // Add code to translate number.
            string translatedNumber = string.Empty;

            translateButton.Click += (object sender, EventArgs e) => {
                // Translate user's alphanumeric phone number to numeric.
                translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);

                if (String.IsNullOrWhiteSpace(translatedNumber)) {
                    callButton.Text = "Call";
                    callButton.Enabled = false;
                } else {
                    callButton.Text = "Call " + translatedNumber;
                    callButton.Enabled = true;
                }
            };

            callButton.Click += (object sender, EventArgs e) => {
                // On "Call" button click, try to dial phone number.
                var callDialog = new AlertDialog.Builder(this);
                callDialog.SetMessage("Call " + translatedNumber + "?");
                callDialog.SetNeutralButton("Call", delegate {
                    // Add dialed number to list of called numbers.
                    phoneNumbers.Add(translatedNumber);

                    // Enable the Call History button.
                    callHistoryButton.Enabled = true;

                    // Create intent to dial phone.
                    var callIntent = new Intent(Intent.ActionCall);
                    callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
                    StartActivity(callIntent);
                });
                callDialog.SetNegativeButton("Cancel", delegate {});

                // Show the alert dialog to the user and wait for response.
                callDialog.Show();
            };

            callHistoryButton.Click += (sender, e) => {
                var intent = new Intent(this, typeof(CallHistoryActivity));
                intent.PutStringArrayListExtra("phone_numbers", phoneNumbers);
                StartActivity(intent);
            };
        }
开发者ID:jonathanzuniga,项目名称:PhonewordMultiscreen,代码行数:60,代码来源:MainActivity.cs

示例15: showConfirmDialog

        public bool showConfirmDialog(Context context, string info)
        {
            if (!prepareModal())
                return false;
            // reset choice
            mChoice = false;

            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.SetMessage(info);
            builder.SetCancelable(false);
            builder.SetPositiveButton("OK", (object o, Android.Content.DialogClickEventArgs e) =>
                {
                    this.mQuitModal = true;
                    this.mChoice = true;
                    builder.Dispose();
                });

            builder.SetNegativeButton("Cancel", (object o, Android.Content.DialogClickEventArgs e) =>
                {
                    mQuitModal = true;
                    mChoice = false;
                    builder.Dispose(); // probably wrong
                });

            AlertDialog alert = builder.Create();
            alert.Show();

            doModal();
            return mChoice;
        }
开发者ID:nodoid,项目名称:Webview,代码行数:30,代码来源:modal.cs


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