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


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

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


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

示例1: ShowError

 private void ShowError(string message)
 {
     var activity = this.GetService<IMvxAndroidCurrentTopActivity>().Activity as IMvxBindingActivity;
     var alertDialog = new AlertDialog.Builder((Activity)activity).Create();
     alertDialog.SetTitle("Sorry!");
     alertDialog.SetMessage(message);
     alertDialog.SetButton("OK", (sender, args) => {});
     alertDialog.Show();
 }
开发者ID:JoanMiro,项目名称:MvxMod,代码行数:9,代码来源:ErrorDisplayer.cs

示例2: 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

示例3: 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

示例4: ShowError

 private void ShowError(ErrorMessage message)
 {
     var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity as IMvxBindingContextOwner;
     if (activity == null)
     {
         return;
     }
     var alertDialog = new AlertDialog.Builder((Activity)activity).Create();
     alertDialog.SetTitle("Sorry!");
     alertDialog.SetMessage(message.Message);
     alertDialog.SetButton("OK", (sender, args) => {});
     alertDialog.Show();
 }
开发者ID:jerry-wong-amd-com,项目名称:MvvmCross-Templates,代码行数:13,代码来源:ErrorDisplay.cs

示例5: ShowAlertAsync

        public Task ShowAlertAsync(string title, string message)
        {
            var tcs = new TaskCompletionSource<bool> ();

            var alert = new AlertDialog.Builder(Forms.Context).Create();
            alert.SetTitle(title);
            alert.SetMessage(message);
            alert.SetButton("OK", (sender, e) => {
                tcs.TrySetResult(true);
            });

            alert.Show ();

            return tcs.Task;
        }
开发者ID:chrfalch,项目名称:Tekna-demo,代码行数:15,代码来源:AlertProvider.cs

示例6: ConnectToServer

 void ConnectToServer()
 {
     AlertDialog ad = null;
     try
     {
         Sockets.client = new TcpClient(SERVER_IP, PORT);
     }
     catch (SocketException e)
     {
         ad = new AlertDialog.Builder(this).Create();
         ad.SetCancelable(false); // This blocks the 'BACK' button
         ad.SetMessage("Nie można połączyć się z serwerem. Sprawdź połączenie z internetem.");
         ad.SetButton("OK", delegate
         {
             Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
         });
         ad.Show();
     }
 }
开发者ID:maciekjanczyk,项目名称:kik-xamarin,代码行数:19,代码来源:MainActivity.cs

示例7: ShowAlertDialog

        public static void ShowAlertDialog(Context context, string title, string message,
                                    bool isSuccessStatus)
        {
            var alertDialog = new AlertDialog.Builder(context).Create();

            // Setting Dialog Title
            alertDialog.SetTitle(title);

            // Setting Dialog Message
            alertDialog.SetMessage(message);

            // Setting alert dialog icon
            alertDialog.SetIcon(isSuccessStatus ? Resource.Drawable.success : Resource.Drawable.fail);

            // Setting OK Button
            alertDialog.SetButton("OK", (sender, args) => { });

            // Showing Alert Message
            alertDialog.Show();
        }
开发者ID:America4Animals,项目名称:AFA,代码行数:20,代码来源:DialogManager.cs

示例8: Delegat

 void Delegat()
 {
     Intent intent = null;
     EditText edittext = FindViewById<EditText>(Resource.Id.loginArea);
     byte[] buffer = new byte[MAX_LENGTH];
     AlertDialog ad = null;
     buffer = System.Text.Encoding.ASCII.GetBytes(string.Format("{0};{1}", Convert.ToInt32(MessageTypes.Hello), edittext.Text));
     Sockets.client.GetStream().Write(buffer, 0, buffer.Length);
     buffer = new byte[MAX_LENGTH];
     Sockets.client.GetStream().Read(buffer, 0, buffer.Length);
     string[] parse = MessageParser.Split(buffer);
     switch (MessageParser.ToMessageType(parse[0]))
     {
         case MessageTypes.WelcomeClient:
             intent = new Intent(this, typeof(GameManager));
             intent.PutExtra("Nickname", edittext.Text);
             //strbuff = System.Text.Encoding.ASCII.GetString(buffer).Split(';')[1];
             intent.PutExtra("PlayerList", parse[1]);
             StartActivity(intent);
             break;
         case MessageTypes.PlayerExist:
             ad = new AlertDialog.Builder(this).Create();
             ad.SetCancelable(false); // This blocks the 'BACK' button
             ad.SetMessage("Gracz o takim nicku istnieje! Wpisz inny login");
             ad.SetButton("OK", delegate {
                 Sockets.client.Close();
                 ConnectToServer();
             });
             ad.Show();
             break;
         default:
             ad = new AlertDialog.Builder(this).Create();
             ad.SetCancelable(false); // This blocks the 'BACK' button
             ad.SetMessage("Nieoczekiwany błąd. Aplikacja zostanie zamknięta.");
             ad.SetButton("OK", delegate {
                 Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
             });
             ad.Show();
             break;
      }
 }
开发者ID:maciekjanczyk,项目名称:kik-xamarin,代码行数:41,代码来源:MainActivity.cs

示例9: 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

示例10: InternalSetPage

		void InternalSetPage(Page page)
		{
			if (!Forms.IsInitialized)
				throw new InvalidOperationException("Call Forms.Init (Activity, Bundle) before this");

			if (_canvas != null)
			{
				_canvas.SetPage(page);
				return;
			}

			var busyCount = 0;
			MessagingCenter.Subscribe(this, Page.BusySetSignalName, (Page sender, bool enabled) =>
			{
				busyCount = Math.Max(0, enabled ? busyCount + 1 : busyCount - 1);

				if (!Forms.SupportsProgress)
					return;

				SetProgressBarIndeterminate(true);
				UpdateProgressBarVisibility(busyCount > 0);
			});

			UpdateProgressBarVisibility(busyCount > 0);

			MessagingCenter.Subscribe(this, Page.AlertSignalName, (Page sender, AlertArguments arguments) =>
			{
				AlertDialog alert = new AlertDialog.Builder(this).Create();
				alert.SetTitle(arguments.Title);
				alert.SetMessage(arguments.Message);
				if (arguments.Accept != null)
					alert.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(true));
				alert.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(false));
				alert.CancelEvent += (o, args) => { arguments.SetResult(false); };
				alert.Show();
			});

			MessagingCenter.Subscribe(this, Page.ActionSheetSignalName, (Page sender, ActionSheetArguments arguments) =>
			{
				var builder = new AlertDialog.Builder(this);
				builder.SetTitle(arguments.Title);
				string[] items = arguments.Buttons.ToArray();
				builder.SetItems(items, (sender2, args) => { arguments.Result.TrySetResult(items[args.Which]); });

				if (arguments.Cancel != null)
					builder.SetPositiveButton(arguments.Cancel, delegate { arguments.Result.TrySetResult(arguments.Cancel); });

				if (arguments.Destruction != null)
					builder.SetNegativeButton(arguments.Destruction, delegate { arguments.Result.TrySetResult(arguments.Destruction); });

				AlertDialog dialog = builder.Create();
				builder.Dispose();
				//to match current functionality of renderer we set cancelable on outside
				//and return null
				dialog.SetCanceledOnTouchOutside(true);
				dialog.CancelEvent += (sender3, e) => { arguments.SetResult(null); };
				dialog.Show();
			});

			_canvas = new Platform(this);
			if (_application != null)
				_application.Platform = _canvas;
			_canvas.SetPage(page);
			_layout.AddView(_canvas.GetViewGroup());
		}
开发者ID:cosullivan,项目名称:Xamarin.Forms,代码行数:65,代码来源:FormsApplicationActivity.cs

示例11: OnBackPressed

 public override void OnBackPressed()
 {
     AlertDialog ad = new AlertDialog.Builder(this).Create();
     ad.SetCancelable(false); // This blocks the 'BACK' button
     ad.SetMessage("Czy chcesz opuœciæ grê (oddasz walkowerem)?");
     ad.SetButton("Nie", delegate { dialogLive = false; });
     ad.SetButton2("Tak", delegate
     {
         byte[] buffer = System.Text.Encoding.ASCII.GetBytes(string.Format("{0};{1}", Convert.ToInt32(MessageTypes.Left), nickname));
         Sockets.client.GetStream().Write(buffer, 0, buffer.Length);
         dialogLive = false;
     });
     dialogLive = true;
     ad.Show();
 }
开发者ID:maciekjanczyk,项目名称:kik-xamarin,代码行数:15,代码来源:GameActivity.cs

示例12: GameThreadProc

        void GameThreadProc()
        {
            NetworkStream stream = Sockets.client.GetStream();
            byte[] buffer;
            AlertDialog ad = null;

            while (Sockets.client.Connected)
            {
                try
                {
                    buffer = new byte[MainActivity.MAX_LENGTH];
                    stream.Read(buffer, 0, buffer.Length);
                    string[] data = MessageParser.Split(buffer);
                    if (data.Length == 1)
                    {
                        Sockets.client.Close();
                        RunOnUiThread(delegate
                        {
                            ad = new AlertDialog.Builder(this).Create();
                            ad.SetCancelable(false); // This blocks the 'BACK' button
                            ad.SetMessage("Nie mo¿na po³¹czyæ siê z serwerem. SprawdŸ po³¹czenie z internetem.");
                            ad.SetButton("OK", delegate
                            {
                                Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
                            });
                            ad.Show();
                        });
                    }
                    switch (MessageParser.ToMessageType(data[0]))
                    {
                        case MessageTypes.TurnClient:
                            RunOnUiThread(delegate { ParseCanvas(data[1]); });
                            isMyTurn = true;
                            break;
                        case MessageTypes.WinClient:
                            RunOnUiThread(delegate
                            {
                                ad = new AlertDialog.Builder(this).Create();
                                ad.SetCancelable(false); // This blocks the 'BACK' button
                                if (data[1].Contains(nickname))
                                    ad.SetMessage("Gratulacje! Wygra³eœ!");
                                else
                                    ad.SetMessage("Niestety przegra³eœ!");
                                ad.SetButton("WyjdŸ", delegate
                                {
                                    GameManager.thLock = false;
                                    Finish();
                                });
                                ad.Show();
                            });
                            return;
                            break;
                        case MessageTypes.LeftClient:
                            RunOnUiThread(delegate
                            {
                                ad = new AlertDialog.Builder(this).Create();
                                ad.SetCancelable(false); // This blocks the 'BACK' button
                                ad.SetMessage("Twój przeciwnik opuœci³ grê!");
                                ad.SetButton("WyjdŸ", delegate
                                {
                                    //th.Abort();
                                    GameManager.thLock = false;
                                    Finish();
                                });
                                ad.Show();
                            });
                            return;
                            break;
                    }
                }
                catch (System.Threading.ThreadAbortException e)
                {
                    return;
                }
                catch (Exception e)
                {

                    Sockets.client.Close();
                    RunOnUiThread(delegate
                    {
                        ad = new AlertDialog.Builder(this).Create();
                        ad.SetCancelable(false); // This blocks the 'BACK' button
                        ad.SetMessage("Nie mo¿na po³¹czyæ siê z serwerem. SprawdŸ po³¹czenie z internetem.");
                        ad.SetButton("OK", delegate
                        {
                            Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
                        });
                        ad.Show();
                    });
                }
            }
        }
开发者ID:maciekjanczyk,项目名称:kik-xamarin,代码行数:92,代码来源:GameActivity.cs

示例13: EnableWriteMode

		private void EnableWriteMode()
		{
			_inWriteMode = true;

			// Create an intent filter for when an NFC tag is discovered.  When
			// the NFC tag is discovered, Android will u
			var tagDetected = new IntentFilter(NfcAdapter.ActionTagDiscovered);
			var filters = new[] { tagDetected };

			// When an NFC tag is detected, Android will use the PendingIntent to come back to this activity.
			// The OnNewIntent method will invoked by Android.
			var intent = new Intent(this, GetType()).AddFlags(ActivityFlags.SingleTop);
			var pendingIntent = PendingIntent.GetActivity(this, 0, intent, 0);

			if (_nfcAdapter == null) {
				var alert = new AlertDialog.Builder (this).Create ();
				alert.SetMessage ("NFC is not supported on this device.");
				alert.SetTitle ("NFC Unavailable");
				alert.SetButton ("OK", delegate {
					_button.Enabled = false;
					_alertMessage.Text = "NFC is not supported on this device.";
				});
				alert.Show ();
			} else
				_nfcAdapter.EnableForegroundDispatch(this, pendingIntent, filters, null);
		}
开发者ID:agileorange,项目名称:NfcSample,代码行数:26,代码来源:MainActivity.cs

示例14: OnStartClicked

		protected void OnStartClicked(object sender, EventArgs e){

			if(tunnel.IsRunning){
				ProgressDialog progress = null;
				RunOnUiThread(delegate() {
					progress = ProgressDialog.Show(this,"Disconnecting From Brick...","Closing connection...       ");
				});
				System.Threading.Thread t =  new System.Threading.Thread( delegate(object obj){
					tunnel.Stop();
					RunOnUiThread(delegate() {
						progress.Dismiss();
						ShowToast("Tunnel stoped");
					});
				});
				t.IsBackground = true;
				t.Priority = System.Threading.ThreadPriority.Normal;
				t.Start();
			}
			else{
				ProgressDialog progress = null;
				System.Threading.Thread t = new System.Threading.Thread(delegate(object obj){
					UpdateSettings();
					if(bluetoothDeviceName == ""){
						RunOnUiThread(delegate() {
							AlertDialog dialog = new AlertDialog.Builder(this).Create();
							dialog.SetTitle("Select Bluetooth Device");
							dialog.SetMessage("No Bluetooth Device has been selected. Please go to settings and select a Bluetooth device");
							dialog.SetButton("OK", delegate(object sen, DialogClickEventArgs eventArgs) {
							});
							dialog.SetIcon(Android.Resource.Drawable.IcDialogInfo);
							dialog.Show();
						});
						return;
					}
					RunOnUiThread(delegate() {
						progress =	ProgressDialog.Show(this,"Connecting To Brick...","Opening connection...       ",true,false);
					});
					connection = new MonoBrick.Bluetooth<MonoBrick.NXT.Command, MonoBrick.NXT.Reply>(bluetoothDeviceName);
					//connection = new Loopback();
					if(tunnel.Start(tunnelSettings, connection)){
						RunOnUiThread(delegate() {
							progress.Dismiss();
							ShowToast("Tunnel started");
						});
					}
					else{
						RunOnUiThread(delegate() {
							progress.Dismiss();
							ShowToast("Failed to start tunnel");
						});
					}
				});
				t.IsBackground = true;
				t.Priority = System.Threading.ThreadPriority.Normal;
				t.Start();
			}
		}
开发者ID:seipekm,项目名称:MonoBrick-Communication-Software,代码行数:57,代码来源:Main.cs

示例15: ButtonClickEvent

 private void ButtonClickEvent(int numerek)
 {
     if (isMyTurn)
     {
         if (canvas[numerek] != '-')
         {
             AlertDialog ad = new AlertDialog.Builder(this).Create();
             ad.SetCancelable(false); // This blocks the 'BACK' button
             ad.SetMessage("Te pole jest ju¿ zajête!");
             ad.SetButton("OK", delegate { });
             ad.Show();
             return;
         }
         canvas[numerek] = mySign;
         byte[] buffbuff = System.Text.Encoding.ASCII.GetBytes(string.Format("{0};{1}", Convert.ToInt32(MessageTypes.Turn), new string(canvas)));
         pole[numerek].Text = Char.ToString(mySign);
         Sockets.client.GetStream().Write(buffbuff, 0, buffbuff.Length);
         isMyTurn = false;
     }
     else
     {
         AlertDialog ad = new AlertDialog.Builder(this).Create();
         ad.SetCancelable(false); // This blocks the 'BACK' button
         ad.SetMessage("Poczekaj na swoj¹ kolej!");
         ad.SetButton("OK", delegate {});
         ad.Show();
     }
 }
开发者ID:maciekjanczyk,项目名称:kik-xamarin,代码行数:28,代码来源:GameActivity.cs


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