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();
        }
Esempio n. 2
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();
        }
        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 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();
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Rating);

            // Create your application here
            RatingBar   ratingBar  = FindViewById <RatingBar>(Resource.Id.ratingBar);
            var         btn_submit = FindViewById <Button>(Resource.Id.btn_submit);
            ImageButton img_Back   = FindViewById <ImageButton>(Resource.Id.imageButton_Back);

            img_Back.Click   += Img_Back_Click;
            btn_submit.Click += (s, e) =>
            {
                Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alert  = dialog.Create();
                alert.SetTitle("Rating Garage");
                alert.SetMessage("Thanks a lot for your feedback!");
                alert.SetButton("Back", (c, ev) =>
                {
                    StartActivity(typeof(MainPage));
                });
                alert.Show();
            };
        }
Esempio n. 7
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            // Si selecciona icon exit
            if (item.ItemId == Resource.Id.exit)
            {
                AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                AlertDialog         alert  = dialog.Create();
                alert.SetTitle("Salir");
                alert.SetMessage("¿Estás seguro?");
                alert.SetIcon(Resource.Drawable.logo);
                alert.SetButton("Si", (c, ev) =>
                {
                    this.FinishAffinity();
                    Finish();
                    Android.OS.Process.KillProcess(Android.OS.Process.MyPid());

                    GC.Collect();
                });

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

            return(base.OnOptionsItemSelected(item));
        }
 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();
 }
        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));
            }
        }
Esempio n. 10
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();
 }
Esempio n. 11
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();
     }
 }
Esempio n. 12
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);
            }
        }
        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();
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (item.ItemId == Resource.Id.filter)
            {
                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 eliminar los filtros aplicados?");
                alert.SetButton("Si", (c, ev) =>
                {
                    Intent data = new Intent();

                    data.PutExtra(FILTER_RESULT, JsonConvert.SerializeObject(null));

                    SetResult(Result.Ok, data);
                    Finish();
                });

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

                alert.Show();
                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }
 // Initiates a dialogue to be shown to the end use if the form has invalid inputs.
 private void InitiateInvalidInputsAlertDialogue()
 {
     invalidInputsAlert = new AlertDialog.Builder(this).Create();
     invalidInputsAlert.SetTitle("Invalid Fields");
     invalidInputsAlert.SetMessage("Please complete all required fields.");
     invalidInputsAlert.SetButton("Okay", (sender, args) => { invalidInputsAlert.Dismiss(); });
 }
Esempio n. 16
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();
        }
Esempio n. 17
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();
        }
Esempio n. 18
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);
            }
        }
 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();
     }
 }
Esempio n. 20
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);*/
        }
Esempio n. 21
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
 }
        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();
        }
        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);
        }
Esempio n. 24
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));
        }
Esempio n. 25
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();
                });
            }
        }
        private void MToolBar_MenuItemClick(object sender, SupportToolbar.MenuItemClickEventArgs e)
        {
            if (e.Item.ItemId == Resource.Id.menuItem_copy)
            {
                //copy here
                GlobalVariables.parentProductCopyHolder.Clear();
                GlobalVariables.newProductCopyHolder.Clear();
                CopyData();
                Toast.MakeText(this, "Product copied!", ToastLength.Long).Show();
            }
            else if (e.Item.ItemId == Resource.Id.menuItem_paste)
            {
                if (GlobalVariables.parentProductCopyHolder.Count > 0)
                {
                    Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
                    Android.App.AlertDialog         alert   = builder.Create();
                    alert.SetTitle("Confirm action");
                    alert.SetMessage("Paste copied product?");

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

                    alert.SetButton("YES", (c, ev) =>
                    {
                        PasteData(GlobalVariables.parentProductCopyHolder, GlobalVariables.newProductCopyHolder);
                        Toast.MakeText(this, "Successfully pasted!", ToastLength.Long).Show();
                    });

                    alert.Show();
                }
                else
                {
                    Toast.MakeText(this, "Clipboard is empty!", ToastLength.Long).Show();
                }
            }
            else if (e.Item.ItemId == Resource.Id.menuItem_delete)
            {
                Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
                Android.App.AlertDialog         alert   = builder.Create();
                alert.SetTitle("Delete product");
                alert.SetMessage("Are you sure you want to delete this product? This action cannot be undone.");

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

                alert.SetButton("YES", (c, ev) =>
                {
                    //delete code here
                    DeleteProduct(editParentProductId);
                    Finish();
                });

                alert.Show();
            }
        }
 // Initiates an alert dialogue to provide confirmation for a `delete` action by an end user.
 private void InitiateDeleteAlertDialogue()
 {
     deletionAlert = new AlertDialog.Builder(this).Create();
     deletionAlert.SetTitle("Confirm deletion");
     deletionAlert.SetMessage("Are you sure you wish to delete this question?");
     deletionAlert.SetButton("Confirm", DeletionAlertConfirmButtonClick);
     deletionAlert.SetButton2("Dismiss", (sender, args) => { deletionAlert.Dismiss(); });
 }
Esempio n. 28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_login
                           );
            var clickLogin = FindViewById <Button>(Resource.Id.button);
            var userMail   = FindViewById <EditText>(Resource.Id.etPassword1);
            var userPWD    = FindViewById <EditText>(Resource.Id.etPassword);

            clickLogin.Click += delegate {
                var emailText = Intent.GetStringExtra("eMail");
                var pwdText   = Intent.GetStringExtra("pwd");
                if (emailText.ToString() == userMail.Text.ToString())
                {
                    if (pwdText.ToString() == userPWD.Text.ToString())
                    {
                        Android.App.AlertDialog.Builder dialog1 = new Android.App.AlertDialog.Builder(this);
                        Android.App.AlertDialog         alert1  = dialog1.Create();
                        alert1.SetTitle("Login Sucess");
                        var userNameIntent = Intent.GetStringExtra("userName");
                        alert1.SetMessage($"Hi {userNameIntent} Good Day");
                        alert1.SetButton("OK", (c, ev) =>
                        {
                            StartActivity(typeof(HomeActivity));
                        });
                        alert1.Show();
                    }
                    else
                    {
                        Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                        Android.App.AlertDialog         alert  = dialog.Create();
                        alert.SetTitle("Failed");
                        alert.SetMessage($"Password Incorrect");
                        alert.SetButton("OK", (c, ev) =>
                        {
                            //   StartActivity(i);
                        });
                        alert.Show();
                    }
                }
                else
                {
                    Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                    Android.App.AlertDialog         alert  = dialog.Create();
                    alert.SetTitle("Login Failed");
                    alert.SetMessage("Enter Valid Credentials");
                    alert.SetButton("OK", (c, ev) =>
                    {
                        //   StartActivity(i);
                    });
                    alert.Show();
                }
            };
            var fabClick = FindViewById <FloatingActionButton>(Resource.Id.floatingActionButton);

            fabClick.Click += FabClick_Click;
        }
Esempio n. 29
0
 private void OnPushNotificationReceived(object sender, PushNotificationReceivedEventArgs e)
 {
     Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
     Android.App.AlertDialog         alert   = builder.Create();
     alert.SetTitle(e.Title);
     alert.SetMessage(e.Message);
     alert.SetIcon(Resource.Drawable.mr_dialog_material_background_dark);
     alert.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();
 }
Esempio n. 31
0
 /// <summary>
 /// Método para lançar um alerta caso
 /// o usuário não exista no banco de dados
 /// </summary>
 public void AlertaUsarioNegado()
 {
     Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
     Android.App.AlertDialog         alerta  = builder.Create();
     alerta.SetTitle("ERROR");
     alerta.SetIcon(Android.Resource.Drawable.IcDialogAlert);
     alerta.SetMessage("Dados incorretos!");
     alerta.Show();
 }
Esempio n. 32
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;
        }
        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;
        }
Esempio n. 34
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();
 }
Esempio n. 35
0
 private void addCommonNoteNotFoundDialogElements(AlertDialog.Builder builder)
 {
     builder.SetMessage(GetString(Resource.String.messageNoteNotFound))
             .setTitle(GetString(Resource.String.titleNoteNotFound))
     //		            .setNeutralButton(GetString(Resource.String.btnOk), new OnClickListener() {
     //		                public void onClick(DialogInterface dialog, int which) {
     //		                    dialog.dismiss();
     //		                    Finish();
     //		                }
     //		            })
             ;
 }
		/// <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;
		}
Esempio n. 37
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();
                    });
                }
            }
        }