protected void ShowDialog()
 {
     var builder = new AlertDialog.Builder(Context)
         .SetTitle(Title)
         .SetNeutralButton(EDIT, delegate { });
     InitializePositiveAndNegativeButtons(builder);
     CheckItemsSource();
     InitializeDialogItems(builder, Items);
     dialog = builder.Create();
     dialog.Show();
     var neutralButton = dialog.GetButton((int)DialogButtonType.Neutral);
     neutralButton.SetOnClickListener(new ClickListener(ShowEditingDialog));
 }
Exemplo n.º 2
1
 void showAlert(AlertDialog.Builder builder)
 {
     alert = builder.Create();
     alert.Show();
     var acceptButton = alert.GetButton((int)DialogButtonType.Positive);
     acceptButton.Click += saveNewDrink;
     var cancelButton = alert.GetButton((int)DialogButtonType.Negative);
     cancelButton.Click += (sender, e) => { alert.Dismiss(); };
 }
        private void BtnApply_Click(object sender, EventArgs e)
        {
            lvRevenueOffice.Adapter = new RevenueAdapter(this, new List <Revenue> ());

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

            if (tvDate.Text == "Select Date")
            {
                alert.SetTitle("Message");
                alert.SetMessage("Please choose date before apply");
                alert.SetButton("OK", (c, ev) =>
                {
                });
                alert.Show();
                return;
            }

            if (DateTime.Parse(tvDate.Text).Date >= new DateTime(2019, 4, 1))
            {
                alert.SetTitle("Message");
                alert.SetMessage("No data");
                alert.SetButton("OK", (c, ev) =>
                {
                });
                alert.Show();
                return;
            }

            LoadRevenueOffice();
        }
Exemplo n.º 4
0
        //Metoda pro změnu světelnosti, pokud je načtena fotka pro editaci, zavolá se metoda v MainViewModel, do které se předá parametr hodnota seekbaru, pokud není vybrána fotka
        //zobrazí se alert a zresetuje se poloha seekbaru
        private void ExposureChanged(object sender, SeekBar.ProgressChangedEventArgs e)
        {
            if (vm.IsSelected)
            {
                float value = (e.Progress - 100);

                vm.ExposureChanged(value);
            }
            else
            {
                alert.Show();
                ResetSlider();
            }
        }
        private void BtnLogin_Click(object sender, System.EventArgs e)
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();

            if (edtEmail.Text.Trim() == "")
            {
                alert.SetTitle("Message");
                alert.SetMessage("Email was required");
                alert.SetButton("OK", (c, ev) =>
                {
                });
                alert.Show();
                return;
            }

            if (edtPassword.Text.Trim() == "")
            {
                alert.SetTitle("Message");
                alert.SetMessage("Password was required");
                alert.SetButton("OK", (c, ev) =>
                {
                });
                alert.Show();
                return;
            }

            if (edtEmail.Text == "*****@*****.**" && edtPassword.Text == "123")
            {
                Intent intent = new Intent(this, typeof(AdminActivity));
                StartActivity(intent);
            }
            else if (edtEmail.Text == "*****@*****.**" && edtPassword.Text == "123")
            {
                Intent intent = new Intent(this, typeof(ManagerActivity));
                StartActivity(intent);
            }
            else
            {
                alert.SetTitle("Message");
                alert.SetMessage("Email or password not correct");
                alert.SetButton("OK", (c, ev) =>
                {
                });
                alert.Show();
                return;
            }
        }
        private async void Login()
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();

            var pass = GetMd5(edtPassword.Text);

            var client = new HttpClient();
            var url    = $"http://10.0.2.2:61757/Api/Users/login?email={edtEmail.Text}&password={pass}";

            var response = await client.GetAsync(url);

            if (response != null)
            {
                var json = response.Content.ReadAsStringAsync().Result;
                if (json.Contains("True"))
                {
                    if (json.Contains("Administrator"))
                    {
                        Intent intent = new Intent(this, typeof(AdminActivity));
                        StartActivity(intent);
                    }
                    else if (json.Contains("Manager"))
                    {
                        Intent intent = new Intent(this, typeof(ManagerActivity));
                        StartActivity(intent);
                    }
                }
                else
                {
                    alert.SetTitle("Message");
                    alert.SetMessage("Email or password not correct");
                    alert.SetButton("OK", (c, ev) =>
                    {
                    });
                    alert.Show();
                }
            }
            else
            {
                alert.SetTitle("Message");
                alert.SetMessage("Response not available");
                alert.SetButton("OK", (c, ev) =>
                {
                });
                alert.Show();
            }
        }
        void myListViewEvent(object sender, AdapterView.ItemClickEventArgs e)
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(context);
            Android.App.AlertDialog         alert  = dialog.Create();
            var  index = e.Position;
            Jobs value = jobList[index];

            //Intent newScreen = new Intent(Activity, typeof(ApplyNowActivity));
            //newScreen.PutExtra("jobid", value.jobid);
            //StartActivity(newScreen);
            alert.SetTitle("Job for: " + value.title);
            alert.SetMessage("Do you want to apply this job or later?");
            alert.SetButton("Apply Now", (c, ev) => {
                int empid = context.Intent.GetIntExtra("recentuserid", 0);
                DbHelperClass dbhelper = new DbHelperClass(context);
                User UsrObj            = new User();
                UsrObj                       = dbhelper.getUserById(empid);
                bool jobApp                  = dbhelper.insertJobApplication(value.jobid, empid, value.title, value.description, value.jobimage, value.jobtype);
                SmtpClient client            = new SmtpClient();
                client.Port                  = 587;
                client.Host                  = "smtp.gmail.com";
                client.EnableSsl             = true;
                client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "Parul@$101");
                MailMessage mail             = new MailMessage();
                mail.From                    = new MailAddress(UsrObj.email);
                mail.To.Add(new MailAddress("*****@*****.**"));
                mail.Subject    = "Job Application For " + value.title;
                mail.Body       = "From: " + UsrObj.name + "<br/>Email: " + UsrObj.email + "<br/>Job Description: " + value.description;
                mail.IsBodyHtml = true;
                mail.Priority   = MailPriority.Normal;
                client.Send(mail);
            });
            alert.SetButton2("Save this Job", (c, ev) => {
                //string id = context.Intent.GetStringExtra("recentuserid");
                //int empid = Convert.ToInt32(id);
                int empid = context.Intent.GetIntExtra("recentuserid", 0);
                DbHelperClass dbhelper = new DbHelperClass(context);
                bool saveJob           = dbhelper.insertSavedJobApplication(value.jobid, empid, value.title, value.description, value.jobimage, value.jobtype);
                alert.SetTitle("Saved Successfully");
                alert.SetMessage("Selected job saved successfully");
                alert.SetButton("OK", (cd, evv) => { });
                alert.Show();
            });
            alert.SetButton3("Cancel", (c, ev) => { });
            alert.Show();
        }
 private async Task RunCountDown()
 {
     if (count > 0)
     {
         count--;
         RunOnUiThread(() => { Countdown.Text = "" + count; });
     }
     else
     {
         Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
         Android.App.AlertDialog         alert  = dialog.Create();
         alert.SetTitle("Failed confirmation");
         alert.SetMessage("Check it again!");
         alert.SetButton("OK", (c, ev) =>
         {
             RunOnUiThread(() =>
             {
                 count = 60;
                 edittext_confirm.Text = "";
                 Countdown.Text        = "" + count;
             });
         });
         alert.Show();
     }
 }
        private void btnPost_Click(object sender, EventArgs e)
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(mainContext);
            Android.App.AlertDialog         alert  = dialog.Create();
            alert.SetTitle("Confirmation");
            alert.SetMessage("Are you sure you want to upload this recording?");
            alert.SetButton("OK", async(c, ev) =>
            {
                await videoRecord.UploadRecordedResponse(editDescription.Text);
                var tabbedActivity = TabbedMainActivity.GetInstance();
                if (tabbedActivity != null)
                {
                    int UnseenResponseCount = API.UserResponseAPI.GetUnseenResponseNotification();
                    if (UnseenResponseCount > 0)
                    {
                        tabbedActivity.MyChannelFragment.UnSeenReponse = UnseenResponseCount;
                        tabbedActivity.FragmentBottomNavigator.txtUnSeenCount.Visibility = ViewStates.Visible;
                        tabbedActivity.FragmentBottomNavigator.txtUnSeenCount.Text       = UnseenResponseCount.ToString();
                    }
                    else
                    {
                        tabbedActivity.FragmentBottomNavigator.txtUnSeenCount.Visibility = ViewStates.Gone;
                    }
                }

                alert.Hide();
                this.Dismiss();
            });
            alert.SetButton2("CANCEL", (c, ev) => { alert.Hide(); });
            alert.Show();
        }
Exemplo n.º 10
0
        private void btnPost_Click(object sender, EventArgs e)
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(mainContext);
            Android.App.AlertDialog         alert  = dialog.Create();
            alert.SetTitle("Confirmation");
            alert.SetMessage("Are you sure you want to upload the selected file?");
            alert.SetButton("OK", async(c, ev) =>
            {
                var array = Helpers.VideoHelper.GetSelectedMediaData((Activity)mainContext, intentData.Data);

                if (tabbed != null)
                {
                    await tabbed.UploadSelectedResponse(array, editDescription.Text);
                }
                else if (global != null)
                {
                    await global.UploadSelectedResponse(array, editDescription.Text);
                }

                alert.Hide();
                this.Dismiss();
            });
            alert.SetButton2("CANCEL", (c, ev) => { alert.Hide(); });
            alert.Show();
        }
Exemplo n.º 11
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.close_session:

                // Close session

                Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alert  = dialog.Create();
                alert.SetTitle("Aviso");
                alert.SetMessage("¿Seguro que desea cerrar la sesión?");
                alert.SetButton("Si", (c, ev) =>
                {
                    Intent shortDialDetails = new Intent(Application.Context, typeof(LoginActivity));
                    StartActivity(shortDialDetails);
                    Finish();
                });

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

                alert.Show();

                return(true);

            case Resource.Id.filter:
                return(false);
            }

            return(base.OnOptionsItemSelected(item));
        }
Exemplo n.º 12
0
        private void Button_Click(object sender, EventArgs e)
        {
            Android.App.AlertDialog.Builder alertDialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert       = alertDialog.Create();

            if (SelectedManufacturers.Count == 0 || SelectedPriceRanges.Count == 0)
            {
                alert.SetTitle("Error");
                alert.SetMessage("Enter all data");
            }
            else
            {
                Choice.SelectedManufacturers = GetResultFromCheckBoxGroup(ref SelectedManufacturers);
                Choice.SelectedPriceRanges   = GetResultFromCheckBoxGroup(ref SelectedPriceRanges);
                bool result = database.Add(Choice);

                if (result)
                {
                    alert.SetMessage("Your choice is save.");
                }
                else
                {
                    alert.SetMessage("Your choice is not save.");
                }

                alert.SetTitle("Save");
            }
            alert.SetButton("OK", (c, ev) =>
            {
                alert.Dispose();
            });
            alert.Show();
        }
Exemplo n.º 13
0
        public void ReceiveDetections(Detections detections)
        {
            SparseArray qrcodes = detections.DetectedItems;

            if (qrcodes.Size() != 0)
            {
                _txtResult.Post(() => {
                    _txtResult.Text            = ((Barcode)qrcodes.ValueAt(0)).RawValue;
                    AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                    AlertDialog alert          = dialog.Create();
                    alert.SetTitle("Código de Barras");
                    alert.SetMessage(((Barcode)qrcodes.ValueAt(0)).RawValue);
                    alert.SetIcon(Resource.Drawable.logo);
                    alert.SetButton("Volver", (c, ev) =>
                    {
                        // Para actualizar una actividad desde dentro de sí mismo
                        Finish(); StartActivity(Intent);

                        GC.Collect();
                    });

                    alert.Show();
                });
            }
        }
Exemplo n.º 14
0
 public void OnComplete(Task task)
 {
     if (task.IsSuccessful == false)
     {
         Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
         AlertDialog alert = dialog.Create();
         alert.SetTitle("Failed");
         alert.SetMessage("Request failed, something went wrong");
         alert.SetButton("OK", (c, ev) =>
         {
             // Ok button click task
         });
         alert.SetButton2("CANCEL", (c, ev) => { });
         alert.Show();
     }
     else
     {
         Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
         AlertDialog alert = dialog.Create();
         alert.SetTitle("Success");
         alert.SetMessage("Request success, please check your email");
         alert.SetButton("OK", (c, ev) =>
         {
             // Ok button click task
         });
         alert.Show();
     }
 }
Exemplo n.º 15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_doc_scan_ui_main);

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            CurrentActivity = this;
            imageListView   = FindViewById <ListView>(Resource.Id.list);

            btScan        = FindViewById <Button>(Resource.Id.btScan);
            btScan.Click += (sender, e) =>
            {
                // if "scan document" is called repeatedly the user will be warned that scan results from the previous pass will get lost:
                if (FullImagePath != null &&
                    FullImagePath.Length > 0)
                {
                    Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
                    builder.SetTitle("Confirm");
                    builder.SetMessage("If you perform new scans existing scans will be overwritten");

                    builder.SetPositiveButton("Ok", (senderAlert, args) => {
                        callDocumentScanViewUIActivity();
                    });

                    Android.App.AlertDialog alert = builder.Create();
                    alert.Show();
                }
                else
                {
                    callDocumentScanViewUIActivity();
                }
            };
        }
Exemplo n.º 16
0
 public override void OnBackPressed()
 {
     Android.App.AlertDialog.Builder builder    = new Android.App.AlertDialog.Builder(this);
     Android.App.AlertDialog         alerDialog = builder.Create();
     alerDialog.SetTitle("Gracias");
     //poner imagen de respuesta incorrecta
     //alerDialog.SetIcon(Resource.Drawable.Icon);
     alerDialog.SetMessage("Por favor danos tu opinión sobre tu experiencia con la aplicación");
     alerDialog.SetButton("Ir a feedback", (se, eve) =>
     {
         try
         {
             var uri    = Android.Net.Uri.Parse("https://docs.google.com/forms/d/e/1FAIpQLSe_BMvCLkessoOfpOSJsg1bcb49K3U_oj3OQH8r2yYMZX0tRA/viewform?usp=sf_link");
             var intent = new Intent(Intent.ActionView, uri);
             StartActivity(intent);
             Finish();
         }catch (Exception e)
         {
         }
     });
     alerDialog.SetButton2("Ahora no", (se, eve) =>
     {
         Finish();
     });
     alerDialog.CancelEvent += OnDialogCancel;
     alerDialog.Show();
     //base.OnBackPressed(); -> DO NOT CALL THIS LINE OR WILL NAVIGATE BACK
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Project.Resource.Layout.layout1, container, false);

            e1 = view.FindViewById <EditText>(Resource.Id.cname);
            e2 = view.FindViewById <EditText>(Resource.Id.number);
            e3 = view.FindViewById <EditText>(Resource.Id.expire);
            e4 = view.FindViewById <EditText>(Resource.Id.cvv);
            p  = view.FindViewById <Button>(Resource.Id.pay);

            p.Click += delegate
            {
                Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this.Context);
                Android.App.AlertDialog         alert  = dialog.Create();
                alert.SetTitle("Thank you");
                alert.SetMessage("Hope we see you again");
                alert.SetButton("ok", (c, ev) =>
                {
                });
                alert.Show();
            };
            return(view);
        }
Exemplo n.º 18
0
        void myListViewEvent(object sender, AdapterView.ItemClickEventArgs e)
        {
            var index = e.Position;

            UserObject value = myUserList[index];

            System.Console.WriteLine("Value " + value.name);

            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(context);
            Android.App.AlertDialog         alert  = dialog.Create();
            alert.SetTitle("Favourite!");
            alert.SetMessage("Add To Favourites?");

            alert.SetButton("Add", (c, ev) =>
            {
                dbhelper = new DBHelper(context);

                dbhelper.insertFavouritetable(value.id, value.name, value.address, value.day, value.price, value.category);
            });

            alert.SetButton2("Cancel", (c, ev) =>

            {
                var activity = new Intent(context, typeof(homeActivity));
                //activity.PutExtra("Value", value.name);
                StartActivity(activity);
            });

            alert.Show();

            /*var activity = new Intent(context, typeof(EventActivity));
             * activity.PutExtra("Value", value.name);
             * StartActivity(activity);*/
        }
Exemplo n.º 19
0
 private void login()
 {
     if (login_admin.Checked)
     {
         cursor = myDB.SelectMyAdmindata();
         cursor.MoveToFirst();
         var un   = cursor.GetString(cursor.GetColumnIndexOrThrow("adm_name"));
         var pswd = cursor.GetString(cursor.GetColumnIndexOrThrow("adm_password"));
         if (login_username.Text == un && login_passowrd.Text == pswd)
         {
             System.Console.WriteLine("Successfully logged in!!");
             Intent newscreen = new Intent(this, typeof(Activity));
             StartActivity(newscreen);
         }
         else
         {
             alert.SetTitle("Error!");
             alert.SetMessage("Wrong Username or Password...");
             alert.SetPositiveButton("Ok", alertOKButton);
             Android.App.AlertDialog myDialog = alert.Create();
             myDialog.Show();
         }
     }
     else
     {
         cursor = myDB.SelectSalesPersonData(login_username.Text);
         cursor.MoveToFirst();
         if (cursor == null)
         {
             alert.SetTitle("Error!");
             alert.SetMessage("This email id is not registered..");
             alert.SetPositiveButton("Ok", alertOKButton);
             Android.App.AlertDialog myDialog = alert.Create();
             myDialog.Show();
         }
         else
         {
             var un    = cursor.GetString(cursor.GetColumnIndexOrThrow("sp_email"));
             var pswd  = cursor.GetString(cursor.GetColumnIndexOrThrow("sp_password"));
             var fname = cursor.GetString(cursor.GetColumnIndexOrThrow("first_name"));
             var lname = cursor.GetString(cursor.GetColumnIndexOrThrow("last_name"));
             if (login_username.Text == un && login_passowrd.Text == pswd)
             {
                 System.Console.WriteLine("Successfully logged in!!");
                 Intent newscreen = new Intent(this, typeof(sales_person_dashboard));
                 newscreen.PutExtra("email", login_username.Text);
                 newscreen.PutExtra("salesPersonName", fname + " " + lname);
                 StartActivity(newscreen);
             }
             else
             {
                 alert.SetTitle("Error!");
                 alert.SetMessage("Wrong Username or Password...");
                 alert.SetPositiveButton("Ok", alertOKButton);
                 Android.App.AlertDialog myDialog = alert.Create();
                 myDialog.Show();
             }
         }
     }
 }
Exemplo n.º 20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            using (var db = new SQLiteConnection (dbPath)) {
                db.CreateTable<LogEntry> ();
            }

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

            // Create our database if it does not already exist

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

            addFood.Click += (object sender, EventArgs e) =>
            {
                AlertDialog.Builder addFoodDialogBuilder = new AlertDialog.Builder(this);
                addFoodDialogBuilder.SetTitle ("I had something to eat and it was:");
                addFoodDialogBuilder.SetSingleChoiceItems (choices, -1, clickFoodDialogList);

                addFoodDialog = addFoodDialogBuilder.Create();
                // Show the alert dialog to the user and wait for response.
                addFoodDialog.Show();
            };
        }
Exemplo n.º 21
0
 //Al dar click en la foto
 private void perfil_Click(object sender, EventArgs e)
 {
     Android.App.AlertDialog.Builder builder    = new Android.App.AlertDialog.Builder(this);
     Android.App.AlertDialog         alerDialog = builder.Create();
     //Titulo
     alerDialog.SetTitle("PERFIL");
     //Icono
     alerDialog.SetIcon(Resource.Drawable.Perfil);
     //Pregunta
     alerDialog.SetMessage("¿Desea cambiar la foto de Perfil?");
     alerDialog.SetButton("No", (s, ev) =>
     {
         StartActivity(typeof(VerPerfil));
     });
     alerDialog.SetButton3("Si", (s, ev) =>
     {
         try
         {
             Intent intent = new Intent(MediaStore.ActionImageCapture);
             StartActivityForResult(intent, 0);
         }
         catch (Exception ex)
         {
         }
     });
     alerDialog.Show();
 }
Exemplo n.º 22
0
        void CallAlert(string title, string cardLinkId = null, bool orderButtonShown = true, bool linkedSuccessfully = false)
        {
            Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
            if (cardLinkId != null)
            {
                builder.SetPositiveButton(TranslationHelper.GetString("yes", GetCurrentCulture.GetCurrentCultureInfo()), async(object s, DialogClickEventArgs e) => { await LinkCard(cardLinkId); });
                builder.SetNegativeButton(TranslationHelper.GetString("no", GetCurrentCulture.GetCurrentCultureInfo()), (object s, DialogClickEventArgs e) => { });
            }
            else
            {
                builder.SetPositiveButton("OK", (object s, DialogClickEventArgs e) =>
                {
                    if (linkedSuccessfully)
                    {
                        OnBackPressed();
                    }
                });
                if (orderButtonShown)
                {
                    builder.SetNeutralButton(TranslationHelper.GetString("orderStickerWithQr", GetCurrentCulture.GetCurrentCultureInfo()), (object s, DialogClickEventArgs e) => OpenOrderLink(s, e));
                }
            }

            builder.SetMessage(title);
            Android.App.AlertDialog dialog = builder.Create();
            dialog.Show();
        }
Exemplo n.º 23
0
        void Mylist_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this.Activity);
            Android.App.AlertDialog         alert  = dialog.Create();

            alert.SetTitle("Remove Party from Queue");
            alert.SetMessage("Are you sure you want to remove this party from the queue?");
            alert.SetButton("Yes", (c, ev) =>
            {
                var firebase = new FirebaseClient(FBURL);

                firebase
                .Child("queues")
                .Child(auth.CurrentUser.Uid)
                .Child(listQueue[e.Position].account_uid)
                .DeleteAsync();

                listQueue.Remove(listQueue[e.Position]);
                CustomQueueListAdapter adapter = new CustomQueueListAdapter(this, listQueue);

                mylist.Adapter = adapter;

                Toast.MakeText(this.Activity, "Party has been removed from the Queue", ToastLength.Short).Show();
            });
            alert.SetButton2("No", (c, ev) =>
            {
            });
            alert.Show();
        }
Exemplo n.º 24
0
        public async void Load()
        {
            LoadingDialog builder = new LoadingDialog(this).SetMessage("Загрузка...");

            Android.App.AlertDialog dialog = builder.Create();
            dialog.Show();

            string response = await Connector.GetAsync("phrase.set") ?? "{}";

            var data = JObject.Parse(response);

            if (data?["status"] == null)
            {
                Toast.MakeText(this, "Произошла ошибка :(", ToastLength.Short).Show();
                dialog.Dismiss();
                Finish();
                return;
            }

            Phrases = new List <Phrase>();
            foreach (var item in (JArray)data["result"])
            {
                Phrase ph = new Phrase {
                    Id   = Convert.ToInt32(item["id"]),
                    Text = Convert.ToString(item["text"])
                };
                Phrases.Add(ph);
            }

            BuildElements();
            dialog.Dismiss();
        }
Exemplo n.º 25
0
        private void ShowLogoutDialog()
        {
            builder     = new Android.App.AlertDialog.Builder(mainActivity);
            alertDialog = builder.Create();
            alertDialog.SetMessage("Do you want to log out?");
            alertDialog.SetButton("Yes", (s1, e1) =>
            {
                var auth = sessionManager.GetFirebaseAuth();
                editor   = preferences.Edit();
                LoginManager.Instance.LogOut();
                auth.SignOut();
                editor.Clear();
                editor.Commit();

                var intent = new Intent(Application.Context, typeof(OnboardingActivity));
                intent.SetFlags(ActivityFlags.ClearTask | ActivityFlags.ClearTop | ActivityFlags.NewTask);
                StartActivity(intent);
                mainActivity.Finish();
            });

            alertDialog.SetButton2("No", (s2, e2) =>
            {
                alertDialog.Dismiss();
            });
            alertDialog.Show();
        }
Exemplo n.º 26
0
        /*protected override void OnResume()
         * {
         *  base.OnResume();
         *  locationManager.RequestLocationUpdates(provider, 1, 1, this);
         * }
         *
         * protected override void OnPause()
         * {
         *  base.OnPause();
         *  locationManager.RemoveUpdates(this);
         * }*/
        async void FnProcessOnMap()
        {
            try
            {
                await FnLocationToLatLng();

                FnUpdateCameraPosition(latLngSource);
            }
            catch (Exception e)
            {
                Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alert  = dialog.Create();
                alert.SetTitle("No Connection");
                alert.SetMessage("Please turn on the Internet");
                alert.SetButton("OK", (c, ev) =>
                {
                    StartActivity(new Android.Content.Intent(Application.Context, typeof(MainPage)));
                });
                alert.Show();
            }

            if (latLngSource != null && latLngDestination != null)
            {
                FnDrawPath(strSourceLocation, strDestinationLocation);
            }
        }
Exemplo n.º 27
0
        void call_premium_option_menu(bool showRestricion = false)
        {
            Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
            //builder.SetTitle(TranslationHelper.GetString("moreAboutPremium", ci));
            builder.SetNegativeButton(TranslationHelper.GetString("cancel", _ci), (object sender1, DialogClickEventArgs e1) => { });
            if (!_databaseMethods.UserExists())
            {
                //constraintItems = new string[] { "Подробнее о Premium", "Войти в учетную запись" };
                builder.SetPositiveButton(TranslationHelper.GetString("login", _ci), (object sender1, DialogClickEventArgs e1) =>
                {
                    StartActivity(typeof(EmailActivity));
                });
                builder.SetNeutralButton(TranslationHelper.GetString("premium", _ci), (object sender1, DialogClickEventArgs e1) =>
                {
                    StartActivity(typeof(PremiumActivity));
                });
            }

            if (showRestricion)
            {
                builder.SetMessage(TranslationHelper.GetString("workOnSeveralDevicesRestricted", _ci));
            }
            else
            {
                builder.SetMessage(TranslationHelper.GetString("cardsLimitHasBeenReached", _ci));
            }
            Android.App.AlertDialog dialog = builder.Create();
            dialog.Show();
        }
 public void ShowConfirmDelete(string alerTitle, string alertMessage, string id)
 {
     Android.App.AlertDialog.Builder showDialog = new Android.App.AlertDialog.Builder(this);
     Android.App.AlertDialog         Alert      = showDialog.Create();
     Alert.SetTitle(alerTitle);
     Alert.SetMessage(alertMessage);
     Alert.SetButton("YES", delegate
     {
         try
         {
             string URL = "https://download-tracker.herokuapp.com/movies/" + id;
             DeleteMovie(URL);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     });
     Alert.SetButton2("NO", delegate
     {
         Alert.Dismiss();
         Alert.Dispose();
         return;
     });
     Alert.Show();
 }
Exemplo n.º 29
0
        async void ExtractText()
        {
            try
            {
                //await CrossMedia.Current.Initialize();
                var xFile = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
                {
                    SaveToAlbum = true,
                    Directory   = "Sample",
                    Name        = "test.jpg"
                });

                //svar filepath = "/storage/emulated/0/Android/data/Tesseract.Android.Tesseract.Android/files/Pictures/Sample/test_3.jpg";
                dialog = new ProgressDialog(this);
                dialog.SetMessage("Extracting Text");
                dialog.Show();
                await api.SetImage(xFile.GetStream());

                dialog.Hide();
                Android.App.AlertDialog.Builder builder1 = new Android.App.AlertDialog.Builder(this);
                builder1.SetMessage(api.Text);
                builder1.SetCancelable(true);
                Android.App.AlertDialog alert11 = builder1.Create();
                alert11.Show();
                string text = api.Text;
            }
            catch (Exception e)
            {
            }
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                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) =>
                {
                    Finish();
                });

                alert.Show();
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
Exemplo n.º 31
0
 private void setAlert(string message)
 {
     Android.App.AlertDialog.Builder alert       = new Android.App.AlertDialog.Builder(this);
     Android.App.AlertDialog         alertDialog = alert.Create();
     alertDialog.SetTitle(message);
     alertDialog.Show();
 }
Exemplo n.º 32
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            this.SetContentView(Resource.Layout.activity_main);
            activity = this;

            BottomNavigationView navigation = (BottomNavigationView)FindViewById <BottomNavigationView>(Resource.Id.bottom_navigation);

            navigation.SetOnNavigationItemSelectedListener(this);
            Android.Support.V4.App.Fragment fragment = null;
            fragment = categoriesFragment.NewInstance();
            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, fragment)
            .Commit();
            var connectivity = Connectivity.NetworkAccess;

            if (connectivity != NetworkAccess.Internet)
            {
                Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alert  = dialog.Create();
                alert.SetTitle("Error");
                alert.SetMessage("Device is not connected to the internet, please check network connection");
                alert.SetButton("OK", (c, ev) =>
                {
                    this.FinishAffinity();
                });
                alert.Show();
            }

            if (CheckSelfPermission(Android.Manifest.Permission.AccessCoarseLocation) != (int)Permission.Granted)
            {
                RequestPermissions(new string[] { Android.Manifest.Permission.AccessCoarseLocation, Android.Manifest.Permission.AccessFineLocation }, 0);
            }
        }
Exemplo n.º 33
0
        private void Propinabtn_Click(object sender, EventArgs e)
        {
            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           view           = layoutInflater.Inflate(Resource.Layout.propinapopup, null);

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetView(view);
            builder.SetTitle("¿Caunto deseas agregar de propina?");
            var propinaa = view.FindViewById <EditText>(Resource.Id.lineapropina);

            builder.SetCancelable(false)
            .SetPositiveButton("Donar", (c, ev) =>
            {
                string lo            = propinaa.Text;
                propina.Text         = "$" + lo + ".00";
                propinaagregada.Text = "$" + lo + ".00";
                float gamesa         = float.Parse(lo);
                AddData(gamesa);
            })
            .SetNegativeButton("Cancelar", (c, ev) =>
            {
                propina.Text         = "$0.00";
                propinaagregada.Text = "$0.00";
            });
            AlertDialog lala = builder.Create();

            lala.Show();
        }
Exemplo n.º 34
0
 private void ShowDialogInUiThread(AlertDialog.Builder builder)
 {
     CloseDialog();
     Mvx.Resolve<IMvxMainThreadDispatcher>().RequestMainThreadAction(() =>
     {
         _currentDialog = builder.Create();
         _currentDialog.Show();
     });
 }
 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();
 }
Exemplo n.º 36
0
		public static void MakeErrorPopUp(Activity activity, ErrorType error)
		{
			if (activity == null) throw new ArgumentNullException("activity");

			activity.RunOnUiThread(() =>
			{
				_errorDialog = new AlertDialog.Builder(activity)
					.SetPositiveButton(Resource.String.TryAgainButtonText, OnTryAgainButtonClicked)
					.SetTitle(ResolveErrorTitle(error))
					.SetMessage(ResolveErrorMessage(error))
					.Create();
				_errorDialog.Show();
			});
		}
        protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
        {
            base.OnElementChanged(e);

            var page = e.NewElement as MainPage;

            if (page != null) {

                MessagingCenter.Subscribe(page, "KillActionSheet", (MainPage sender) => {

                    if (actionSheet != null) actionSheet.Dismiss();

                });

                MessagingCenter.Subscribe(page, "DisplayCustomAndroidActionSheet", (MainPage sender, CustomAndroidActionSheetArguments args) => {

                    var builder = new AlertDialog.Builder (Forms.Context);

                    builder.SetTitle(args.Title);

                    var items = args.Buttons.ToArray();

                    builder.SetItems(items, (sender2, args2) => args.Result.TrySetResult(items[args2.Which]));

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

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

                    actionSheet = builder.Create();

                    builder.Dispose();

                    actionSheet.SetCanceledOnTouchOutside(true);

                    actionSheet.CancelEvent += (sender3, ee) => args.SetResult(null);

                    actionSheet.Show();
                });
            }
        }
Exemplo n.º 38
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;
        }
Exemplo n.º 39
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;
        }
Exemplo n.º 40
0
 void DelegatDlaItemClick(AdapterView.ItemClickEventArgs e)
 {
     Tuple<string, string> item = lv.GetItemAtPosition(e.Position).Cast<Tuple<string, string>>();
     if (item.Item1 == nickname)
         return;
     ad = new AlertDialog.Builder(this).Create();
     ad.SetCancelable(false); // This blocks the 'BACK' button
     ad.SetMessage(string.Format("Czy chcesz zaprosiæ u¿ytkownika {0} do gry?", item.Item1));
     ad.SetButton("Nie", delegate
     {
     });
     ad.SetButton2("Tak", delegate
     {
         byte[] buff = new byte[MainActivity.MAX_LENGTH];
         buff = System.Text.Encoding.ASCII.GetBytes(string.Format("{0};{1}", Convert.ToInt32(MessageTypes.Invite), item.Item1));
         Sockets.client.GetStream().Write(buff, 0, buff.Length);
     });
     ad.Show();
 }
Exemplo n.º 41
0
		public void DatePickDialogShow(EditText edit_birth)
		{
			var datepickerlayout = (LinearLayout) activity.LayoutInflater.Inflate (Resource.Layout.commondatepickerlayout, null);
			datePicker = datepickerlayout.FindViewById<DatePicker> (Resource.Id.datepicker);
			InitDatePicker (datePicker);
		
			var builder = new AlertDialog.Builder (activity).SetView(datepickerlayout);
			builder.SetPositiveButton ("设置", (sender, e) => {
				dialog.Dismiss();	
				edit_birth.Text = dateTime;

			});
			builder.SetNegativeButton ("取消", (sender, e) => {
				dialog.Dismiss();	

			});
			dialog= builder.Create ();

			dialog.Show();
			OnDateChanged (null, 0, 0, 0);
		}
Exemplo n.º 42
0
		public void TimePickDialogShow(EditText edit_inputTime)
		{
			var timepickerlayout = (LinearLayout) activity.LayoutInflater.Inflate (Resource.Layout.commontimepickerlayout, null);
			timePicker = (TimePicker) timepickerlayout.FindViewById<TimePicker>(Resource.Id.timepicker); 
			InitTimePicker (timePicker);
			timePicker.SetIs24HourView(Java.Lang.Boolean.ValueOf(true)); 
			timePicker.SetOnTimeChangedListener(this);  
			var builder = new AlertDialog.Builder (activity).SetView(timepickerlayout);
			builder.SetPositiveButton ("设置", (sender, e) => {
				dialog.Dismiss();	
				edit_inputTime.Text = dateTime;

			});
			builder.SetNegativeButton ("取消", (sender, e) => {
				dialog.Dismiss();	

			});
			dialog= builder.Create ();

			dialog.Show();
			OnTimeChanged (null,0,0);
		}
Exemplo n.º 43
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            #region Step 1. Load your main layout

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

            #endregion

            #region Step 2. Get the button that was declared in xml

            var b = FindViewById<Button>(Resource.Id.flag_button);
            b.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.flag));

            #endregion

            #region Step 3. Build Alert Dialog

            var builder = new AlertDialog.Builder(this);
            builder.SetMessage(Resource.String.dialog_text)
                .SetCancelable(false)
                .SetTitle(GetString(Resource.String.dialog_title))
                .SetPositiveButton("Done", (o, args) => ((Dialog) o).Dismiss());

            _alert = builder.Create();

            #endregion

            #region Step 4. Wire up button click event to show alert.

            b.Click += (o, args) => _alert.Show();

            #endregion
        }
		private void showScorePopup(int i)
		{
			// Get the match model we want to update the score with
			TournamentProgramModel match = program[i];

			// Inflate the popup view
			View popupView = LayoutInflater.Inflate(Resource.Layout.SetScore, FindViewById<ViewGroup>(Resource.Id.tournamentProgram), false);	

			// Set the labels
			TextView labelTeam1 = (TextView) popupView.FindViewWithTag("labelTeam1");
			labelTeam1.SetText("Score team "+match.NameTeam1, EditText.BufferType.Normal);
			TextView labelTeam2 = (TextView) popupView.FindViewWithTag("labelTeam2");
			labelTeam2.SetText("Score team "+match.NameTeam2, EditText.BufferType.Normal);

			// Set the values of the editText fields if the match has a score
			EditText scoreTeam1 = popupView.FindViewById<EditText>(Resource.Id.setScoreTeam1);
			if(match.ScoreTeam1 != null) scoreTeam1.Text = ""+match.ScoreTeam1;
			EditText scoreTeam2 = popupView.FindViewById<EditText>(Resource.Id.setScoreTeam2);
			if(match.ScoreTeam2 != null) scoreTeam2.Text = ""+match.ScoreTeam2;

			// Button click listener
			var builder = new AlertDialog.Builder(this);
			Button buttonSet = (Button) popupView.FindViewWithTag("button");
			buttonSet.Click += delegate {
				match.ScoreTeam1 = Convert.ToInt32(scoreTeam1.Text);
				match.ScoreTeam2 = Convert.ToInt32(scoreTeam2.Text);
				setScore(match);
			};

			// Show popup
			builder.SetView(popupView);
			dialog = builder.Create();
			dialog.Show();
		}
Exemplo n.º 45
0
        void MessageExecuteThread()
        {
            byte[] buffer;
            NetworkStream stream = Sockets.client.GetStream();

            while (Sockets.client.Connected)
            {
                if (thLock)
                    continue;

                if (isPlaying)
                {
                    buffer = System.Text.Encoding.ASCII.GetBytes(string.Format("{0};{1}", Convert.ToInt32(MessageTypes.ListRequestClient), nickname));
                    stream.Write(buffer, 0, buffer.Length);
                    isPlaying = false;
                }

                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.SendPlayers:
                            ParsePlayerList(data[1]);
                            lv.Post(delegate { lv.Adapter = new PlayerListAdapter(this, this.data); });
                            break;
                        case MessageTypes.InviteClient:
                            if (data[1] == nickname)
                                break;
                            RunOnUiThread(delegate
                            {                                
                                ad = new AlertDialog.Builder(this).Create();
                                ad.SetCancelable(false); // This blocks the 'BACK' button
                                ad.SetMessage(string.Format("Masz zaproszenie do gry od {0}.", data[1]));                                
                                ad.SetButton("Odrzuæ", delegate 
                                {
                                    buffer = System.Text.Encoding.ASCII.GetBytes(string.Format("{0};{1}", Convert.ToInt32(MessageTypes.Decline), data[1]));
                                    stream.Write(buffer, 0, buffer.Length);
                                    czyOtwartyAlert = false;
                                });
                                ad.SetButton2("Akceptuj", delegate
                                {
                                    buffer = System.Text.Encoding.ASCII.GetBytes(string.Format("{0};{1}", Convert.ToInt32(MessageTypes.Accept), data[1]));
                                    stream.Write(buffer, 0, buffer.Length);
                                    czyOtwartyAlert = false;
                                });
                                ad.Show();
                            });
                            czyOtwartyAlert = true;
                            while (czyOtwartyAlert)
                                continue;
                            Thread.Sleep(100);
                            break;
                        case MessageTypes.StartClient:
                            RunOnUiThread(delegate
                            {
                                Intent intent = new Intent(this, typeof(GameActivity));
                                intent.PutExtra("Nickname", nickname);
                                intent.PutExtra("Data", data[1]);
                                StartActivity(intent);
                            });
                            thLock = true;
                            isPlaying = true;
                            break;
						case MessageTypes.PlayerIsBusy:
							RunOnUiThread(delegate {
								ad = new AlertDialog.Builder(this).Create();
								ad.SetCancelable(false); // This blocks the 'BACK' button
								ad.SetMessage(string.Format("Gracz {0} jest zajêty.", data[1]));
								ad.SetButton("Zamknij", delegate {});
								ad.Show();
							});
							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();
                    });
                }
            }
        }
Exemplo n.º 46
0
        private void clickFoodDialogList(object sender, DialogClickEventArgs args)
        {
            listChoice = choices [args.Which];

            Console.WriteLine ("Selected: {0}", args.Which);

            // Open a confirmation alert
            AlertDialog.Builder confirmFoodDialogBuilder = new AlertDialog.Builder(this);
            confirmFoodDialogBuilder.SetTitle ("Confirm selection");

            confirmFoodDialogBuilder.SetMessage ("You are adding the following choice: " +
            listChoice + ".  Do you wish to proceed?");

            // Insert the selection into the database on confirmation
            confirmFoodDialogBuilder.SetPositiveButton ("Confirm", delegate {
                dismissAddFoodDialog ();

                LogEntry newLog = new LogEntry {
                    LoggedAt = DateTime.Now,
                    Level = LogEntry.MapToLevel(args.Which)
                };

                using (var db = new SQLiteConnection(dbPath)) {
                    db.Insert (newLog);
                    var count = db.ExecuteScalar<int> ("Select COUNT(*) from LogEntry");
                    Console.WriteLine("There are now {0} Log Entries", count);
                }
            });

            // Close all alerts if the user cancels at this point
            confirmFoodDialogBuilder.SetNegativeButton ("Cancel", delegate {
                dismissAddFoodDialog ();
            });

            confirmFoodDialog = confirmFoodDialogBuilder.Create ();
            confirmFoodDialog.Show ();
        }
Exemplo n.º 47
0
        //Push data when the platform requests, works the same way as in console.
        //For the sake of this sample, we added here an Android fragment(a popup) that ask the user to enter the CVV when using a Magnetic stripe card.
        private void TransactionOrchestratorOnDataRequested(CollectInputParameters obj)
        {
            try
            {
                if (_progressDialog.IsShowing)
                {
                    _progressDialog.Dismiss();
                }

                switch (obj.Reference)
                {
                    case "CVV":
                        var cvvDialog = InputDialogFragment.NewInstance(this, "PI", obj.Message, (cvvValue) =>
                        {
                            string result = cvvValue == 0 ? "" : cvvValue.ToString();
                            var cvvParameter = new CollectOutputParameters() { Reference = obj.Reference, Value = result };
                            _transactionOrchestrator.PushData(cvvParameter);
                        });
                        cvvDialog.Show(FragmentManager, "fragment_cvv");
                        break;
                    case "CVVState":
                        var items = new List<string>();
                        foreach (var item in obj.Options)
                        {
                            items.Add(item.Value);
                        }

                        AlertDialog.Builder builder = new AlertDialog.Builder(this);
                        builder.SetTitle(obj.Message)
                               .SetItems(items.ToArray(), (sender, e) =>
                               {
                                   var selectedValue = items[e.Which];
                                   foreach (var item in obj.Options)
                                   {
                                       if (item.Value == selectedValue)
                                       {
                                           var cvvStateParameter = new CollectOutputParameters() { Reference = obj.Reference, Value = item.Key.ToString() };
                                           _transactionOrchestrator.PushData(cvvStateParameter);
                                           break;
                                       }
                                   }
                               });

                        dialog = builder.Create();
                        dialog.Show();
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
                Helpers.Alert(this, "PI - TransactionOrchestratorOnDataRequested - Error", ex.Message, false);
            }
        }
		/// <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;
		}
Exemplo n.º 49
0
        private void FindServers()
        {
            RemoveDiscoveryListener ();
            _serverIps = new List<string> ();
            var builder = new AlertDialog.Builder (this);
            builder.SetTitle ("Pick a server to pair with:");
            _alertDialog = builder.Create ();
            _listServers = new ListView (this);
            _listServers.Adapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleSpinnerItem, _serverIps);
            _listServers.ItemClick += _listServersItemClick;
            _alertDialog.SetView (_listServers);
            _alertDialog.Show ();

            _autoDiscovery = new AutoDiscoveryClient ();
            _autoDiscovery.NewServerFound += _newServerFound;
            _autoDiscovery.Start ();
        }
        public string ShowKeyboardInput(
            string defaultText)
        {

            var waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);

            OnKeyboardWillShow();

            IsVisible = true;



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

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

                    // Set the input fields input filter to accept only uppercase
                    input.SetFilters ( new Android.Text.IInputFilter[] { new Android.Text.InputFilterAllCaps() });

                    if (defaultText != null)
                    {
                        input.SetSelection(defaultText.Length);
                    }
                    alert.SetView(input);

                    alert.SetPositiveButton("Ok", (dialog, whichButton) =>
                        {
                            ContentText = input.Text;
                            waitHandle.Set();
                            IsVisible = false;
                            OnKeyboardWillHide();
                        });

                    alert.SetNegativeButton("Cancel", (dialog, whichButton) =>
                        {
                            ContentText = null;
                            waitHandle.Set();
                            IsVisible = false;
                            OnKeyboardWillHide();
                        });
                    alert.SetCancelable(false);

                    alertDialog = alert.Create();
                    alertDialog.Show();
                    OnKeyboardDidShow();

                });
            waitHandle.WaitOne();

            if (alertDialog != null)
            {
                alertDialog.Dismiss();
                alertDialog.Dispose();
                alertDialog = null;
            }

            OnReplaceText(new CCIMEKeybardEventArgs(contentText, contentText.Length));
            IsVisible = false;

            return contentText;
        }
Exemplo n.º 51
0
		public void OnConnectionRequest (string remoteEndpointId, string remoteDeviceId, string remoteEndpointName, byte[] payload)
		{
			DebugLog ("onConnectionRequest:" + remoteEndpointId + ":" + remoteEndpointName);

			// This device is advertising and has received a connection request. Show a dialog asking
			// the user if they would like to connect and accept or reject the request accordingly.
			mConnectionRequestDialog = new AlertDialog.Builder (this)
				.SetTitle ("Connection Request")
				.SetMessage ("Do you want to connect to " + remoteEndpointName + "?")
				.SetCancelable (false)
				.SetPositiveButton ("Connect", (sender, e) => {
					byte[] pLoad = null;
					NearbyClass.Connections.AcceptConnectionRequest (mGoogleApiClient, 
						remoteEndpointId, pLoad, this).SetResultCallback ((Statuses status) => {
							if (status.IsSuccess) {
								DebugLog ("acceptConnectionRequest: SUCCESS");
								mOtherEndpointId = remoteEndpointId;
								UpdateViewVisibility (NearbyConnectionState.Connected);
							} else {
								DebugLog ("acceptConnectionRequest: FAILURE");
							}
						});
				})
				.SetNegativeButton ("No", (sender, e) => NearbyClass.Connections.RejectConnectionRequest (mGoogleApiClient, remoteEndpointId))
				.Create ();

			mConnectionRequestDialog.Show ();
		}