private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            var dialog = new AlertDialog.Builder(this);

            dialog.SetTitle("Remove");
            dialog.SetMessage("Do you want to remove this item?");
            dialog.SetPositiveButton("Yes", async delegate
            {
                _removedAmount += _adapter[e.Position].Amount;
                _adapter.RemoveAt(e.Position);
                _adapter.NotifyDataSetChanged();
                await FileWorker.RewriteFile(_expenses, MainActivity.PathToFile);
            });
            dialog.SetNegativeButton("No", delegate
            {
                dialog.Dispose();
            });
            dialog.Show();
        }
        // Handle click events for said menu/action items
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            // Bookmarks action
            case Resource.Id.menu_bookmark:
                // Go to bookmarksActivity (page) when pressing the bookmarks menu icon
                Intent intentBookmark = new Intent(this, typeof(BookmarksActivity));
                this.StartActivity(intentBookmark);
                return(true);

            // About action
            case Resource.Id.menu_about:
                LayoutInflater      layoutInflaterAboutDialog = LayoutInflater.From(this);
                View                homeView_2       = layoutInflaterAboutDialog.Inflate(Resource.Layout.dialog_about, null);
                AlertDialog.Builder alertDialogAbout = new AlertDialog.Builder(this);
                alertDialogAbout.SetView(homeView_2);
                alertDialogAbout
                .SetNegativeButton("Cancel", delegate
                {
                    alertDialogAbout.Dispose();
                });
                AlertDialog alertDialogAndroid_1 = alertDialogAbout.Create();
                alertDialogAndroid_1.Show();
                return(true);

            // Change log action
            case Resource.Id.menu_change_log:
                LayoutInflater      layoutInflaterChangeLogDialog = LayoutInflater.From(this);
                View                homeView_3           = layoutInflaterChangeLogDialog.Inflate(Resource.Layout.dialog_change_log, null);
                AlertDialog.Builder alertDialogChangeLog = new AlertDialog.Builder(this);
                alertDialogChangeLog.SetView(homeView_3);
                alertDialogChangeLog
                .SetNegativeButton("Cancel", delegate
                {
                    alertDialogChangeLog.Dispose();
                });
                AlertDialog alertDialogAndroid_2 = alertDialogChangeLog.Create();
                alertDialogAndroid_2.Show();
                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }
        private void D2_RegistoEfetuado(object sender, OnRegistoEventArgs e)
        {
            int u = Facade.RegistaUtilizador(e.Utilizador);

            if (u == -2)
            {
                //-2 se já existir
                //0 sucesso
                //1 nop
                AlertDialog.Builder ad = new AlertDialog.Builder(this);
                ad.SetTitle("Ooops!");
                ad.SetMessage("O utilizador já existe!");
                ad.SetNeutralButton("Ok", delegate
                {
                    ad.Dispose();
                });
                ad.Show();
            }
        }
示例#4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.result_activity);
            paymentDetails = FindViewById <View>(Resource.Id.message);
            txtresult      = paymentDetails.FindViewById <TextView>(Resource.Id.txtSellerResult);
            txtamt         = paymentDetails.FindViewById <TextView>(Resource.Id.txtAmtResult);
            pay            = FindViewById <Button>(Resource.Id.btnPay);
            if (this.Intent.Extras != null)
            {
                string token = this.Intent.Extras.GetString("Token");
                string users = this.Intent.Extras.GetString("User");
                try
                {
                    transactionObject = JsonConvert.DeserializeObject <TransactionObject>(token);
                    user = JsonConvert.DeserializeObject <User>(users);
                    transactionObject.UserID = user.UserID;
                }
                catch
                {
                    AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                    dialog.SetTitle("Something Went Wrong");
                    dialog.SetMessage("Test");
                    dialog.SetNeutralButton("Ok", delegate { dialog.Dispose(); });
                    dialog.Show();
                }
                txtresult.Text = transactionObject.TransactionSeller;
                txtamt.Text    = transactionObject.TransactionAmount.ToString();
            }
            if (transactionObject.TransactionAmount <= user.UserBalance)
            {
                pay.Text = "Pay";
                pay.SetBackgroundResource(Resource.Drawable.bckGroundTurquise);
            }
            else
            {
                pay.Text = "Insufficient Funds";
            }
            pay.Click += gonext;
        }
        private void D1_LoginEfetuado(object sender, OnLoginEventArgs e)
        {
            Utilizador u = Facade.ConnectLogin(e.Username, e.Password);

            if (u is Proprietario)
            {
                AlertDialog.Builder ad = new AlertDialog.Builder(this);
                ad.SetTitle("Proprietario");
                ad.SetMessage("Bem vindo Proprietario ! " + u.GetNome());
                ad.SetNeutralButton("Ok", delegate
                {
                    ad.Dispose();
                });
                ad.Show();
            }
            else
            {
                if (u is Cliente)
                {
                    AlertDialog.Builder ad = new AlertDialog.Builder(this);
                    ad.SetTitle("Cliente");
                    ad.SetMessage("Bem vindo cliente !");
                    ad.SetNeutralButton("Ok", delegate
                    {
                        ad.Dispose();
                    });
                    ad.Show();
                }
                else
                {
                    AlertDialog.Builder ad = new AlertDialog.Builder(this);
                    ad.SetTitle("Erro buddy");
                    ad.SetMessage("A tua password ou username devem estar erradas !");
                    ad.SetNeutralButton("Ok", delegate
                    {
                        ad.Dispose();
                    });
                    ad.Show();
                }
            }
        }
示例#6
0
        bool GetPermissionsAsync()
        {
            const string permission = Manifest.Permission.AccessFineLocation;

            if (CheckSelfPermission(permission) == (int)Android.Content.PM.Permission.Granted)
            {
                Toast.MakeText(this, "Permiso Especial Concedido", ToastLength.Short).Show();
                _geoPermission = true;
            }

            if (ShouldShowRequestPermissionRationale(permission))
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Permisos");
                alert.SetMessage("La aplicación necesita permisos especiales para continuar.");
                alert.SetPositiveButton("Request Permissions", (senderAlert, args) =>
                {
                    RequestPermissions(PermissionsGroupLocation, RequestLocationId);
                    _geoPermission = true;
                });

                alert.SetNegativeButton("Cancelar", (senderAlert, args) =>
                {
                    Toast.MakeText(this, "Cancelado!", ToastLength.Short).Show();
                    _geoPermission = false;
                });
                Dialog dialog = alert.Create();
                dialog.Show();

                alert.Dispose();
            }
            if (!_geoPermission)
            {
                RequestPermissions(PermissionsGroupLocation, RequestLocationId);
            }

            return(_geoPermission);
        }
示例#7
0
        //private async void GetVideo(AlertDialog.Builder alert)
        //{
        //    using (var client = ClientHelper.GetClient(CrossSettings.Current.GetValueOrDefault("token", "")))
        //    {
        //        BoxService.InitializeClient(client);
        //        var o_data = new ServiceResponseObject<SuccessResponse>();
        //        o_data = await BoxService.GetVideo(StaticBox.id);

        //        if (o_data.Status == HttpStatusCode.OK)
        //        {
        //            alert.Dispose();

        //            LayoutInflater layoutInflater = LayoutInflater.From(Activity);
        //            View view = layoutInflater.Inflate(Resource.Layout.modal_video, null);
        //            var img_get_video = view.FindViewById<VideoView>(Resource.Id.img_get_video);

        //            var src = Android.Net.Uri.Parse(URL + o_data.ResponseData.Message);
        //            img_get_video.SetVideoURI(src);
        //            img_get_video.Start();

        //            //var imageBitmap = HomeService.GetImageBitmapFromUrl(URL + o_data.ResponseData.Message);
        //            //img_get_video.SetVideoURI(imageBitmap);

        //            Android.App.AlertDialog.Builder alert1 = new Android.App.AlertDialog.Builder(Activity);
        //            alert1.SetTitle("Сделать видео");
        //            alert1.SetView(view);
        //            alert1.SetPositiveButton("Закрыть", (senderAlert1, args1) =>
        //            {
        //            });
        //            Dialog dialog1 = alert1.Create();
        //            dialog1.Show();
        //        }
        //        else
        //        {
        //            Toast.MakeText(Activity, o_data.Message, ToastLength.Long).Show();
        //        }
        //    }
        //}

        private async void GetPhoto(AlertDialog.Builder alert)
        {
            using (var client = ClientHelper.GetClient(CrossSettings.Current.GetValueOrDefault("token", "")))
            {
                BoxService.InitializeClient(client);
                var o_data = new ServiceResponseObject <SuccessResponse>();
                o_data = await BoxService.GetPhoto(StaticBox.id);

                if (o_data.Status == HttpStatusCode.OK)
                {
                    alert.Dispose();

                    LayoutInflater layoutInflater = LayoutInflater.From(Activity);
                    View           view           = layoutInflater.Inflate(Resource.Layout.modal_photo, null);
                    var            img_get_photo  = view.FindViewById <ImageView>(Resource.Id.img_get_photo);

                    var src = Android.Net.Uri.Parse(URL + o_data.ResponseData.Message);
                    img_get_photo.SetImageURI(src);

                    var imageBitmap = HomeService.GetImageBitmapFromUrl(URL + o_data.ResponseData.Message);
                    img_get_photo.SetImageBitmap(imageBitmap);

                    Android.App.AlertDialog.Builder alert1 = new Android.App.AlertDialog.Builder(Activity);
                    alert1.SetView(view);
                    ////
                    alert1.SetCancelable(false);
                    alert1.SetPositiveButton("Закрыть", (senderAlert1, args1) =>
                    {
                    });
                    Dialog dialog1 = alert1.Create();
                    dialog1.Show();
                }
                else
                {
                    Toast.MakeText(Activity, o_data.Message, ToastLength.Long).Show();
                }
            }
        }