コード例 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create the Dialog object used to display messages
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            ActivityDialog = builder.Create ();
            ActivityDialog.SetTitle("HelloWorld");
            ActivityDialog.DismissEvent += (sender, e) => {
                FindViewById<TextView> (Resource.Id.textViewMessage).Text = "Alert dismissed at " + DateTime.Now.ToLongTimeString();
            };

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

            // Get our button from the layout resource,
            // and attach an event to it
            Button buttonClicker = FindViewById<Button> (Resource.Id.myButton);

            buttonClicker.Click += delegate {
                buttonClicker.Text = string.Format ("{0} clicks!", count++);
            };

            FindViewById<Button> (Resource.Id.buttonPopupMessage).Click += buttonPopupMessage_Click;
        }
 private void ShowAlertDialog(string title, string message)
 {
     if (_alertDialog != null && _alertDialog.IsShowing) return;
     _alertDialog = new AlertDialog.Builder(Context).Create();
     _alertDialog.SetTitle(title);
     _alertDialog.SetMessage(message);
     _alertDialog.SetButton("OK", (alertsender, args) => { });
     _alertDialog.Show();
 }
コード例 #3
0
 public static void Display(Activity activity, string msg)
 {
     Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(activity);
     Android.App.AlertDialog         alert  = dialog.Create();
     alert.SetTitle("Dialog");
     alert.SetMessage(msg);
     alert.SetButton("OK", (c, ev) =>
     {
         // Ok button click task
     });
     alert.Show();
 }
コード例 #4
0
 public void ShowInvalidInputDialog()
 {
     Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
     Android.App.AlertDialog         alert  = dialog.Create();
     alert.SetTitle("Alert!");
     alert.SetMessage("Please enter your email and password");
     alert.SetButton("OK", (c, ev) =>
     {
         alert.Dismiss();
     });
     alert.Show();
 }
コード例 #5
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.bottom_menu, menu);

            var searchItem = menu.FindItem(Resource.Id.search);

            var searchView  = MenuItemCompat.GetActionView(searchItem);
            var _searchView = searchView.JavaCast <Android.Support.V7.Widget.SearchView>();

            _searchView.QueryHint = "Pretrazi prijatelja..";

            _searchView.QueryTextChange += (s, e) =>
            {
                if (e.NewText.Equals(String.Empty))
                {
                    tabLayout.Visibility      = ViewStates.Visible;
                    viewPager.Visibility      = ViewStates.Visible;
                    listView.Adapter          = null;
                    layoutPretrage.Visibility = ViewStates.Gone;
                }
                else
                {
                    tabLayout.Visibility      = ViewStates.Gone;
                    viewPager.Visibility      = ViewStates.Gone;
                    layoutPretrage.Visibility = ViewStates.Visible;
                }
            };

            _searchView.QueryTextSubmit += (s, e) =>
            {
                _searchView.ClearFocus();

                alert = new Android.App.AlertDialog.Builder(this).Create();
                alert.SetTitle("Vrsi se pretraga!");
                alert.SetMessage("Molimo sacekajte!");
                alert.SetCancelable(false);

                alert.Show();

                alertGreska = new Android.App.AlertDialog.Builder(this).Create();
                alertGreska.SetTitle("Pretraga neuspesna!");
                alertGreska.SetMessage("Nije pronadjeno nijedno poklapanje sa: " + e.Query);
                alertGreska.SetButton("U redu", delegate(object sender, DialogClickEventArgs args) { alert.Dismiss(); });

                Thread novaNit = new Thread(() => FuncijaZaNoviNit(e.Query));
                novaNit.Start();

                e.Handled = true;
            };

            return(true);
        }
コード例 #6
0
        //Realm realmobj;
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);
            //realmobj = Realm.GetInstance();
            user      = FindViewById <EditText>(Resource.Id.userNameId);
            password1 = FindViewById <EditText>(Resource.Id.passWordId);
            loginBtn  = FindViewById <Button>(Resource.Id.LoginBtnId);
            reg       = FindViewById <Button>(Resource.Id.registerBtnId);
            error     = FindViewById <TextView>(Resource.Id.error);

            loginBtn.Click += delegate
            {
                if (string.IsNullOrEmpty(user.Text))
                {
                    Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                    Android.App.AlertDialog         alert  = dialog.Create();
                    alert.SetTitle("error");
                    alert.SetMessage("INAVLID USERNAME OR PASSWORD");
                    alert.SetButton("ok", (c, ev) =>
                    {
                    });
                    alert.Show();
                }
                if (string.IsNullOrEmpty(password1.Text))
                {
                    Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                    Android.App.AlertDialog         alert  = dialog.Create();
                    alert.SetTitle("error");
                    alert.SetMessage("INVALID USERNAME OR PASSWORD");
                    alert.SetButton("ok", (c, ev) =>
                    {
                    });
                    alert.Show();
                }

                else
                {
                    loginBtn.Click += delegate
                    {
                        var wscreen = new Intent(this, typeof(startLocation));
                        StartActivity(wscreen);
                    };
                }
            };

            reg.Click += delegate
            {
                var regScreen = new Intent(this, typeof(SignUpActivity));
                StartActivity(regScreen);
            };
        }
コード例 #7
0
        public void PresentAlert(string content)
        {
            var         dialogVal = new AlertDialog.Builder(this, Resource.Style.AlertDialog);
            AlertDialog alertVal  = dialogVal.Create();

            alertVal.SetTitle("Información");
            alertVal.SetMessage(content);
            alertVal.SetButton("Aceptar", (c, ev) =>
            {
                alertVal.Hide();
            });
            alertVal.Show();
        }
コード例 #8
0
        //private void txtHideComment_Click(object sender, EventArgs e)
        //{
        //    txtHideComment.Visibility = ViewStates.Gone;
        //    FragmentTransaction ftvideo = SupportFragmentManager.BeginTransaction();
        //    ftvideo.AddToBackStack(null);
        //    ftvideo.SetCustomAnimations(Resource.Animation.slide_up, Resource.Animation.slide_down);
        //    ftvideo.Hide(CommentsFragment).Commit();
        //}

        private void BtnDelete_Click(object sender, EventArgs e)
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();
            alert.SetTitle("Confirmation");
            alert.SetMessage("Are you sure you want to delete the response?");
            alert.SetButton("OK", (c, ev) =>
            {
                DeleteLatestVideo().FireAndForgetSafeAsync();
            });
            alert.SetButton2("CANCEL", (c, ev) => { alert.Hide(); });
            alert.Show();
        }
コード例 #9
0
 private void DisplayAlert(string title, string message)
 {
     Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
     Android.App.AlertDialog         alert  = dialog.Create();
     alert.SetTitle(title);
     alert.SetMessage(message);
     //alert.SetIcon(Resource.Drawable.abc_btn_check_material);
     alert.SetButton("OK", (c, ev) =>
     {
         // Ok button click task
     });
     alert.Show();
 }
コード例 #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            Button btn = FindViewById <Button>(Resource.Id.btn_Add);

            btn.Click += btnOnClick;

            ListView listView = FindViewById <ListView>(Resource.Id.listView);

            db.CopyDatabase(); //kopiuje baze na telefon z apki

            List <Gas>    gass = null;
            List <string> abc  = null;

            try
            {
                using (var conn = db.SQLiteConnection)
                {
                    gass = conn.Table <Gas>().ToList();
                    abc  = gass.ConvertAll(x => x.ToString());
                }

                ArrayAdapter <string> arrayAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, abc);
                listView.Adapter = arrayAdapter;
            }
            catch (Exception ex)
            {
                var         dialog = new AlertDialog.Builder(this);
                AlertDialog alert  = dialog.Create();
                alert.SetTitle("Exception");
                alert.SetMessage(ex.ToString());
                alert.SetButton("OK", (c, ev) =>
                {
                    // Ok button click task
                });
                alert.Show();
            }

            Button btnNewPage = FindViewById <Button>(Resource.Id.btn_NewPage);

            btnNewPage.Click += btnNewPageClick;
        }
コード例 #11
0
        private async void CarregarDados()
        {
            try
            {
                HttpClient client = new HttpClient();
                // envia a requisição GET
                var uri    = "https://grugol.000webhostapp.com/API/denuncia/LerTodos.php";
                var result = await client.GetStringAsync(uri);

                CarregarVotos();

                // processa a resposta
                var posts = JsonConvert.DeserializeObject <List <Denuncia> >(result);
                denuncias = posts;
                var adapter = new DenunciaListAdapter(this, denuncias);
                lvDadosDenuncia.Adapter = adapter;
            }
            catch (JsonSerializationException)
            {
                Toast.MakeText(this, "Nenhuma denuncia foi encontrada!", ToastLength.Long).Show();
            }
            catch (HttpRequestException ex)
            {
                Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alerta  = builder.Create();

                alerta.SetTitle("Erro!");
                alerta.SetIcon(Android.Resource.Drawable.StatNotifyError);
                alerta.SetMessage($"Ocorreu um erro de conexão ao carregar os dados\n{ex.Message}");
                alerta.SetButton("OK", (s, ev) =>
                {
                });
                alerta.Show();
                //Toast.MakeText(this, $"Ocorreu um erro de conexão ao carregar os dados\n{ex.Message}", ToastLength.Long).Show();
            }
            catch (Exception ex)
            {
                Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alerta  = builder.Create();

                alerta.SetTitle("Erro!");
                alerta.SetIcon(Android.Resource.Drawable.StatNotifyError);
                alerta.SetMessage($"Ocorreu um erro inesperado ao carregar os dados\n{ex.Message}");
                alerta.SetButton("OK", (s, ev) =>
                {
                });
                alerta.Show();
                //Toast.MakeText(this, $"Ocorreu um erro inesperado ao carregar os dados\n{ex.Message}", ToastLength.Long).Show();
            }
        }
コード例 #12
0
        public static Android.App.AlertDialog.Builder MessageBox(Context context, string title, string message)
        {
            Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(context);
            Android.App.AlertDialog         alert   = builder.Create();
            alert.SetTitle(title);
            alert.SetMessage(message);
            alert.SetButton("OK", (c, ev) =>
            {
                //ok button
            });
            alert.Show();

            return(builder);
        }
コード例 #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            var adRequest = new AdRequest.Builder().Build();

            mInterstitialAd            = new InterstitialAd(this);
            mInterstitialAd.AdUnitId   = GetString(Resource.String.test_interstitial_ad_unit_id);;
            mInterstitialAd.AdListener = new AdListener(this);


            charade_tv     = FindViewById <TextView>(Resource.Id.charade_textView);
            qst_en_cours   = FindViewById <TextView>(Resource.Id.qst_en_cours);
            score_tv       = FindViewById <TextView>(Resource.Id.score_tv);
            aide_tv        = FindViewById <TextView>(Resource.Id.aide_tv);
            aide_tv.Click += (s, e) =>
            {
                Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alert  = dialog.Create();
                alert.SetTitle("Vous avez demandé de l'aide");
                alert.SetMessage("Voulez vous prendre une lettre contre 10 points?");
                //alert.SetIcon(Resource.Drawable.question);
                alert.SetButton("OUI", (c, ev) =>
                {
                    Aide();
                });
                alert.SetButton2("NON", (c, ev) =>
                {
                    //if (mInterstitialAd.IsLoaded)
                    //{
                    //    LoadInterstitialAd();
                    //}
                });
                alert.Show();
            };

            Preference_utilisateur         = GetPreferences(FileCreationMode.Private);
            Preference_utilisateure_editor = Preference_utilisateur.Edit();
            niveau = Preference_utilisateur.GetInt("niveau", 0);
            score  = Preference_utilisateur.GetInt("score", 0);
            aide   = Preference_utilisateur.GetString("aide", "");

            initIdGrid();
            CharadeSuivante();
        }
コード例 #14
0
 //Metody
 //Po stisknutí tlačítka se uživateli zobrazí alert, odkud chce fotku vybrat (budoucí možnost pro výběr i z foťáku, nepodařilo se mi rozchodit), pokud je vybraná galerie,
 //spustí se intent pro výběr obrázku z galerie, ta se otevře a uživatel má možnost vybrat fotku.
 public void SelectImage()
 {
     dialog = new Android.App.AlertDialog.Builder(this.act);
     alert  = dialog.Create();
     alert.SetTitle("Select Image");
     alert.SetMessage("Select image from");
     alert.SetButton2("Gallery", (c, ev) =>
     {
         var intent = new Intent(Intent.ActionPick, MediaStore.Images.Media.ExternalContentUri);
         intent.SetType("image/*");
         this.act.StartActivityForResult(Intent.CreateChooser(intent, "Select Picture"), SELECT_FILE);
     });
     alert.SetButton3("CANCEL", (c, ev) => { });
     alert.Show();
 }
コード例 #15
0
ファイル: Carritopage.cs プロジェクト: luisortizla/tfu
        private void Metododepagobtn_Click(object sender, EventArgs e)
        {
            AlertDialog.Builder dialog = new AlertDialog.Builder(this);
            AlertDialog         alert  = dialog.Create();

            alert.SetTitle("¿Que metodo de pago deaseas?");
            alert.SetButton("Efectivo", (c, ev) =>
            {
                metodopago.Text = "Efectivo";
            });
            alert.SetButton2("Tarjeta", (c, ev) =>
            {
                Dialog popup = new Dialog(this);
                popup.SetContentView(Resource.Layout.popuCardlayout);
                popup.Window.SetSoftInputMode(SoftInput.AdjustResize);
                popup.Show();
                popup.Window.SetBackgroundDrawableResource(Android.Resource.Color.Transparent);
                var nombreimput          = popup.FindViewById <EditText>(Resource.Id.nombreinput);
                var numtarjetainput      = popup.FindViewById <EditText>(Resource.Id.numtarjetainput);
                var mesinput             = popup.FindViewById <EditText>(Resource.Id.mesinput);
                var añoinput             = popup.FindViewById <EditText>(Resource.Id.añoinput);
                var cvvinput             = popup.FindViewById <EditText>(Resource.Id.cvvinput);
                var ingresartarjeta      = popup.FindViewById <Button>(Resource.Id.ingresartarjeta);
                var numtarejtaview       = popup.FindViewById <TextView>(Resource.Id.numtarjetaview);
                var nombreview           = popup.FindViewById <TextView>(Resource.Id.nombreview);
                var mesview              = popup.FindViewById <TextView>(Resource.Id.meview);
                var añoview              = popup.FindViewById <TextView>(Resource.Id.añoview);
                nombreimput.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => {
                    nombreview.Text = e.Text.ToString();
                };
                numtarjetainput.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => {
                    numtarejtaview.Text = e.Text.ToString();
                };
                mesinput.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => {
                    mesview.Text = e.Text.ToString();
                };
                añoinput.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => {
                    añoview.Text = e.Text.ToString();
                };


                ingresartarjeta.Click += delegate {
                    popup.Dismiss();
                };
            });
            alert.Show();
            totalapagar.Text = precios.Sum().ToString();
        }
コード例 #16
0
        private Task <bool> ConfirmarEliminacionArchivos()
        {
            var respuesta = new TaskCompletionSource <bool>();

            AlertDialog alert = dialog.Create();

            alert.SetTitle("Confirmación");
            alert.SetMessage("¿Desea eliminar los archivos originales después del proceso?");
            alert.SetButton("Sí", (c, ev) =>
            {
                respuesta.SetResult(true);
            });
            alert.SetButton2("No", (c, ev) => { respuesta.SetResult(false); });
            alert.Show();
            return(respuesta.Task);
        }
コード例 #17
0
 /// <summary>
 /// Método que apresenta um alerta
 /// </summary>
 /// <param name="mensagem">Mensagem a ser apresentada</param>
 public void ApresentaAlerta(string titulo, string mensagem, string texto_botao, Context context, MeuDelegate fun)
 {
     //define o alerta para executar a tarefa
     Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(context);
     Android.App.AlertDialog         alerta  = builder.Create();
     //Define o Titulo
     alerta.SetTitle(titulo);
     alerta.SetIcon(Android.Resource.Drawable.IcDialogAlert);
     alerta.SetMessage(mensagem);
     alerta.SetButton(texto_botao, (s, ev) =>
     {
         fun();
         //Toast.MakeText(context, "Legal, vamos continuar... !", ToastLength.Short).Show();
     });
     alerta.Show();
 }
コード例 #18
0
 public void OnClick(View v)
 {
     Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(context);
     Android.App.AlertDialog         alert  = dialog.Create();
     alert.SetTitle("UnBlock");
     alert.SetMessage("Do you want to UnBlock this user");
     alert.SetButton("OK", (c, ev) =>
     {
         RemoveFromBlackListAsync(Convert.ToInt64(item.id));
     });
     alert.SetButton2("CANCEL", (c, ev) =>
     {
         alert.Dismiss();
     });
     alert.Show();
 }
コード例 #19
0
        public async void Connect(object sender, EventArgs args)
        {
            BluetoothAdapter adapterbt = BluetoothAdapter.DefaultAdapter;
            BluetoothDevice  device    = (from bd in adapterbt.BondedDevices
                                          where bd.Name == list.SelectedItem.ToString()
                                          select bd).FirstOrDefault();

            Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
            AlertDialog alert = dialog.Create();

            alert.SetTitle("Title");
            ParcelUuid[] uuids = device.GetUuids();
            if ((uuids != null) && (uuids.Length > 0))
            {
                foreach (var uuid in uuids)
                {
                    try
                    {
                        btSocket = device.CreateRfcommSocketToServiceRecord(uuid.Uuid);
                        if (!btSocket.IsConnected)
                        {
                            await btSocket.ConnectAsync();
                        }
                        if (btSocket.IsConnected)
                        {
                            Mutex  mut   = new Mutex();
                            byte[] Login =
                            { 0x01, 0x30, 0x30, 0x32, 0x3A, 0x20, 0x30, 0x30, 0x34, 0x3A, 0x05, 0x30, 0x31, 0x3B, 0x3F, 0x03 };
                            byte[] RapX = { 0x01, 0x30, 0x30, 0x32, 0x3C, 0x2E, 0x30, 0x30, 0x34, 0x35, 0x58, 0x09, 0x05, 0x30, 0x32, 0x32, 0x3B, 0x03 };
                            DevUID = uuid;

                            Console.WriteLine("conected to:" + uuid.Uuid.ToString());
                            Talk2BTsocket(btSocket, Login, mut);

                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        Toast.MakeText(this, ex.Message, ToastLength.Short);
                    }

                    //var _socket = device.CreateRfcommSocketToServiceRecord(UUID.FromString(device.GetUuids().ToString()));
                    //await _socket.ConnectAsync();
                }
            }
        }
コード例 #20
0
        void Confidential_Checked_Click(object sender, System.EventArgs e)
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();
            alert.SetTitle("Aviso");
            string message = mEvent.Confidencial ? "¿Está seguro que desea desmarcar el evento como confidencial?" : "¿Está seguro que desea marcar el evento como confidencial?";

            alert.SetMessage(message);
            alert.SetButton("Si", (c, ev) =>
            {
                ChangeEventStatusCenfidential();
            });

            alert.SetButton2("Cancelar", (c, ev) => { });

            alert.Show();
        }
コード例 #21
0
        private void ListItemClicked(int position)
        {
            Intent intent = null;

            switch (position)
            {
            case 0:
                intent = new Intent(this, typeof(Recordatorio));
                break;

            case 1:
                intent = new Intent(this, typeof(Calculadora));
                break;

            case 2:
                intent = new Intent(this, typeof(GuiaList));
                break;

            case 3:
                intent = new Intent(this, typeof(PacienteList));
                break;

            case 4:
                AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                AlertDialog         alert  = dialog.Create();
                alert.SetTitle("Salir de la aplicación");
                alert.SetIcon(Resource.Drawable.logo);
                alert.SetButton("Aceptar", (c, ev) =>
                {
                    this.FinishAffinity();
                    Finish();
                    Android.OS.Process.KillProcess(Android.OS.Process.MyPid());

                    GC.Collect();
                });

                alert.SetButton2("Cancelar", (c, ev) => { });
                alert.Show();
                break;
            }

            if (intent != null)
            {
                StartActivity(intent);
            }
        }
コード例 #22
0
        private void LoadReviews(object sender, EventArgs e)
        {
            var listview = new ListView(this);

            listview.Adapter = new ReviewsAdapter(api.Personel_Ratings(Id));
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();
            alert.SetTitle("Reviews for " + nameText.Text);
            alert.SetView(listview);
            //alert.SetIcon(Resource.Drawable.alert);
            alert.SetButton("OK", (c, ev) =>
            {
                alert.Cancel();
            });
            alert.SetButton2("CANCEL", (c, ev) => { });
            alert.Show();
        }
コード例 #23
0
        private static Task<int?> PlatformShow(string title, string description, List<string> buttons)
        {
            tcs = new TaskCompletionSource<int?>();
            Game.Activity.RunOnUiThread(() =>
            {
                alert = new AlertDialog.Builder(Game.Activity).Create();

                alert.SetTitle(title);
                alert.SetMessage(description);

                alert.SetButton((int)DialogButtonType.Positive, buttons[0], (sender, args) =>
                {
                    if (!tcs.Task.IsCompleted)
                        tcs.SetResult(0);
                });

                if (buttons.Count > 1)
                {
                    alert.SetButton((int)DialogButtonType.Negative, buttons[1], (sender, args) =>
                    {
                        if (!tcs.Task.IsCompleted)
                            tcs.SetResult(1);
                    });
                }

                if (buttons.Count > 2)
                {
                    alert.SetButton((int)DialogButtonType.Neutral, buttons[2], (sender, args) =>
                    {
                        if (!tcs.Task.IsCompleted)
                            tcs.SetResult(2);
                    });
                }

                alert.CancelEvent += (sender, args) =>
                {
                    if (!tcs.Task.IsCompleted)
                        tcs.SetResult(null);
                };

                alert.Show();
            });

            return tcs.Task;
        }
コード例 #24
0
ファイル: MainActivity.cs プロジェクト: elavanis/Mud
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            _relativeLayout = FindViewById <RelativeLayout>(Resource.Id.ScreenLayout);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            _displayText = FindViewById <TextView>(Resource.Id.DisplayText);
            _displayText.MovementMethod = new Android.Text.Method.ScrollingMovementMethod();

            _inputText              = FindViewById <EditText>(Resource.Id.InputText);
            _inputText.TextChanged += InputChanged;

            try
            {
                _telnetHandler = new ClientHandler(Settings.Address, Settings.Port, new JsonMudMessage());

                _timer          = new Timer();
                _timer.Interval = 100;
                _timer.Elapsed += UpdateDisplayedText;
                _timer.Start();

                _timer2          = new Timer();
                _timer2.Interval = 100;
                _timer2.Elapsed += _timer2_Elapsed;
                _timer2.Start();
            }
            catch
            {
                Android.App.AlertDialog.Builder builder     = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alertDialog = builder.Create();
                alertDialog.SetTitle("Error Connecting");
                alertDialog.SetMessage($"Error connecting to '{Settings.Address}' port {Settings.Port}");
                alertDialog.SetButton("OK", (c, ev) => { });
                alertDialog.Show();
            }
        }
コード例 #25
0
        private void DeleteSize()
        {
            Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert   = builder.Create();
            alert.SetTitle("Delete Size");
            alert.SetMessage("When you delete this size, the products with this size will also be deleted. Continue?"); //indicate here if the size has fo

            alert.SetButton2("CANCEL", (c, ev) =>
            {
                //cancel button
            });
            alert.SetButton("YES", (c, ev) =>
            {
                mSizesDataAccess.DeleteFromTable(selectedRecordId);
                Finish();
            });
            alert.Show();
        }
コード例 #26
0
 private void Btn3_Click(object sender, EventArgs e)
 {
     Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
     Android.App.AlertDialog         alert  = dialog.Create();
     alert.SetTitle("Delete Device");
     alert.SetMessage("Are you sure to delete this device?");
     alert.SetButton("OK", (c, ev) =>
     {
         kt3 = false;
         icon_ok3.Visibility    = ViewStates.Gone;
         icon_car3.Visibility   = ViewStates.Gone;
         text_item3.Visibility  = ViewStates.Gone;
         text_model3.Visibility = ViewStates.Gone;
         btn3.Visibility        = ViewStates.Gone;
         view3.Visibility       = ViewStates.Gone;
     });
     alert.Show();
 }
コード例 #27
0
        private void ClickRemoveFile(object sender, EventArgs e)
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();
            alert.SetTitle("Aviso");
            alert.SetMessage("¿Está seguro que desea quitar el Archivo?");
            alert.SetButton("Si", (c, ev) =>
            {
                ViewGroup fileRow = (ViewGroup)((View)sender).Parent;
                int filePosition  = filesContainer.IndexOfChild(fileRow);

                DeleteFile(attachedFiles[filePosition], filePosition);
            });

            alert.SetButton2("Cancelar", (c, ev) => { });

            alert.Show();
        }
コード例 #28
0
ファイル: Settings.cs プロジェクト: JosephB99/SEG3125Labs
        private void DisplayAlert(string title, string message, bool returnHome = false)
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();
            alert.SetTitle(title);
            alert.SetMessage(message);
            alert.SetButton("OK", (c, ev) =>
            {
                alert.Hide();

                if (returnHome)
                {
                    Intent mainPage = new Intent(this, typeof(MainActivity));
                    StartActivity(mainPage);
                }
            });
            alert.Show();
        }
コード例 #29
0
ファイル: Oracle.cs プロジェクト: Alexis1606/preparate
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     Android.App.AlertDialog.Builder builder    = new Android.App.AlertDialog.Builder(this);
     Android.App.AlertDialog         alerDialog = builder.Create();
     alerDialog.SetTitle("¡ Advertencia !");
     alerDialog.SetIcon(Resource.Drawable.Icon);
     alerDialog.SetMessage("¿Estás seguro que deseas salir?\nTodo tu progreso se perderá");
     alerDialog.SetButton("No", (s, ev) =>
     {
     });
     alerDialog.SetButton3("Si", (s, ev) =>
     {
         StartActivity(typeof(Lista_De_Examenes));
         Finish();
     });
     alerDialog.Show();
     return(base.OnOptionsItemSelected(item));
 }
        private void DeleteRunner()
        {
            Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert   = builder.Create();
            alert.SetTitle("Delete Runner?");
            alert.SetMessage("Do you want to delete this runner?"); //indicate here if the Runner has existing transactions

            alert.SetButton2("CANCEL", (c, ev) =>
            {
                //cancel button
            });
            alert.SetButton("YES", (c, ev) =>
            {
                mRunnerDataAccess.DeleteFromTable(selectedRunnerId);
                Finish();
            });
            alert.Show();
        }
コード例 #31
0
        private async void CarregarVotos()
        {
            try
            {
                HttpClient client = new HttpClient();

                var uri2    = "https://grugol.000webhostapp.com/API/votos/LerPorDenuncia.php";
                var result2 = await client.GetStringAsync(uri2);

                var resultVotos = JsonConvert.DeserializeObject <List <Voto> >(result2);
                votos = resultVotos;
            }
            catch (JsonSerializationException)
            {
            }
            catch (HttpRequestException ex)
            {
                Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alerta  = builder.Create();

                alerta.SetTitle("Erro!");
                alerta.SetIcon(Android.Resource.Drawable.StatNotifyError);
                alerta.SetMessage($"Ocorreu um erro de conexão ao carregar os dados\n{ex.Message}");
                alerta.SetButton("OK", (s, ev) =>
                {
                });
                alerta.Show();
                //Toast.MakeText(this, $"Ocorreu um erro de conexão ao carregar os dados\n{ex.Message}", ToastLength.Long).Show();
            }
            catch (Exception ex)
            {
                Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alerta  = builder.Create();

                alerta.SetTitle("Erro!");
                alerta.SetIcon(Android.Resource.Drawable.StatNotifyError);
                alerta.SetMessage($"Ocorreu um erro inesperado ao carregar os dados\n{ex.Message}");
                alerta.SetButton("OK", (s, ev) =>
                {
                });
                alerta.Show();
                //Toast.MakeText(this, $"Ocorreu um erro inesperado ao carregar os dados\n{ex.Message}", ToastLength.Long).Show();
            }
        }
コード例 #32
0
        private static Task<string> PlatformShow(string title, string description, string defaultText, bool usePasswordMode)
        {
            tcs = new TaskCompletionSource<string>();

            Game.Activity.RunOnUiThread(() =>
            {
                alert = new AlertDialog.Builder(Game.Activity).Create();

                alert.SetTitle(title);
                alert.SetMessage(description);

                var input = new EditText(Game.Activity) { Text = defaultText };

                if (defaultText != null)
                    input.SetSelection(defaultText.Length);

                if (usePasswordMode)
                    input.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationPassword;

                alert.SetView(input);

                alert.SetButton((int)DialogButtonType.Positive, "Ok", (sender, args) =>
                {
                    if (!tcs.Task.IsCompleted)
                        tcs.SetResult(input.Text);
                });

                alert.SetButton((int)DialogButtonType.Negative, "Cancel", (sender, args) =>
                {
                    if (!tcs.Task.IsCompleted)
                        tcs.SetResult(null);
                });

                alert.CancelEvent += (sender, args) =>
                {
                    if (!tcs.Task.IsCompleted)
                        tcs.SetResult(null);
                };

                alert.Show();
            });

            return tcs.Task;
        }
        public override void OnBackPressed()
        {
            Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert   = builder.Create();
            alert.SetTitle("Cancel warning");
            alert.SetMessage("Are you sure you want to cancel?");

            alert.SetButton2("NO", (c, ev) =>
            {
                //cancel button
            });

            alert.SetButton("YES", (c, ev) =>
            {
                base.OnBackPressed();
            });

            alert.Show();
        }
コード例 #34
0
        public void PresentAlert(string content, bool backActivity)
        {
            var         dialogVal = new AlertDialog.Builder(this, Resource.Style.AlertDialog);
            AlertDialog alertVal  = dialogVal.Create();

            alertVal.SetCanceledOnTouchOutside(false);
            alertVal.SetTitle("Información");
            alertVal.SetMessage(content);
            alertVal.SetButton("Aceptar", (c, ev) =>
            {
                alertVal.Hide();
                if (backActivity)
                {
                    StartActivity(new Intent(Application.Context, typeof(HomeActivity)));
                    Finish();
                }
            });
            alertVal.Show();
        }
コード例 #35
0
		/// <summary>
		/// just a helper method to build and show our alert dialog
		/// </summary>
		protected void ShowAlertDialog()
		{
			Log.Debug (logTag, "MainActivity.ShowAlertDialog");
			alert = new AlertDialog.Builder ( this).Create();
			alert.SetMessage ("An AlertDialog! Don't forget to clean me up!");
			alert.SetTitle ("Hey Cool!");
			alert.SetButton ("Ohkaay!", (s,e) => {
				this.showingAlert = false;
				alert.Dismiss();
			});
			alert.Show();
			this.showingAlert = true;
		}