private void Cartadapter_DeleteItemClick(object sender, CartAdapterClickEventArgs e)
        {
            var key = cartresult[e.Position].ID;


            Android.Support.V7.App.AlertDialog.Builder deletedataAlert = new Android.Support.V7.App.AlertDialog.Builder(this);
            deletedataAlert.SetTitle("REMOVE FROM CART?");
            deletedataAlert.SetMessage("Are you sure?");
            deletedataAlert.SetPositiveButton("Continue", (senderAlert, args) =>
            {
                //services = new MainActivity();
                //FirebaseFirestore database = services.database;
                //services.deleteUser(userID);

                DocumentReference docRef = database.Collection("carts").Document(key);
                docRef.Delete();



                deletedataAlert.Dispose();

                Toast.MakeText(this, "Product Removed Successfully", ToastLength.Long);
            });
            deletedataAlert.SetNegativeButton("Cancel", (senderAlert, args) =>
            {
                deletedataAlert.Dispose();
            });

            deletedataAlert.Show();

            //DocumentReference docref = database.Collection("carts").Document(key);
            //docref.Delete();
        }
示例#2
0
        public async void OnDelete(int id)
        {
            //是否登录
            var user = UserShared.GetAccessToken(this.Activity);

            if (user.access_token == "" || user.RefreshTime.AddSeconds(user.expires_in) < DateTime.Now)
            {
                //未登录或清空Token失效
                //清空Token
                UserShared.Update(this.Activity, new AccessToken());
                await SQLiteUtils.Instance().DeleteUserAll();

                Android.Support.V7.App.AlertDialog.Builder dialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);
                dialog.SetMessage(Resources.GetString(Resource.String.need_login_tip));
                dialog.SetPositiveButton(Resources.GetString(Resource.String.confirm), delegate
                {
                    StartActivityForResult(new Intent(this.Activity, typeof(AuthorizeActivity)), (int)RequestCode.LoginCode);
                    dialog.Dispose();
                });
                dialog.SetNegativeButton(Resources.GetString(Resource.String.cancel), delegate
                {
                    dialog.Dispose();
                });
                dialog.Create().Show();
            }
            else
            {
                var item  = adapter.GetData().Where(a => a.Id == id).FirstOrDefault();
                var child = recyclerView.FindViewWithTag(item.Id);
                child.FindViewById(Resource.Id.imgDelete).Visibility   = ViewStates.Gone;
                child.FindViewById(Resource.Id.progressBar).Visibility = ViewStates.Visible;
                statusesPresenter.DeleteStatus(user, item.Id);
            }
        }
示例#3
0
 protected virtual void ActionHooker()
 {
     logoutBtn.Click += delegate
     {
         Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this);
         alertDialog.SetTitle(GetString(Resource.String.logoutAlert));
         alertDialog.SetIcon(Resource.Drawable.ic4c_192x192);
         alertDialog.SetMessage(GetString(Resource.String.logoutAlertMsg));
         alertDialog.SetPositiveButton(GetString(Resource.String.yes), delegate
         {
             this.Finish();
             StartActivity(typeof(Login));
             alertDialog.Dispose();
         });
         alertDialog.SetNegativeButton(GetString(Resource.String.no), delegate
         {
             alertDialog.Dispose();
         });
         alertDialog.Show();
     };
     menuImageView.Click += delegate
     {
         if (drawerLayout.IsDrawerOpen(navigationView))
         {
             drawerLayout.CloseDrawer(navigationView);
         }
         else
         {
             drawerLayout.OpenDrawer(navigationView);
         }
     };
 }
示例#4
0
        public async void PostBookmark()
        {
            //是否登录
            var user = UserShared.GetAccessToken(this);

            if (user.access_token == "" || user.RefreshTime.AddSeconds(user.expires_in) < DateTime.Now)
            {
                //未登录或清空Token失效
                //清空Token
                UserShared.Update(this, new AccessToken());
                await SQLiteUtils.Instance().DeleteUserAll();

                Android.Support.V7.App.AlertDialog.Builder dialog = new Android.Support.V7.App.AlertDialog.Builder(this);
                dialog.SetMessage(Resources.GetString(Resource.String.need_login_tip));
                dialog.SetPositiveButton(Resources.GetString(Resource.String.confirm), delegate
                {
                    StartActivityForResult(new Intent(this, typeof(LoginActivity)), (int)RequestCode.LoginCode);
                    dialog.Dispose();
                });
                dialog.SetNegativeButton(Resources.GetString(Resource.String.cancel), delegate
                {
                    dialog.Dispose();
                });
                dialog.Create().Show();
            }
            else
            {
                var linkurl = txtLinkUrl.Text;
                var title   = txtTitle.Text;
                var tags    = txtTags.Text;
                var content = txtContent.Text;
                if (linkurl.Length == 0)
                {
                    Toast.MakeText(this, "请输入网址", ToastLength.Short).Show();
                }
                else if (linkurl.Length < 3)
                {
                    Toast.MakeText(this, "网址的内容太少了,至少3个字吧", ToastLength.Short).Show();
                }
                else if (title.Length == 0)
                {
                    Toast.MakeText(this, "请输入标题", ToastLength.Short).Show();
                }
                else if (title.Length < 3)
                {
                    Toast.MakeText(this, "标题的内容太少了,至少3个字吧", ToastLength.Short).Show();
                }
                else
                {
                    dialog.SetMessage(Resources.GetString(Resource.String.addstatusing));
                    dialog.Show();

                    bookmark.LinkUrl = linkurl;
                    bookmark.Summary = content;
                    bookmark.Tags    = tags.Split(',').ToList();
                    bookmark.Title   = title;
                    bookmarkPresenter.BookmarkAdd(user, bookmark);
                }
            }
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.LogOut:

                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("Log Out");
                alert.SetMessage("Do you want Log Out?");
                alert.SetNeutralButton("Yes", delegate {
                    ISharedPreferences preferences  = Application.Context.GetSharedPreferences("RememberMe", FileCreationMode.Private);
                    ISharedPreferencesEditor editor = preferences.Edit();
                    editor.Clear();
                    editor.Apply();

                    Intent intent = new Intent(this, typeof(MainActivity));
                    this.StartActivity(intent);
                    this.Finish();


                    alert.Dispose();
                });
                alert.SetNegativeButton("No", delegate {
                    alert.Dispose();
                });
                alert.Show();

                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
示例#6
0
        private void AddNetwork(object sender, EventArgs e)
        {
            Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(Activity);
            var localView = Activity.LayoutInflater.Inflate(Resource.Layout.MainDialog, null);

            alertDialog.SetView(localView);
            alertDialog.SetTitle("Add new network");
            var name   = localView.FindViewById <TextInputEditText>(Resource.Id.textInputEditText1);
            var button = localView.FindViewById <Button>(Resource.Id.changeLocationButton);

            coords        = new GeoCoords(45, 45);
            view          = localView;
            button.Click += OnPickAPlaceButtonTapped;
            alertDialog.SetNeutralButton("OK", async delegate
            {
                if (name.Text != String.Empty)
                {
                    await adapter.AddNetwork(name.Text, coords);
                }
                alertDialog.Dispose();
            });
            alertDialog.SetNegativeButton("Cancel", delegate
            {
                alertDialog.Dispose();
            });
            alertDialog.Show();
        }
示例#7
0
        private void PromeniTelefon(object sender, EventArgs eventArgs)
        {
            var inflater = LayoutInflater.From(this);

            var view = inflater.Inflate(Resource.Layout.PromeniMailTelefon, null);

            var dialog = new Android.Support.V7.App.AlertDialog.Builder(this);

            dialog.SetView(view);

            view.FindViewById <TextView>(Resource.Id.mailTelefonNaslov).Text = "Ukucajte novi broj telefona: ";

            var telefonText = view.FindViewById <EditText>(Resource.Id.promeniMailNoviMail);
            var sifraText   = view.FindViewById <EditText>(Resource.Id.promeniPotvrdaSifre);

            //dialog vrsi se obradadada
            var dialogObrada = new Android.Support.V7.App.AlertDialog.Builder(this);

            dialogObrada.SetTitle("Vrsi se azuriranje telefona!");
            dialogObrada.SetMessage("Molimo sacekajte.");
            dialogObrada.SetCancelable(false);
            //

            dialog.SetPositiveButton("Promeni", delegate(object o, DialogClickEventArgs args)
            {
                if (telefonText.Text.Equals(String.Empty))
                {
                    Toast.MakeText(this, "Molimo ukucajte novi broj telefona.", ToastLength.Short);
                    dialog.Dispose();
                }

                if (sifraText.Text.Equals(String.Empty))
                {
                    Toast.MakeText(this, "Molimo potvrdite sifrom.", ToastLength.Short);
                    dialog.Dispose();
                }

                StudentAzuriranjeDto noviTelefon = new StudentAzuriranjeDto()
                {
                    Telefon    = telefonText.Text,
                    StaraSifra = sifraText.Text
                };

                dialogObrada.Show();
                Api.Api.UpdateKorisnika(noviTelefon);
                dialogObrada.Dispose();

                Toast.MakeText(this, "Uspesno ste azurirali Vas broj telefona.", ToastLength.Long);
            });

            dialog.SetNegativeButton("Odustani", delegate(object o, DialogClickEventArgs args) { dialog.Dispose(); });

            dialog.Show();
        }
示例#8
0
        public async void PostQuestion()
        {
            //是否登录
            var user = UserShared.GetAccessToken(this);

            if (user.access_token == "" || user.RefreshTime.AddSeconds(user.expires_in) < DateTime.Now)
            {
                //未登录或清空Token失效
                //清空Token
                UserShared.Update(this, new AccessToken());
                await SQLiteUtils.Instance().DeleteUserAll();

                Android.Support.V7.App.AlertDialog.Builder dialog = new Android.Support.V7.App.AlertDialog.Builder(this);
                dialog.SetMessage(Resources.GetString(Resource.String.need_login_tip));
                dialog.SetPositiveButton(Resources.GetString(Resource.String.confirm), delegate
                {
                    StartActivityForResult(new Intent(this, typeof(AuthorizeActivity)), (int)RequestCode.LoginCode);
                    dialog.Dispose();
                });
                dialog.SetNegativeButton(Resources.GetString(Resource.String.cancel), delegate
                {
                    dialog.Dispose();
                });
                dialog.Create().Show();
            }
            else
            {
                var title   = txtTitle.Text;
                var tags    = txtTags.Text;
                var content = txtContent.Text;
                if (title.Length == 0)
                {
                    Toast.MakeText(this, "请输入标题", ToastLength.Short).Show();
                }
                else if (title.Length < 3)
                {
                    Toast.MakeText(this, "标题的内容太少了,至少3个字吧", ToastLength.Short).Show();
                }
                else if (content.Length == 0)
                {
                    Toast.MakeText(this, "请输入提问内容", ToastLength.Short).Show();
                }
                else if (content.Length < 3)
                {
                    Toast.MakeText(this, "提问内容太少了,至少3个字吧", ToastLength.Short).Show();
                }
                else
                {
                    dialog.SetMessage(Resources.GetString(Resource.String.addstatusing));
                    dialog.Show();
                    questionPresenter.QuestionAdd(user, title, content, tags, 1);
                }
            }
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                Intent myIntent = Intent;
                myIntent.PutExtra("Guardado", guardado);
                SetResult(Result.Ok, myIntent);
                Finish();
                break;

            case Resource.Id.menuReservaEditar:
                if (reserva.Cerrada)
                {
                    Toast.MakeText(this.BaseContext, "No se puede modificar una reserva finalizada", ToastLength.Long).Show();
                }
                else
                {
                    var activityEdit = new Intent(this, typeof(ReservasNuevo2Activity));
                    activityEdit.PutExtra("reserva", JsonConvert.SerializeObject(reserva));
                    activityEdit.PutExtra("trabajador", JsonConvert.SerializeObject(trabajador));
                    StartActivityForResult(activityEdit, 1);
                }

                break;

            case Resource.Id.menuReservaCancelar:

                Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this);
                alertDialog.SetTitle("Cancelación de reserva");
                alertDialog.SetMessage("Se cancelará esta reserva.\n\n¿Desea continuar?");
                alertDialog.SetCancelable(true);
                alertDialog.SetNegativeButton("Cancelar", delegate
                {
                    alertDialog.Dispose();
                });
                alertDialog.SetPositiveButton("Aceptar", delegate
                {
                    reserva.Cerrada = true;
                    textEstado.Text = "Cancelada";
                    reserva.Estado  = "Cancelada";
                    db.Update(reserva);
                    guardado = true;
                    alertDialog.Dispose();
                });
                alertDialog.Show();
                break;
            }

            return(base.OnOptionsItemSelected(item));
        }
示例#10
0
        //check for location service enable or not
        private void EnableLocationDialog()
        {
            LocationManager lm = (LocationManager)GetSystemService(LocationService);

            if (!lm.IsProviderEnabled(LocationManager.GpsProvider) || !lm.IsProviderEnabled(LocationManager.NetworkProvider))
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("Location Service Disabled");
                alert.SetMessage("Please enable location services");

                alert.SetPositiveButton("ENABLE", (senderAlert, args) =>
                {
                    alert.Dispose();
                    Intent intent = new Intent(Android.Provider.Settings.ActionLocationSourceSettings);
                    StartActivity(intent);
                    //TryGetLocationAsync();
                });
                alert.Create();
                alert.Show();
            }
            else
            {
                TryGetLocationAsync();
            }
        }
示例#11
0
        public override void OnBackPressed()
        {
            //base.OnBackPressed();

            var logalert = new Android.Support.V7.App.AlertDialog.Builder(this);

            logalert.SetTitle("Upozorenje!");
            logalert.SetMessage("Da li ste sigurni da zelite da se odjavite?");

            logalert.SetPositiveButton("Da", (sender, args) =>
            {
                try
                {
                    Api.Api.LogoutUser(MSettings.CurrentSession.SessionID);
                    var intent = new Intent(this, typeof(MainActivity));
                    intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask);
                    StartActivity(intent);
                    this.Finish();
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
                }
            });

            logalert.SetNegativeButton("Ne", (sender, args) => logalert.Dispose());

            logalert.Show();
        }
示例#12
0
        private void ShareWhatsUp()
        {
            try
            {
                Intent whatsappIntent = new Intent(Intent.ActionSend);
                whatsappIntent.SetType("text/plain");
                whatsappIntent.PutExtra(Intent.ExtraSubject, "Wanunuzi.com");
                string sAux = "\nLet me recommend you this application\n\n";
                sAux = sAux + "https://play.google.com/store/apps/details?id=wanunuzi.com \n\n";

                whatsappIntent.PutExtra(Intent.ExtraText, sAux);

                whatsappIntent.SetPackage("com.whatsapp");
                whatsappIntent.PutExtra(Intent.ExtraText, sAux);
                this.StartActivity(whatsappIntent);
            }
            catch
            {
                var builder = new Android.Support.V7.App.AlertDialog.Builder(this);
                builder.SetTitle(Resource.String.dlg_info);
                builder.SetMessage("Whatsapp Not Installed");
                builder.SetPositiveButton(Resource.String.dialog_ok, delegate
                {
                    builder.Dispose();
                });
                builder.Show();
            }
        }
示例#13
0
        private void Adapter_ItemClick(object sender, VehicleAdapterClickEventArgs e)
        {
            selectedVehicleType = vehicletypeList[e.Position];
            Android.Support.V7.App.AlertDialog.Builder
                selectVehicle = new Android.Support.V7.App.AlertDialog.Builder(this);
            selectVehicle.SetTitle("You Have Selected " + vehicletypeList[e.Position].VehicleName);
            selectVehicle.SetMessage("Are you sure want to go with " +
                                     vehicletypeList[e.Position].VehicleName + "?");
            selectVehicle.SetPositiveButton("Continue", (deleteAlert, args) =>
            {
                var activity = new Intent(this, typeof(MainActivity));
                // activity.PutExtra("VehicleImage", selectedVehicleType.Image);
                selectedVehicleType.Image = null;
                string selectedType       = JsonConvert.SerializeObject(selectedVehicleType);
                activity.PutExtra("vehicleType", selectedType);
                StartActivity(activity);
                this.Finish();
            });
            selectVehicle.SetNegativeButton("Cancel", (deleteAlert, args) =>
            {
                selectedVehicleType = new VehicleType();
                selectVehicle.Dispose();
            });

            selectVehicle.Show();
        }
示例#14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Company);
            ParseAndReturnAsync();
            LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this);
            View           popup = layoutInflaterAndroid.Inflate(Resource.Layout.HistoryWindowU, null);

            Android.Support.V7.App.AlertDialog.Builder alertDialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertDialogbuilder.SetView(popup);

            var userContent = popup.FindViewById <EditText>(Resource.Id.History_description);

            alertDialogbuilder.SetCancelable(false)
            .SetPositiveButton("Dodaj", delegate
            {
                Toast.MakeText(this, "Wysłano", ToastLength.Long).Show();
            }
                               ).SetNegativeButton("Zamknij", delegate
            {
                alertDialogbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogbuilder.Create();
            if (this.Intent.GetBooleanExtra("Show", true))
            {
                alertDialogAndroid.Show();
            }
        }
 public override void OnBackPressed()
 {
     Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
     alert.SetTitle("Are you sure want to go back?");
     alert.SetMessage("You may lose your current processed data.");
     alert.SetPositiveButton("Yes", (senderAlert, args) =>
     {
         alert.Dispose();
         base.OnBackPressed();
     });
     alert.SetNegativeButton("No", (sendAlert, args) =>
     {
         alert.Dispose();
     });
     alert.Show();
 }
示例#16
0
        private void Btn1_Click(object sender, EventArgs e)
        {
            string id      = etID.Text.Trim();
            string message = "";

            try
            {
                int      categoryid = int.Parse(id);
                Category category   = operation.GetCategory(categoryid);
                if (category != null)
                {
                    if (operation.CheckCategoryProduct(category.CategoryID))
                    {
                        Android.Support.V7.App.AlertDialog.Builder winBuild = new Android.Support.V7.App.AlertDialog.Builder(this);
                        winBuild.SetTitle("Message!!!");
                        winBuild.SetMessage("There are some Product associated with Given Category ID. So This Category is not suitable for Delete");
                        winBuild.SetNegativeButton("Close", (c, v) =>
                        {
                            winBuild.Dispose();
                        });
                        winBuild.Show();
                    }
                    else
                    {
                        Android.Support.V7.App.AlertDialog.Builder winBuild = new Android.Support.V7.App.AlertDialog.Builder(this);
                        winBuild.SetTitle("Confirmation!!!");
                        winBuild.SetMessage("Are You Sure to Remove This Record with Text: " + category.CategoryName);
                        winBuild.SetPositiveButton("Delete Record", (c, v) =>
                        {
                            if (operation.DeleteCategory(category))
                            {
                                message = "Category Details is Removed From Database";
                            }
                            else
                            {
                                message = "There is Problem in Delete the Category";
                            }
                            Toast.MakeText(this, message, ToastLength.Long).Show();
                        });
                        winBuild.SetNegativeButton("Exit", (c, v) =>
                        {
                            winBuild.Dispose();
                        });
                        winBuild.Show();
                    }
                }
                else
                {
                    message = "There is no such Category Details For Given Category ID";
                }
            }
            catch (Exception ex)
            {
                message = "Invalid Form of Category ID Given";
            }
            if (message.Length != 0)
            {
                Toast.MakeText(this, message, ToastLength.Long).Show();
            }
        }
示例#17
0
        private void DonorsAdapter_DeleteClick(object sender, UserAdapterClickEventArgs e)
        {
            var donor = listOfDonors[e.Position];

            Android.Support.V7.App.AlertDialog.Builder DeleteAlert = new Android.Support.V7.App.AlertDialog.Builder(this);
            DeleteAlert.SetMessage("Are you sure?");
            DeleteAlert.SetTitle("Delete Donor");


            DeleteAlert.SetPositiveButton("Delete", (alert, args) =>
            {
                listOfDonors.RemoveAt(e.Position);
                donorsAdapter.NotifyItemRemoved(e.Position);  // donorsAdapter.NotifyDataSetChanged(); <- not using because refreshes whole view. Potential loss of data

                // Update shared preferences when a row is deleted from list
                string jsonString = JsonConvert.SerializeObject(listOfDonors); // Serializes list we passed in into JSON string (using JSON Newton Nuget)
                editor.PutString("donors", jsonString);
                editor.Apply();                                                // Saves donors to shared preferences
            });

            DeleteAlert.SetNegativeButton("Cancel", (alert, args) =>
            {
                DeleteAlert.Dispose();
            });

            DeleteAlert.Show();
        }
示例#18
0
        private void OnTestBtnOnClick(object sender, EventArgs e)
        {
            this.Window.AddFlags(WindowManagerFlags.Fullscreen);
            this.Window.ClearFlags(WindowManagerFlags.Fullscreen);


            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           view           = layoutInflater.Inflate(Resource.Layout.user_input_dialog, null);

            Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertbuilder.SetView(view);
            var userdata = view.FindViewById <EditText>(Resource.Id.editText);

            alertbuilder.SetCancelable(false)
            .SetPositiveButton("Speichern", delegate
            {
                Toast.MakeText(this, "Eingabe Speichern: " + userdata.Text, ToastLength.Short).Show();
            })
            .SetNegativeButton("Abbrechen", delegate
            {
                alertbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
            dialog.Show();
        }
示例#19
0
        private async void Queue_Btn_Click(object sender, EventArgs e)
        {
            await get_Queue_Size();

            if (already_queued)
            {
                Toast.MakeText(this, "You are already in the Queue for " + cur_restaurant.name, ToastLength.Short).Show();
            }
            else
            {
                LayoutInflater layoutInflater = LayoutInflater.From(this);
                View           view           = layoutInflater.Inflate(Resource.Layout.Queue_dialog_box, null);
                Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
                alertbuilder.SetView(view);

                party_size = view.FindViewById <EditText>(Resource.Id.party_size);
                view.FindViewById <TextView>(Resource.Id.positionTextView).Text += cur_queue_size;

                alertbuilder.SetCancelable(false).SetPositiveButton("Queue Up", QueueUp)
                .SetNegativeButton("Cancel", delegate
                {
                    alertbuilder.Dispose();
                });
                Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
                dialog.Show();
            }
        }
        public void activateGodmode()
        {
            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           view           = layoutInflater.Inflate(Resource.Layout.GiftCode, null);

            Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertbuilder.SetView(view);

            String code = "";

            var input = view.FindViewById <EditText>(Resource.Id.editText);

            alertbuilder.SetCancelable(false)
            .SetPositiveButton("Choose", delegate
            {
                code = input.Text;
                if (code == "godmode")
                {
                    godmode = !godmode;
                }
                Console.WriteLine(code + " " + godmode);
                canvasView.Invalidate();
            })
            .SetNegativeButton("Cancel", delegate
            {
                alertbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
            dialog.Show();
        }
示例#21
0
        protected override void OnResume()
        {
            base.OnResume();
            Task startupWork = new Task(() =>
            {
                Thread.Sleep(SplashTimeOut);
            });

            startupWork.ContinueWith(t =>
            {
                if (IsConnecting() == true)
                {
                    var prefs          = Application.Context.GetSharedPreferences("WeClip", FileCreationMode.Private);
                    string UserName    = prefs.GetString("LoginUserName", null);
                    string Password    = prefs.GetString("Password", null);
                    string tokenValue  = prefs.GetString("Access_Token", null);
                    string userID      = prefs.GetString("UserID", null);
                    bool RegisterEmail = prefs.GetBoolean("RegisterEmail", false);
                    bool RegisterPhone = prefs.GetBoolean("RegisterPhone", false);

                    if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password))
                    {
                        if (RegisterEmail == true)
                        {
                            StartActivity(new Intent(Application.Context, typeof(AddUserName)));
                            return;
                        }
                        else
                        if (RegisterEmail == true)
                        {
                            StartActivity(new Intent(Application.Context, typeof(AddUserName)));
                            return;
                        }
                        else
                        {
                            new LogInWeClip(UserName, Password, this).Execute();
                        }
                    }
                    else
                    {
                        StartActivity(new Intent(Application.Context, typeof(LoginActivity)));
                    }
                }
                else
                {
                    Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                    alert.SetInverseBackgroundForced(true);
                    alert.SetTitle("No Internet connection");
                    alert.SetMessage("Check your Internet connection");
                    alert.SetPositiveButton("CLOSE", (senderAlert, args) =>
                    {
                        alert.Dispose();
                        this.Finish();
                    });
                    Android.App.Dialog dialog = alert.Create();
                    dialog.Show();
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
            startupWork.Start();
        }
示例#22
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            string id      = etSubjectID.Text.Trim();
            string message = "";

            try
            {
                int     subjectid = int.Parse(id);
                Subject subject   = manager.GetSubject(subjectid);
                if (subject != null)
                {
                    if (manager.CheckSubjectQuestion(subject.SubjectID))
                    {
                        Android.Support.V7.App.AlertDialog.Builder winBuild = new Android.Support.V7.App.AlertDialog.Builder(this);
                        winBuild.SetTitle("Message!!!");
                        winBuild.SetMessage("There are some Question associated with Given Subject ID. So Deletion not Possible");
                        winBuild.SetNegativeButton("Close", (c, v) =>
                        {
                            winBuild.Dispose();
                        });
                        winBuild.Show();
                    }
                    else
                    {
                        Android.Support.V7.App.AlertDialog.Builder winBuild = new Android.Support.V7.App.AlertDialog.Builder(this);
                        winBuild.SetTitle("Confirmation!!!");
                        winBuild.SetMessage("Are You Sure to Remove This Record with Text: " + subject.SubjectName);
                        winBuild.SetPositiveButton("Delete Record", (c, v) =>
                        {
                            if (manager.DeleteSubject(subject))
                            {
                                message = "Subject is Removed From Database";
                            }
                            else
                            {
                                message = "There is Problem in Delete the Subject";
                            }
                            Toast.MakeText(this, message, ToastLength.Long).Show();
                        });
                        winBuild.SetNegativeButton("Exit", (c, v) =>
                        {
                            winBuild.Dispose();
                        });
                        winBuild.Show();
                    }
                }
                else
                {
                    message = "There is no such Subject Details For Given Subject ID";
                }
            }
            catch (Exception ex)
            {
                message = "Invalid Form of Subject ID Given";
            }
            if (message.Length != 0)
            {
                Toast.MakeText(this, message, ToastLength.Long).Show();
            }
        }
        private void Btn1_Click(object sender, EventArgs e)
        {
            string id      = etID.Text.Trim();
            string message = "";

            try
            {
                int     productid = int.Parse(id);
                Product product   = operation.GetProduct(productid);
                if (product != null)
                {
                    if (operation.CheckProductSale(product.ProductID))
                    {
                        Android.Support.V7.App.AlertDialog.Builder winBuild = new Android.Support.V7.App.AlertDialog.Builder(this);
                        winBuild.SetTitle("Message!!!");
                        winBuild.SetMessage("There are some Sale Entries For This Product. So This Product is not suitable for Delete");
                        winBuild.SetNegativeButton("Close", (c, v) =>
                        {
                            winBuild.Dispose();
                        });
                        winBuild.Show();
                    }
                    else
                    {
                        Android.Support.V7.App.AlertDialog.Builder winBuild = new Android.Support.V7.App.AlertDialog.Builder(this);
                        winBuild.SetTitle("Confirmation!!!");
                        winBuild.SetMessage("Are You Sure to Remove This Record with Product Name: " + product.ProductName);
                        winBuild.SetPositiveButton("Delete Record", (c, v) =>
                        {
                            if (operation.DeleteProduct(product))
                            {
                                message = "Product Details is Removed From Database";
                            }
                            else
                            {
                                message = "There is Problem in Delete the Product";
                            }
                            Toast.MakeText(this, message, ToastLength.Long).Show();
                        });
                        winBuild.SetNegativeButton("Exit", (c, v) =>
                        {
                            winBuild.Dispose();
                        });
                        winBuild.Show();
                    }
                }
                else
                {
                    message = "There is no such Product Details For Given Product ID";
                }
            }
            catch (Exception ex)
            {
                message = "Invalid Form of Product ID Given";
            }
            if (message.Length != 0)
            {
                Toast.MakeText(this, message, ToastLength.Long).Show();
            }
        }
示例#24
0
        private void GoOnlineButton_Click(object sender, EventArgs e)
        {
            if (!CheckSpecialPermision())
            {
                return;
            }
            if (availabilityStatus)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("GO OFFLINE");
                alert.SetMessage("You will not able to receive ride Request");
                alert.SetPositiveButton("Continue", (senderAlert, args) =>
                {
                    homeFragment.GoOffline();
                    goOnlineButton.Text       = "Go Online";
                    goOnlineButton.Background = ContextCompat.GetDrawable(this, Resource.Drawable.tourroundButton_online);
                    availabilityStatus        = false;
                    TakeDriverOffline();
                });

                alert.SetNegativeButton("Cancel", (senderAlert, args) =>
                {
                    alert.Dispose();
                });
                alert.Show();
            }
            else
            {
                availabilityStatus = true;
                homeFragment.GoOnline();
                goOnlineButton.Text       = "Go offline";
                goOnlineButton.Background = ContextCompat.GetDrawable(this, Resource.Drawable.tourroundButton_green);
            }
        }
示例#25
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            string fullname   = fullnameText.EditText.Text;
            string department = departmentText.EditText.Text;
            string set        = setText.EditText.Text;

            HashMap aluminiInfo = new HashMap();

            aluminiInfo.Put("fullname", fullname);
            aluminiInfo.Put("department", department);
            aluminiInfo.Put("set", set);
            aluminiInfo.Put("status", status);

            SupportV7.AlertDialog.Builder saveDataAlert = new SupportV7.AlertDialog.Builder(Activity);
            saveDataAlert.SetTitle("SAVE ALUMINI INFORMATION");
            saveDataAlert.SetMessage("Are you sure?");
            saveDataAlert.SetPositiveButton("Continue", (senderAlert, args) =>
            {
                DatabaseReference newAluminRef = AppDataHelper.GetDatabase().GetReference("alumini").Push();
                newAluminRef.SetValue(aluminiInfo);
                this.Dismiss();
            });
            saveDataAlert.SetNegativeButton("Cancel", (senderAlert, args) =>
            {
                saveDataAlert.Dispose();
            });

            saveDataAlert.Show();
        }
示例#26
0
        public override void OnBackPressed()
        {
            if (indexer == 0)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("Exit");
                alert.SetMessage("Do you want to Exit?");
                alert.SetPositiveButton("Yes", async(senderAlert, args) =>
                {
                    this.FinishAffinity();
                });

                alert.SetNegativeButton("No", (senderAlert, args) =>
                {
                    alert.Dispose();
                });


                Dialog dialog = alert.Create();
                dialog.Show();
            }


            else
            {
                var ft = SupportFragmentManager.BeginTransaction();
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.content_frame, new ChatGroupContactFragment(0));
                ft.Commit();
                indexer = 0;
            }
        }
示例#27
0
        private void ShareInstagram()
        {
            try
            {
                var    info = PackageManager.GetApplicationInfo("com.instagram.android", 0);
                Intent i    = new Intent(Intent.ActionSend);
                i.SetType("text/plain");
                i.PutExtra(Intent.ExtraSubject, "Wanunuzi.com");
                string sAux = "\nLet me recommend you this application\n\n";
                sAux = sAux + "https://play.google.com/store/apps/details?id=wanunuzi.com \n\n";

                i.PutExtra(Intent.ExtraText, sAux);

                i.PutExtra(Intent.ExtraText, sAux);
                i.SetPackage("com.instagram.android");
                StartActivity(i);
            }
            catch
            {
                var builder = new Android.Support.V7.App.AlertDialog.Builder(this);
                builder.SetTitle(Resource.String.dlg_info);
                builder.SetMessage("Instagram Not Installed");
                builder.SetPositiveButton(Resource.String.dialog_ok, delegate
                {
                    builder.Dispose();
                });
                builder.Show();
            }
        }
示例#28
0
        private void OnStartTimeClicked(object sender, EventArgs e)
        {
            if (presenter.IsEnabled)
            {
                return;
            }

            if (btDevice == null)
            {
                v7App.AlertDialog.Builder alert = new v7App.AlertDialog.Builder(this);
                alert.SetTitle("Bluetooth Device can't be found");
                alert.SetMessage("Please check if device is turned on");
                alert.SetNeutralButton("OK", delegate
                {
                    alert.Dispose();
                    OnBackPressed();
                });
                alert.Show();
            }
            else
            {
                //btService.Start(); - acceptThread to eh
                //btService.StartClient(btDevice);
                presenter.StartTimer();
            }
        }
示例#29
0
        private void DonorsAdapter_EmailClick(object sender, DonorsAdapterClickEventArgs e)
        {
            Console.WriteLine("EmailClick called");
            var donor = listOfDonors[e.Position];

            Android.Support.V7.App.AlertDialog.Builder EmailAlert = new Android.Support.V7.App.AlertDialog.Builder(this);
            EmailAlert.SetMessage("Send Mail to " + donor.Fullname);

            EmailAlert.SetPositiveButton("Send", (alert, args) =>
            {
                // Send Email
                Intent intent = new Intent();
                intent.SetType("plain/text");
                intent.SetAction(Intent.ActionSend);
                intent.PutExtra(Intent.ExtraEmail, new string[] { donor.Email });
                intent.PutExtra(Intent.ExtraSubject, "Enquiry on your availability for blood donation");
                StartActivity(intent);
            });

            EmailAlert.SetNegativeButton("Cancel", (alert, args) =>
            {
                EmailAlert.Dispose();
            });

            EmailAlert.Show();
        }
示例#30
0
        private void Btndelete_Click(object sender, EventArgs e)
        {
            string id      = etid.Text.Trim();
            string message = "";

            try
            {
                Hospital hospital = operations.GetHospital(int.Parse(id));
                if (hospital != null)
                {
                    if (operations.CheckHospitalBooking(hospital.HospitalID))
                    {
                        Android.Support.V7.App.AlertDialog.Builder winBuild = new Android.Support.V7.App.AlertDialog.Builder(this);
                        winBuild.SetTitle("Message!!!");
                        winBuild.SetMessage("There are Booking associated with this Hospital. So Deletion not Possible");
                        winBuild.SetNegativeButton("Close", (c, v) =>
                        {
                            winBuild.Dispose();
                        });
                        winBuild.Show();
                    }
                    else
                    {
                        Android.Support.V7.App.AlertDialog.Builder winBuild = new Android.Support.V7.App.AlertDialog.Builder(this);
                        winBuild.SetTitle("Confirmation!!!");
                        winBuild.SetMessage("Are You Sure to Remove This Record with Text: " + hospital.HospitalName);
                        winBuild.SetPositiveButton("Delete Record", (c, v) =>
                        {
                            if (operations.DeleteHospital(hospital))
                            {
                                message = "Details of Hospital are Removed";
                            }
                            else
                            {
                                message = "There is Problem in Deletion Process";
                            }
                            Toast.MakeText(this, message, ToastLength.Long).Show();
                        });
                        winBuild.SetNegativeButton("Exit", (c, v) =>
                        {
                            winBuild.Dispose();
                        });
                        winBuild.Show();
                    }
                }
                else
                {
                    message = "There is no such Hospital Details For Given ID";
                }
            }
            catch (Exception)
            {
                message = "Invalid Form of ID Given. It must be number";
            }
            if (message.Length != 0)
            {
                Toast.MakeText(this, message, ToastLength.Long).Show();
            }
        }